Flutter Engine
The Flutter Engine
ax_active_popup.cc
Go to the documentation of this file.
1// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ax_active_popup.h"
6
7#include "base/logging.h"
8
9namespace ui {
10// Represents a global storage for the view accessibility for an
11// autofill popup. It is a singleton wrapper around the ax unique id of the
12// autofill popup. This singleton is used for communicating the live status of
13// the autofill popup between web contents and views.
14// The assumption here is that only one autofill popup can exist at a time.
15static std::optional<int32_t> g_active_popup_ax_unique_id;
16
17std::optional<int32_t> GetActivePopupAxUniqueId() {
19}
20
21void SetActivePopupAxUniqueId(std::optional<int32_t> ax_unique_id) {
22 // When an instance of autofill popup hides, the caller of popup hide should
23 // make sure g_active_popup_ax_unique_id is cleared. The assumption is that
24 // there can only be one active autofill popup existing at a time. If on
25 // popup showing, we encounter g_active_popup_ax_unique_id is already set,
26 // this would indicate two autofill popups are showing at the same time or
27 // previous on popup hide call did not clear the variable, so we should fail
28 // DCHECK here.
30
31 g_active_popup_ax_unique_id = ax_unique_id;
32}
33
35 g_active_popup_ax_unique_id = std::nullopt;
36}
37
38} // namespace ui
static std::optional< int32_t > g_active_popup_ax_unique_id
void SetActivePopupAxUniqueId(std::optional< int32_t > ax_unique_id)
void ClearActivePopupAxUniqueId()
std::optional< int32_t > GetActivePopupAxUniqueId()
#define BASE_DCHECK(condition)
Definition: logging.h:63