electron/shell/browser/ui/webui/accessibility_ui.cc
Electron Bot 46f3491c7d
chore: bump chromium to 6b9fa6b352d824d052222e1abe541 (master) (#25558)
* chore: bump chromium in DEPS to d5c9bf9e2a18fa508201a88e5803bec1d107b1ae

* chore: bump chromium in DEPS to 45f1316afae33e52c92480b34bf4f7fe4a7db898

* update patches

* WillCreateURLLoaderFactory now gets a ukm_source_id

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2346803

* ink_drop_visible_opacity -> GetInkDropVisibleOpacity

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2415368

* chore: bump chromium in DEPS to ddb5b6db5e35ab1a7b5adbd9f15373af6c35ea2a

* 2418471: PDF Viewer update: Add missing aria-labels to various buttons.

https://chromium-review.googlesource.com/c/chromium/src/+/2418471

* update printing.patch given print settings mojoification

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2409467

* update patches

* content::BluetoothChooser::Event -> content::BluetoothChooserEvent

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2387901

* set_ink_drop_base_color -> SetInkDropBaseColor

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2419388

* chore: bump chromium in DEPS to ecf7c9ee830d4d85f300b461a2fa13aa40c79a4c

* update patches

* gfx::ConvertPointToPixel -> gfx::ConvertPointToPixels

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2418568

* remove ContentSettingsObserver::AllowStorage()

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2401847

* service_manager::kCrashDumpSignal -> kCrashDumpSignal

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2417073

* chore: bump chromium in DEPS to abdb7ebe5f8c8328b8f435283df90d0a3ecff7bd

* chore: bump chromium in DEPS to 2a7e138ab1066534ceb2622e8a9d2c8ebf574215

* chore: bump chromium in DEPS to ab1884e75ced904e4276851eb4e1ad89919ca93b

* chore: bump chromium in DEPS to a12413902380dcc2a73ac74d582328280a8af686

* Fixup printing patch

https://chromium-review.googlesource.com/c/chromium/src/+/2428623

* Fixup OSR patch

https://chromium-review.googlesource.com/c/chromium/src/+/2415128

* Make ExtensionURLLoaderFactory always owned by its |receivers_|.

https://chromium-review.googlesource.com/c/chromium/src/+/2357523

* Add deprecated_default_sources_assignment_filter variable

https://chromium-review.googlesource.com/c/chromium/src/+/2416496

* Fixup patch indices

* Remove several references to BrowserPlugin from content

https://chromium-review.googlesource.com/c/chromium/src/+/2401031

* Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation

https://chromium-review.googlesource.com/c/chromium/src/+/2415128

* Add DragOperation and AllowedDragOperations Mojo types

https://chromium-review.googlesource.com/c/chromium/src/+/2196167

* chore: bump chromium in DEPS to 378450342cf6aa160663d0ce3a178a11b570c25a

* Fixup patch indices

* Remove SurfaceEmbeddingTime and LocalSurfaceIdAllocation

https://chromium-review.googlesource.com/c/chromium/src/+/2415128

* Add DragOperation and AllowedDragOperations Mojo types

https://chromium-review.googlesource.com/c/chromium/src/+/2196167

* 2426564: Remove global sources assignment filter value

https://chromium-review.googlesource.com/c/chromium/src/+/2426564

* Fixup blink_local_frame.patch

* [XProto] Remove a subset of ui/gfx/x/x11.h

https://chromium-review.googlesource.com/c/chromium/src/+/2430328

* Fixup patch indices

* Remove several references to BrowserPlugin from content

https://chromium-review.googlesource.com/c/chromium/src/+/2401031

* Remove lossy ConvertSizeToPixel() methods

https://chromium-review.googlesource.com/c/chromium/src/+/2419534

* serial: Use USB driver name to disambiguate ports

https://chromium-review.googlesource.com/c/chromium/src/+/2413176

* Remove set_sources_filter import

* Fix ModMask usage

* [XProto] Remove usage of all Xlib headers

https://chromium-review.googlesource.com/c/chromium/src/+/2392140

* [XProto] Remove usage of Xlib Visuals

https://chromium-review.googlesource.com/c/chromium/src/+/2429933

* Skip Angle manifest file

https://chromium-review.googlesource.com/c/angle/angle/+/2425197

* Add whole src\third_party\angle\.git directory

This directory is needed in order to properly generate gen/angle/angle_commit.h

* [libvpx] Fix HighBD config on Windows ARM64

https://chromium-review.googlesource.com/c/chromium/src/+/2437745

* update patches

* fix: correct calling convention for Windows on Arm

https://chromium-review.googlesource.com/c/v8/v8/+/2440717

* Add third_party/angle/.git to the archive before adding the rest of the source

* fixup source caching on Windows

* Fixup erroneous close paren

* fixup for goma issues

* This should work

* chore: bump chromium roll manually

https://chromium-review.googlesource.com/c/chromium/src/+/2435142

This landed the day after we paused roller-bot and may resolve the
visibility test flakes that we're seeing. h/t to @jkleinsc for
finding this with me.

* chore: remove obsoleted cherry-pick fix for libvpx

https://chromium-review.googlesource.com/c/chromium/src/+/2437745

* chore: remove obsoleted cherry-pick libvpx patch

https://chromium-review.googlesource.com/c/chromium/src/+/2437745

* chore: re-export patches

* chore: add tracer comment to visibility-stat-spec.

The line numbers between the source and the CI runs don't seem to match
up, so this temp tracer is to help track the source of that difference.

* chore: bump chromium in DEPS to 7c2b8cc3b8638aee8abeb013042a6c1d15b2da6b

* update patches

* impl SortingLSH service

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2425327

* 2446525: [Flash] Remove some Flash APIs

https://chromium-review.googlesource.com/c/chromium/src/+/2446525

* 2440974: Reland "Delete service_manager/embedder/switches.h"

https://chromium-review.googlesource.com/c/chromium/src/+/2440974

* 2359402: Remove ContentBrowserClient::NonNetworkURLLoaderFactoryDeprecatedMap.

https://chromium-review.googlesource.com/c/chromium/src/+/2359402

* 2250506: Implement tabs.removeCSS

https://chromium-review.googlesource.com/c/chromium/src/+/2250506

* 2429143: Remove implicit-conversion-to-integer ConvertRectToPixel() methods.

https://chromium-review.googlesource.com/c/chromium/src/+/2429143

* 2444430: Remove DataElementType::kBlob

https://chromium-review.googlesource.com/c/chromium/src/+/2444430

* 2441964: Clean up WebView public API

https://chromium-review.googlesource.com/c/chromium/src/+/2441964

* 2357523: Make ExtensionURLLoaderFactory always owned by its |receivers_|.

https://chromium-review.googlesource.com/c/chromium/src/+/2357523

* 2461606: Use blink::mojom::PreferredColorScheme instead of blink::PreferredColorScheme

https://chromium-review.googlesource.com/c/chromium/src/+/2461606

* 2461235: a11y inspect reorg: move PropertyFilter struct to a new location

https://chromium-review.googlesource.com/c/chromium/src/+/2461235

* remove flash support

* fix frame_host_manager patch

* fix lint

* remove flash info from docs

* fix build

* fix osr

* chore: bump chromium in DEPS to 9269f9eb1d98d29564c2b2ab97f30c6e148c4e11

* fix visibilityState tests

* 2463049: Replace all uses of web_pref::AutoplayPolicy with mojom::AutoplayPolicy

https://chromium-review.googlesource.com/c/chromium/src/+/2463049

* update patches

* fix tests harder

* 2414921: Add Group and Ungroup functions to Tabs extension API

https://chromium-review.googlesource.com/c/chromium/src/+/2414921

* more test fix

* Remove all keyboard related usage of Xlib

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2436787

* fix linux build

* 2453807: [XProto] Remove usage of Xlib error handling

https://chromium-review.googlesource.com/c/chromium/src/+/2453807

* lint

* fixup! 2453807: [XProto] Remove usage of Xlib error handling

* disable CalculateNativeWinOcclusion on win ci

* remove UploadBlob from docs

* Update appveyor.yml

Co-authored-by: Andy Locascio <andy@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-10-15 18:30:41 -07:00

415 lines
16 KiB
C++

// Copyright (c) 2020 Microsoft, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/ui/webui/accessibility_ui.h"
#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/json/json_writer.h"
#include "base/optional.h"
#include "base/strings/pattern.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/dev_ui_browser_resources.h" // nogncheck
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/accessibility_tree_formatter.h"
#include "content/public/browser/ax_event_notification_details.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_ui_data_source.h"
#include "net/base/escape.h"
#include "shell/browser/native_window.h"
#include "shell/browser/window_list.h"
#include "ui/accessibility/platform/ax_platform_node.h"
#include "ui/accessibility/platform/ax_platform_node_delegate.h"
#include "ui/base/webui/web_ui_util.h"
namespace {
static const char kTargetsDataFile[] = "targets-data.json";
static const char kAccessibilityModeField[] = "a11yMode";
static const char kBrowsersField[] = "browsers";
static const char kErrorField[] = "error";
static const char kFaviconUrlField[] = "faviconUrl";
static const char kNameField[] = "name";
static const char kPagesField[] = "pages";
static const char kPidField[] = "pid";
static const char kSessionIdField[] = "sessionId";
static const char kProcessIdField[] = "processId";
static const char kRequestTypeField[] = "requestType";
static const char kRoutingIdField[] = "routingId";
static const char kTypeField[] = "type";
static const char kUrlField[] = "url";
static const char kTreeField[] = "tree";
// Global flags
static const char kBrowser[] = "browser";
static const char kCopyTree[] = "copyTree";
static const char kHTML[] = "html";
static const char kInternal[] = "internal";
static const char kLabelImages[] = "labelImages";
static const char kNative[] = "native";
static const char kPage[] = "page";
static const char kPDF[] = "pdf";
static const char kScreenReader[] = "screenreader";
static const char kShowOrRefreshTree[] = "showOrRefreshTree";
static const char kText[] = "text";
static const char kWeb[] = "web";
// Possible global flag values
static const char kDisabled[] = "disabled";
static const char kOff[] = "off";
static const char kOn[] = "on";
std::unique_ptr<base::DictionaryValue> BuildTargetDescriptor(
const GURL& url,
const std::string& name,
const GURL& favicon_url,
int process_id,
int routing_id,
ui::AXMode accessibility_mode,
base::ProcessHandle handle = base::kNullProcessHandle) {
std::unique_ptr<base::DictionaryValue> target_data(
new base::DictionaryValue());
target_data->SetInteger(kProcessIdField, process_id);
target_data->SetInteger(kRoutingIdField, routing_id);
target_data->SetString(kUrlField, url.spec());
target_data->SetString(kNameField, net::EscapeForHTML(name));
target_data->SetInteger(kPidField, base::GetProcId(handle));
target_data->SetString(kFaviconUrlField, favicon_url.spec());
target_data->SetInteger(kAccessibilityModeField, accessibility_mode.mode());
target_data->SetString(kTypeField, kPage);
return target_data;
}
std::unique_ptr<base::DictionaryValue> BuildTargetDescriptor(
content::RenderViewHost* rvh) {
content::WebContents* web_contents =
content::WebContents::FromRenderViewHost(rvh);
ui::AXMode accessibility_mode;
std::string title;
GURL url;
GURL favicon_url;
if (web_contents) {
url = web_contents->GetURL();
title = base::UTF16ToUTF8(web_contents->GetTitle());
content::NavigationController& controller = web_contents->GetController();
content::NavigationEntry* entry = controller.GetVisibleEntry();
if (entry != nullptr && entry->GetURL().is_valid()) {
gfx::Image favicon_image = entry->GetFavicon().image;
if (!favicon_image.IsEmpty()) {
const SkBitmap* favicon_bitmap = favicon_image.ToSkBitmap();
favicon_url = GURL(webui::GetBitmapDataUrl(*favicon_bitmap));
}
}
accessibility_mode = web_contents->GetAccessibilityMode();
}
return BuildTargetDescriptor(url, title, favicon_url,
rvh->GetProcess()->GetID(), rvh->GetRoutingID(),
accessibility_mode);
}
std::unique_ptr<base::DictionaryValue> BuildTargetDescriptor(
electron::NativeWindow* window) {
std::unique_ptr<base::DictionaryValue> target_data(
new base::DictionaryValue());
target_data->SetInteger(kSessionIdField, window->window_id());
target_data->SetString(kNameField, window->GetTitle());
target_data->SetString(kTypeField, kBrowser);
return target_data;
}
bool ShouldHandleAccessibilityRequestCallback(const std::string& path) {
return path == kTargetsDataFile;
}
// Add property filters to the property_filters vector for the given property
// filter type. The attributes are passed in as a string with each attribute
// separated by a space.
void AddPropertyFilters(std::vector<ui::AXPropertyFilter>* property_filters,
const std::string& attributes,
ui::AXPropertyFilter::Type type) {
for (const std::string& attribute : base::SplitString(
attributes, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
property_filters->push_back(ui::AXPropertyFilter(attribute, type));
}
}
bool MatchesPropertyFilters(
const std::vector<ui::AXPropertyFilter>& property_filters,
const std::string& text) {
bool allow = false;
for (const auto& filter : property_filters) {
if (base::MatchPattern(text, filter.match_str)) {
switch (filter.type) {
case ui::AXPropertyFilter::ALLOW_EMPTY:
allow = true;
break;
case ui::AXPropertyFilter::ALLOW:
allow = (!base::MatchPattern(text, "*=''"));
break;
case ui::AXPropertyFilter::DENY:
allow = false;
break;
}
}
}
return allow;
}
std::string RecursiveDumpAXPlatformNodeAsString(
const ui::AXPlatformNode* node,
int indent,
const std::vector<ui::AXPropertyFilter>& property_filters) {
if (!node)
return "";
std::string str(2 * indent, '+');
const std::string line = node->GetDelegate()->GetData().ToString();
const std::vector<std::string> attributes = base::SplitString(
line, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (const std::string& attribute : attributes) {
if (MatchesPropertyFilters(property_filters, attribute)) {
str += attribute + " ";
}
}
str += "\n";
for (int i = 0; i < node->GetDelegate()->GetChildCount(); i++) {
gfx::NativeViewAccessible child = node->GetDelegate()->ChildAtIndex(i);
const ui::AXPlatformNode* child_node =
ui::AXPlatformNode::FromNativeViewAccessible(child);
str += RecursiveDumpAXPlatformNodeAsString(child_node, indent + 1,
property_filters);
}
return str;
}
bool IsValidJSValue(const std::string* str) {
return str && str->length() < 5000U;
}
void HandleAccessibilityRequestCallback(
content::BrowserContext* current_context,
const std::string& path,
content::WebUIDataSource::GotDataCallback callback) {
DCHECK(ShouldHandleAccessibilityRequestCallback(path));
base::DictionaryValue data;
ui::AXMode mode =
content::BrowserAccessibilityState::GetInstance()->GetAccessibilityMode();
bool is_native_enabled = content::BrowserAccessibilityState::GetInstance()
->IsRendererAccessibilityEnabled();
bool native = mode.has_mode(ui::AXMode::kNativeAPIs);
bool web = mode.has_mode(ui::AXMode::kWebContents);
bool text = mode.has_mode(ui::AXMode::kInlineTextBoxes);
bool screenreader = mode.has_mode(ui::AXMode::kScreenReader);
bool html = mode.has_mode(ui::AXMode::kHTML);
bool pdf = mode.has_mode(ui::AXMode::kPDF);
// The "native" and "web" flags are disabled if
// --disable-renderer-accessibility is set.
data.SetString(kNative,
is_native_enabled ? (native ? kOn : kOff) : kDisabled);
data.SetString(kWeb, is_native_enabled ? (web ? kOn : kOff) : kDisabled);
// The "text", "screenreader" and "html" flags are only
// meaningful if "web" is enabled.
bool is_web_enabled = is_native_enabled && web;
data.SetString(kText, is_web_enabled ? (text ? kOn : kOff) : kDisabled);
data.SetString(kScreenReader,
is_web_enabled ? (screenreader ? kOn : kOff) : kDisabled);
data.SetString(kHTML, is_web_enabled ? (html ? kOn : kOff) : kDisabled);
// TODO(codebytere): enable use of this flag.
//
// The "labelImages" flag works only if "web" is enabled, the current profile
// has the kAccessibilityImageLabelsEnabled preference set and the appropriate
// command line switch has been used. Since this is so closely tied into user
// prefs and causes bugs, we're disabling it for now.
bool are_accessibility_image_labels_enabled = is_web_enabled;
data.SetString(kLabelImages, kDisabled);
// The "pdf" flag is independent of the others.
data.SetString(kPDF, pdf ? kOn : kOff);
// Always dump the Accessibility tree.
data.SetString(kInternal, kOn);
std::unique_ptr<base::ListValue> rvh_list(new base::ListValue());
std::unique_ptr<content::RenderWidgetHostIterator> widgets(
content::RenderWidgetHost::GetRenderWidgetHosts());
while (content::RenderWidgetHost* widget = widgets->GetNextHost()) {
// Ignore processes that don't have a connection, such as crashed tabs.
if (!widget->GetProcess()->IsInitializedAndNotDead())
continue;
content::RenderViewHost* rvh = content::RenderViewHost::From(widget);
if (!rvh)
continue;
content::WebContents* web_contents =
content::WebContents::FromRenderViewHost(rvh);
content::WebContentsDelegate* delegate = web_contents->GetDelegate();
if (!delegate)
continue;
// Ignore views that are never user-visible, like background pages.
if (delegate->IsNeverComposited(web_contents))
continue;
content::BrowserContext* context = rvh->GetProcess()->GetBrowserContext();
if (context != current_context)
continue;
std::unique_ptr<base::DictionaryValue> descriptor =
BuildTargetDescriptor(rvh);
descriptor->SetBoolean(kNative, is_native_enabled);
descriptor->SetBoolean(kWeb, is_web_enabled);
descriptor->SetBoolean(kLabelImages,
are_accessibility_image_labels_enabled);
rvh_list->Append(std::move(descriptor));
}
data.Set(kPagesField, std::move(rvh_list));
std::unique_ptr<base::ListValue> window_list(new base::ListValue());
for (auto* window : electron::WindowList::GetWindows()) {
window_list->Append(BuildTargetDescriptor(window));
}
data.Set(kBrowsersField, std::move(window_list));
std::string json_string;
base::JSONWriter::Write(data, &json_string);
std::move(callback).Run(base::RefCountedString::TakeString(&json_string));
}
} // namespace
ElectronAccessibilityUI::ElectronAccessibilityUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
// Set up the chrome://accessibility source.
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUIAccessibilityHost);
// Add required resources.
html_source->UseStringsJs();
html_source->AddResourcePath("accessibility.css", IDR_ACCESSIBILITY_CSS);
html_source->AddResourcePath("accessibility.js", IDR_ACCESSIBILITY_JS);
html_source->SetDefaultResource(IDR_ACCESSIBILITY_HTML);
html_source->SetRequestFilter(
base::BindRepeating(&ShouldHandleAccessibilityRequestCallback),
base::BindRepeating(&HandleAccessibilityRequestCallback,
web_ui->GetWebContents()->GetBrowserContext()));
content::BrowserContext* browser_context =
web_ui->GetWebContents()->GetBrowserContext();
content::WebUIDataSource::Add(browser_context, html_source);
web_ui->AddMessageHandler(
std::make_unique<ElectronAccessibilityUIMessageHandler>());
}
ElectronAccessibilityUI::~ElectronAccessibilityUI() = default;
ElectronAccessibilityUIMessageHandler::ElectronAccessibilityUIMessageHandler() =
default;
void ElectronAccessibilityUIMessageHandler::RequestNativeUITree(
const base::ListValue* args) {
const base::DictionaryValue* data;
CHECK(args->GetDictionary(0, &data));
int window_id = *data->FindIntPath(kSessionIdField);
const std::string* request_type_p = data->FindStringPath(kRequestTypeField);
CHECK(IsValidJSValue(request_type_p));
std::string request_type = *request_type_p;
CHECK(request_type == kShowOrRefreshTree || request_type == kCopyTree);
request_type = "accessibility." + request_type;
const std::string* allow_p = data->FindStringPath("filters.allow");
CHECK(IsValidJSValue(allow_p));
std::string allow = *allow_p;
const std::string* allow_empty_p = data->FindStringPath("filters.allowEmpty");
CHECK(IsValidJSValue(allow_empty_p));
std::string allow_empty = *allow_empty_p;
const std::string* deny_p = data->FindStringPath("filters.deny");
CHECK(IsValidJSValue(deny_p));
std::string deny = *deny_p;
AllowJavascript();
std::vector<ui::AXPropertyFilter> property_filters;
AddPropertyFilters(&property_filters, allow, ui::AXPropertyFilter::ALLOW);
AddPropertyFilters(&property_filters, allow_empty,
ui::AXPropertyFilter::ALLOW_EMPTY);
AddPropertyFilters(&property_filters, deny, ui::AXPropertyFilter::DENY);
for (auto* window : electron::WindowList::GetWindows()) {
if (window->window_id() == window_id) {
std::unique_ptr<base::DictionaryValue> result(
BuildTargetDescriptor(window));
gfx::NativeWindow native_window = window->GetNativeWindow();
ui::AXPlatformNode* node =
ui::AXPlatformNode::FromNativeWindow(native_window);
result->SetKey(kTreeField,
base::Value(RecursiveDumpAXPlatformNodeAsString(
node, 0, property_filters)));
CallJavascriptFunction(request_type, *(result.get()));
return;
}
}
// No browser with the specified |id| was found.
std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
result->SetInteger(kSessionIdField, window_id);
result->SetString(kTypeField, kBrowser);
result->SetString(kErrorField, "Window no longer exists.");
CallJavascriptFunction(request_type, *(result.get()));
}
void ElectronAccessibilityUIMessageHandler::RegisterMessages() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
web_ui()->RegisterMessageCallback(
"toggleAccessibility",
base::BindRepeating(&AccessibilityUIMessageHandler::ToggleAccessibility,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"setGlobalFlag",
base::BindRepeating(&AccessibilityUIMessageHandler::SetGlobalFlag,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"requestWebContentsTree",
base::BindRepeating(
&AccessibilityUIMessageHandler::RequestWebContentsTree,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"requestNativeUITree",
base::BindRepeating(
&ElectronAccessibilityUIMessageHandler::RequestNativeUITree,
base::Unretained(this)));
web_ui()->RegisterMessageCallback(
"requestAccessibilityEvents",
base::BindRepeating(
&AccessibilityUIMessageHandler::RequestAccessibilityEvents,
base::Unretained(this)));
}