Commit 51e3c25a authored by rbpotter's avatar rbpotter Committed by Commit Bot

Settings: check in safety_check_page/ Polymer 3

Bug: 1069258
Change-Id: I0eff16da8a4e9008db1a5cf0893a22ff386350a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2158319
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#761163}
parent 21bdf9c9
......@@ -74,7 +74,6 @@ group("closure_compile") {
"people_page:closure_compile",
"prefs:closure_compile",
"privacy_page:closure_compile",
"safety_check_page:closure_compile",
"search_engines_page:closure_compile",
"settings_page:closure_compile",
"site_settings:closure_compile",
......
......@@ -4,40 +4,24 @@
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/polymer/polymer.gni")
import("//ui/webui/resources/tools/js_modulizer.gni")
import("../settings.gni")
js_type_check("closure_compile") {
deps = [
":safety_check_browser_proxy",
"..:lifetime_browser_proxy",
"..:metrics_browser_proxy",
]
}
js_library("safety_check_browser_proxy") {
deps = [ "//ui/webui/resources/js:cr" ]
}
js_type_check("closure_compile_module") {
is_polymer3 = true
closure_flags = settings_closure_flags
deps = [
":safety_check_browser_proxy.m",
":safety_check_page.m",
":safety_check_browser_proxy",
":safety_check_page",
]
}
js_library("safety_check_browser_proxy.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/safety_check_page/safety_check_browser_proxy.m.js" ]
js_library("safety_check_browser_proxy") {
deps = [ "//ui/webui/resources/js:cr.m" ]
extra_deps = [ ":modulize" ]
}
js_library("safety_check_page.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/safety_check_page/safety_check_page.m.js" ]
js_library("safety_check_page") {
deps = [
":safety_check_browser_proxy.m",
":safety_check_browser_proxy",
"..:hats_browser_proxy.m",
"..:lifetime_browser_proxy.m",
"..:metrics_browser_proxy.m",
......@@ -51,37 +35,14 @@ js_library("safety_check_page.m") {
"//ui/webui/resources/js:i18n_behavior.m",
"//ui/webui/resources/js:web_ui_listener_behavior.m",
]
extra_deps = [ ":safety_check_page_module" ]
}
group("polymer3_elements") {
public_deps = [
":modulize",
":safety_check_page_module",
]
public_deps = [ ":safety_check_page_module" ]
}
polymer_modulizer("safety_check_page") {
js_file = "safety_check_page.js"
html_file = "safety_check_page.html"
html_type = "dom-module"
auto_imports = settings_auto_imports + [
"chrome/browser/resources/settings/route.html|routes",
"chrome/browser/resources/settings/router.html|Router",
"chrome/browser/resources/settings/autofill_page/password_manager_proxy.html|PasswordManagerImpl,PasswordManagerProxy",
"chrome/browser/resources/settings/lifetime_browser_proxy.html|LifetimeBrowserProxy,LifetimeBrowserProxyImpl",
"chrome/browser/resources/settings/hats_browser_proxy.html|HatsBrowserProxyImpl",
"chrome/browser/resources/settings/metrics_browser_proxy.html|SafetyCheckInteractions,MetricsBrowserProxy,MetricsBrowserProxyImpl",
"chrome/browser/resources/settings/open_window_proxy.html|OpenWindowProxyImpl",
"chrome/browser/resources/settings/safety_check_page/safety_check_browser_proxy.html|SafetyCheckBrowserProxy,SafetyCheckBrowserProxyImpl,SafetyCheckExtensionsStatus,SafetyCheckParentStatus,SafetyCheckPasswordsStatus,SafetyCheckUpdatesStatus,SafetyCheckSafeBrowsingStatus,SafetyCheckCallbackConstants",
"ui/webui/resources/html/assert.html|assertNotReached",
"ui/webui/resources/html/polymer.html|Polymer,html,flush",
]
migrated_imports = settings_migrated_imports
namespace_rewrites = settings_namespace_rewrites
}
js_modulizer("modulize") {
input_files = [ "safety_check_browser_proxy.js" ]
namespace_rewrites = settings_namespace_rewrites
html_type = "v3-ready"
}
<link rel="import" href="chrome://resources/html/cr.html">
<script src="safety_check_browser_proxy.js"></script>
......@@ -3,14 +3,13 @@
// found in the LICENSE file.
// clang-format off
// #import {addSingletonGetter,sendWithPromise} from 'chrome://resources/js/cr.m.js';
import {addSingletonGetter,sendWithPromise} from 'chrome://resources/js/cr.m.js';
// clang-format on
/**
* @fileoverview A helper object used by the "SafetyCheck" to interact with
* the browser.
*/
cr.define('settings', function() {
/**
* Constants used in safety check C++ to JS communication.
* Their values need be kept in sync with their counterparts in
......@@ -18,7 +17,7 @@ cr.define('settings', function() {
* chrome/browser/ui/webui/settings/safety_check_handler.cc
* @enum {string}
*/
/* #export */ const SafetyCheckCallbackConstants = {
export const SafetyCheckCallbackConstants = {
PARENT_CHANGED: 'safety-check-parent-status-changed',
UPDATES_CHANGED: 'safety-check-updates-status-changed',
PASSWORDS_CHANGED: 'safety-check-passwords-status-changed',
......@@ -32,7 +31,7 @@ cr.define('settings', function() {
* chrome/browser/ui/webui/settings/safety_check_handler.h
* @enum {number}
*/
/* #export */
export
const SafetyCheckParentStatus = {
BEFORE: 0,
CHECKING: 1,
......@@ -45,7 +44,7 @@ cr.define('settings', function() {
* chrome/browser/ui/webui/settings/safety_check_handler.h
* @enum {number}
*/
/* #export */ const SafetyCheckUpdatesStatus = {
export const SafetyCheckUpdatesStatus = {
CHECKING: 0,
UPDATED: 1,
UPDATING: 2,
......@@ -62,7 +61,7 @@ cr.define('settings', function() {
* chrome/browser/ui/webui/settings/safety_check_handler.h
* @enum {number}
*/
/* #export */ const SafetyCheckPasswordsStatus = {
export const SafetyCheckPasswordsStatus = {
CHECKING: 0,
SAFE: 1,
COMPROMISED: 2,
......@@ -79,7 +78,7 @@ cr.define('settings', function() {
* chrome/browser/ui/webui/settings/safety_check_handler.h
* @enum {number}
*/
/* #export */ const SafetyCheckSafeBrowsingStatus = {
export const SafetyCheckSafeBrowsingStatus = {
CHECKING: 0,
// Enabled is deprecated; kept not to break old UMA metrics (enums.xml).
ENABLED: 1,
......@@ -96,7 +95,7 @@ cr.define('settings', function() {
* chrome/browser/ui/webui/settings/safety_check_handler.h
* @enum {number}
*/
/* #export */ const SafetyCheckExtensionsStatus = {
export const SafetyCheckExtensionsStatus = {
CHECKING: 0,
ERROR: 1,
NO_BLOCKLISTED_EXTENSIONS: 2,
......@@ -107,7 +106,7 @@ cr.define('settings', function() {
};
/** @interface */
/* #export */ class SafetyCheckBrowserProxy {
export class SafetyCheckBrowserProxy {
/** Run the safety check. */
runSafetyCheck() {}
......@@ -119,8 +118,8 @@ cr.define('settings', function() {
getParentRanDisplayString() {}
}
/** @implements {settings.SafetyCheckBrowserProxy} */
/* #export */ class SafetyCheckBrowserProxyImpl {
/** @implements {SafetyCheckBrowserProxy} */
export class SafetyCheckBrowserProxyImpl {
/** @override */
runSafetyCheck() {
chrome.send('performSafetyCheck');
......@@ -128,21 +127,9 @@ cr.define('settings', function() {
/** @override */
getParentRanDisplayString() {
return cr.sendWithPromise('getSafetyCheckRanDisplayString');
return sendWithPromise('getSafetyCheckRanDisplayString');
}
}
cr.addSingletonGetter(SafetyCheckBrowserProxyImpl);
addSingletonGetter(SafetyCheckBrowserProxyImpl);
// #cr_define_end
return {
SafetyCheckCallbackConstants,
SafetyCheckParentStatus,
SafetyCheckUpdatesStatus,
SafetyCheckPasswordsStatus,
SafetyCheckSafeBrowsingStatus,
SafetyCheckExtensionsStatus,
SafetyCheckBrowserProxy,
SafetyCheckBrowserProxyImpl,
};
});
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-announcer/iron-a11y-announcer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="../autofill_page/password_manager_proxy.html">
<link rel="import" href="../hats_browser_proxy.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../lifetime_browser_proxy.html">
<link rel="import" href="../metrics_browser_proxy.html">
<link rel="import" href="../open_window_proxy.html">
<link rel="import" href="../prefs/prefs_behavior.html">
<link rel="import" href="../route.html">
<link rel="import" href="../router.html">
<link rel="import" href="../settings_shared_css.html">
<link rel="import" href="safety_check_browser_proxy.html">
<dom-module id="settings-safety-check-page">
<template>
<style include="settings-shared">
#safetyCheckCollapse .list-item.selected {
min-height: var(--settings-row-two-line-min-height);
......@@ -200,6 +174,3 @@
</template>
</div>
</iron-collapse>
</template>
<script src="safety_check_page.js"></script>
</dom-module>
......@@ -150,6 +150,7 @@ settings_migrated_imports = [
"chrome/browser/resources/settings/autofill_page/password_manager_proxy.html",
"chrome/browser/resources/settings/on_startup_page/on_startup_page.html",
"chrome/browser/resources/settings/reset_page/reset_profile_banner.html",
"chrome/browser/resources/settings/safety_check_page/safety_check_page.html",
"chrome/browser/resources/settings/search_page/search_page.html",
"chrome/browser/resources/settings/settings_main/settings_main.html",
"chrome/browser/resources/settings/settings_menu/settings_menu.html",
......
......@@ -35,6 +35,6 @@ export {PrivacyPageBrowserProxyImpl, SecureDnsMode, SecureDnsUiManagementMode} f
export {ResetBrowserProxyImpl} from './reset_page/reset_browser_proxy.js';
export {buildRouter, routes} from './route.m.js';
export {Route, Router} from './router.m.js';
export {SafetyCheckBrowserProxy, SafetyCheckBrowserProxyImpl, SafetyCheckCallbackConstants, SafetyCheckExtensionsStatus, SafetyCheckParentStatus, SafetyCheckPasswordsStatus, SafetyCheckSafeBrowsingStatus, SafetyCheckUpdatesStatus} from './safety_check_page/safety_check_browser_proxy.m.js';
export {SafetyCheckBrowserProxy, SafetyCheckBrowserProxyImpl, SafetyCheckCallbackConstants, SafetyCheckExtensionsStatus, SafetyCheckParentStatus, SafetyCheckPasswordsStatus, SafetyCheckSafeBrowsingStatus, SafetyCheckUpdatesStatus} from './safety_check_page/safety_check_browser_proxy.js';
export {SearchEnginesBrowserProxyImpl} from './search_engines_page/search_engines_browser_proxy.m.js';
export {getSearchManager, SearchRequest, setSearchManagerForTesting} from './search_settings.m.js';
......@@ -551,12 +551,11 @@
file="${root_gen_dir}/chrome/browser/resources/settings/router.m.js"
use_base_dir="false"
compress="false" type="BINDATA" />
<include name="IDR_SETTINGS_SAFETY_CHECK_PAGE_SAFETY_CHECK_BROWSER_PROXY_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/safety_check_page/safety_check_browser_proxy.m.js"
use_base_dir="false"
<include name="IDR_SETTINGS_SAFETY_CHECK_PAGE_SAFETY_CHECK_BROWSER_PROXY_JS"
file="safety_check_page/safety_check_browser_proxy.js"
compress="false" type="BINDATA" />
<include name="IDR_SETTINGS_SAFETY_CHECK_PAGE_SAFETY_CHECK_PAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/safety_check_page/safety_check_page.m.js"
<include name="IDR_SETTINGS_SAFETY_CHECK_PAGE_SAFETY_CHECK_PAGE_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/safety_check_page/safety_check_page.js"
use_base_dir="false"
compress="false" type="BINDATA" />
<include name="IDR_SETTINGS_SEARCH_ENGINES_BROWSER_PROXY_M_JS"
......
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