Commit 87a869af authored by dpapad's avatar dpapad Committed by Commit Bot

Migrate chrome://accessibility to use JS modules.

Also adding some minimal JS type checking.

Bug: None
Change-Id: I17a74b88666b5d8e17ab5ce65f0271392bb0ee00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2444485
Auto-Submit: dpapad <dpapad@chromium.org>
Commit-Queue: dpapad <dpapad@chromium.org>
Reviewed-by: default avatarAbigail Klein <abigailbklein@google.com>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814603}
parent de6bbcbc
...@@ -458,8 +458,7 @@ void AccessibilityUIMessageHandler::ToggleAccessibility( ...@@ -458,8 +458,7 @@ void AccessibilityUIMessageHandler::ToggleAccessibility(
// accessibility mode buttons are updated. // accessibility mode buttons are updated.
AllowJavascript(); AllowJavascript();
std::unique_ptr<base::DictionaryValue> new_mode(BuildTargetDescriptor(rvh)); std::unique_ptr<base::DictionaryValue> new_mode(BuildTargetDescriptor(rvh));
CallJavascriptFunction("accessibility.showOrRefreshTree", CallJavascriptFunction("showOrRefreshTree", *(new_mode.get()));
*(new_mode.get()));
} }
} }
...@@ -534,7 +533,6 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree( ...@@ -534,7 +533,6 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree(
CHECK(IsValidJSValue(request_type_p)); CHECK(IsValidJSValue(request_type_p));
std::string request_type = *request_type_p; std::string request_type = *request_type_p;
CHECK(request_type == kShowOrRefreshTree || request_type == kCopyTree); CHECK(request_type == kShowOrRefreshTree || request_type == kCopyTree);
request_type = "accessibility." + request_type;
const std::string* allow_p = data->FindStringPath("filters.allow"); const std::string* allow_p = data->FindStringPath("filters.allow");
CHECK(IsValidJSValue(allow_p)); CHECK(IsValidJSValue(allow_p));
...@@ -597,7 +595,6 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( ...@@ -597,7 +595,6 @@ void AccessibilityUIMessageHandler::RequestNativeUITree(
CHECK(IsValidJSValue(request_type_p)); CHECK(IsValidJSValue(request_type_p));
std::string request_type = *request_type_p; std::string request_type = *request_type_p;
CHECK(request_type == kShowOrRefreshTree || request_type == kCopyTree); CHECK(request_type == kShowOrRefreshTree || request_type == kCopyTree);
request_type = "accessibility." + request_type;
const std::string* allow_p = data->FindStringPath("filters.allow"); const std::string* allow_p = data->FindStringPath("filters.allow");
CHECK(IsValidJSValue(allow_p)); CHECK(IsValidJSValue(allow_p));
...@@ -696,7 +693,7 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents( ...@@ -696,7 +693,7 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents(
result->SetString(kEventLogsField, event_logs_str); result->SetString(kEventLogsField, event_logs_str);
event_logs_.clear(); event_logs_.clear();
CallJavascriptFunction("accessibility.startOrStopEvents", *(result.get())); CallJavascriptFunction("startOrStopEvents", *(result.get()));
} }
} }
......
...@@ -16,6 +16,7 @@ assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome") ...@@ -16,6 +16,7 @@ assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome")
if (enable_js_type_check) { if (enable_js_type_check) {
group("closure_compile") { group("closure_compile") {
deps = [ deps = [
"accessibility:closure_compile",
"components:closure_compile", "components:closure_compile",
"engagement:closure_compile", "engagement:closure_compile",
"interventions_internals:closure_compile", "interventions_internals:closure_compile",
......
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni")
js_type_check("closure_compile") {
uses_js_modules = true
deps = [ ":accessibility" ]
}
js_library("accessibility") {
deps = [ "//ui/webui/resources/js:util.m" ]
}
...@@ -10,10 +10,7 @@ found in the LICENSE file. ...@@ -10,10 +10,7 @@ found in the LICENSE file.
<title>Accessibility Internals</title> <title>Accessibility Internals</title>
<link rel="stylesheet" href="chrome://resources/css/chrome_shared.css"> <link rel="stylesheet" href="chrome://resources/css/chrome_shared.css">
<link rel="stylesheet" href="accessibility.css"> <link rel="stylesheet" href="accessibility.css">
<script src="chrome://resources/js/cr.js"></script> <script type="module" src="accessibility.js"></script>
<script src="chrome://resources/js/action_link.js"></script>
<script src="chrome://resources/js/util.js"></script>
<script src="accessibility.js"></script>
</head> </head>
<body> <body>
<h1>Accessibility Internals</h1> <h1>Accessibility Internals</h1>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment