Flutter Engine
The Flutter Engine
third_party
accessibility
ax
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
9
namespace
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.
15
static
std::optional<int32_t>
g_active_popup_ax_unique_id
;
16
17
std::optional<int32_t>
GetActivePopupAxUniqueId
() {
18
return
g_active_popup_ax_unique_id
;
19
}
20
21
void
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.
29
BASE_DCHECK
(!
GetActivePopupAxUniqueId
());
30
31
g_active_popup_ax_unique_id
= ax_unique_id;
32
}
33
34
void
ClearActivePopupAxUniqueId
() {
35
g_active_popup_ax_unique_id
= std::nullopt;
36
}
37
38
}
// namespace ui
ax_active_popup.h
ui
Definition:
window_binding_handler.h:18
ui::g_active_popup_ax_unique_id
static std::optional< int32_t > g_active_popup_ax_unique_id
Definition:
ax_active_popup.cc:15
ui::SetActivePopupAxUniqueId
void SetActivePopupAxUniqueId(std::optional< int32_t > ax_unique_id)
Definition:
ax_active_popup.cc:21
ui::ClearActivePopupAxUniqueId
void ClearActivePopupAxUniqueId()
Definition:
ax_active_popup.cc:34
ui::GetActivePopupAxUniqueId
std::optional< int32_t > GetActivePopupAxUniqueId()
Definition:
ax_active_popup.cc:17
logging.h
BASE_DCHECK
#define BASE_DCHECK(condition)
Definition:
logging.h:63
Generated on Sun Jun 23 2024 21:55:19 for Flutter Engine by
1.9.4