Commit ebbc3fde authored by rbpotter's avatar rbpotter Committed by Commit Bot

Settings: Migrate site_data_details_subpage and deps to Polymer 3

Migrating contents of site_settings individually based on elements with
tests, to avoid extremely large CLs.

Bug: 1026426
Change-Id: I6f62a6b36bf049398464ea803cfcd382b8137747
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2103753
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751163}
parent e2054b9b
......@@ -253,6 +253,7 @@ group("closure_compile_module") {
"settings_menu:closure_compile_module",
"settings_page:closure_compile_module",
"settings_ui:closure_compile_module",
"site_settings:closure_compile_module",
]
if (!is_chromeos) {
deps += [
......
......@@ -12,11 +12,11 @@ import './search_engines_page/search_engines_page.m.js';
// TODO(https://crbug.com/1026426): Uncomment these imports once the pages have
// been migrated to Polymer 3.
// import 'privacy_page/cookies_page.m.js';
// import 'privacy_page/security_keys_subpage.m.js';
// import 'privacy_page/security_page.m.js';
// import 'site_settings/all_sites.m.js';
// import 'site_settings/site_data_details_subpage.m.js';
// import './privacy_page/cookies_page.m.js';
// import './privacy_page/security_keys_subpage.m.js';
// import './privacy_page/security_page.m.js';
// import './site_settings/all_sites.m.js';
import './site_settings/site_data_details_subpage.m.js';
// import 'site_settings_page/site_settings_page.m.js';
// import 'site_settings/category_default_setting.m.js';
// import 'site_settings/category_setting_exceptions.m.js';
......@@ -80,6 +80,8 @@ export {ClearBrowsingDataBrowserProxyImpl} from './clear_browsing_data_dialog/cl
export {DownloadsBrowserProxyImpl} from './downloads_page/downloads_browser_proxy.m.js';
export {kMenuCloseDelay} from './languages_page/languages_page.m.js';
export {LanguagesBrowserProxyImpl} from './languages_page/languages_browser_proxy.m.js';
export {cookieInfo} from './site_settings/cookie_info.m.js';
export {LocalDataBrowserProxyImpl} from './site_settings/local_data_browser_proxy.m.js';
// <if expr="not chromeos">
export {SystemPageBrowserProxyImpl} from './system_page/system_page_browser_proxy.m.js';
......
......@@ -31,6 +31,7 @@ settings_namespace_rewrites = [
"settings.IncompatibleApplication|IncompatibleApplication",
"settings.LanguagesBrowserProxy|LanguagesBrowserProxy",
"settings.LifetimeBrowserProxy|LifetimeBrowserProxy",
"settings.LocalDataBrowserProxy|LocalDataBrowserProxy",
"settings.MainPageBehavior|MainPageBehavior",
"settings.MetricsBrowserProxy|MetricsBrowserProxy",
"settings.MinimumRoutes|MinimumRoutes",
......
......@@ -514,6 +514,18 @@
file="${root_gen_dir}/chrome/browser/resources/settings/site_favicon.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_SETTINGS_SITE_SETTINGS_COOKIE_INFO_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/site_settings/cookie_info.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_SETTINGS_SITE_SETTINGS_LOCAL_DATA_BROWSER_PROXY_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/site_settings/local_data_browser_proxy.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_SETTINGS_SITE_SETTINGS_SITE_DATA_DETAILS_SUBPAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/site_settings/site_data_details_subpage.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_SETTINGS_PEOPLE_PAGE_SYNC_BROWSER_PROXY_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/people_page/sync_browser_proxy.m.js"
use_base_dir="false"
......
......@@ -3,6 +3,9 @@
# found in the LICENSE file.
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 = [
......@@ -292,38 +295,41 @@ js_library("zoom_levels") {
}
# TODO(crbug.com/1026426): Fix and enable.
#js_type_check("closure_compile_module") {
# is_polymer3 = true
# deps = [
# ":add_site_dialog.m",
# ":all_sites.m",
# ":all_sites_icons.m",
# ":android_info_browser_proxy.m",
# ":category_default_setting.m",
# ":category_setting_exceptions.m",
# ":chooser_exception_list.m",
# ":chooser_exception_list_entry.m",
# ":constants.m",
# ":cookie_info.m",
# ":edit_exception_dialog.m",
# ":local_data_browser_proxy.m",
# ":media_picker.m",
# ":pdf_documents.m",
# ":protocol_handlers.m",
# ":site_data.m",
# ":site_data_details_subpage.m",
# ":site_data_entry.m",
# ":site_details.m",
# ":site_details_permission.m",
# ":site_entry.m",
# ":site_list.m",
# ":site_list_entry.m",
# ":site_settings_behavior.m",
# ":site_settings_prefs_browser_proxy.m",
# ":website_usage_private_api.m",
# ":zoom_levels.m",
# ]
#}
js_type_check("closure_compile_module") {
is_polymer3 = true
deps = [
# ":add_site_dialog.m",
# ":all_sites.m",
# ":all_sites_icons.m",
# ":android_info_browser_proxy.m",
# ":category_default_setting.m",
# ":category_setting_exceptions.m",
# ":chooser_exception_list.m",
# ":chooser_exception_list_entry.m",
# ":constants.m",
":cookie_info.m",
# ":edit_exception_dialog.m",
":local_data_browser_proxy.m",
# ":media_picker.m",
# ":pdf_documents.m",
# ":protocol_handlers.m",
# ":site_data.m",
":site_data_details_subpage.m",
# ":site_data_entry.m",
# ":site_details.m",
# ":site_details_permission.m",
# ":site_entry.m",
# ":site_list.m",
# ":site_list_entry.m",
# ":site_settings_behavior.m",
# ":site_settings_prefs_browser_proxy.m",
# ":website_usage_private_api.m",
# ":zoom_levels.m",
]
}
js_library("add_site_dialog.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/site_settings/add_site_dialog.m.js" ]
......@@ -399,9 +405,7 @@ js_library("constants.m") {
js_library("cookie_info.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/site_settings/cookie_info.m.js" ]
deps = [
# TODO: Fill those in.
]
deps = [ "//ui/webui/resources/js:load_time_data.m" ]
extra_deps = [ ":modulize" ]
}
......@@ -416,7 +420,8 @@ js_library("edit_exception_dialog.m") {
js_library("local_data_browser_proxy.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/site_settings/local_data_browser_proxy.m.js" ]
deps = [
# TODO: Fill those in.
":cookie_info.m",
"//ui/webui/resources/js:cr.m",
]
extra_deps = [ ":modulize" ]
}
......@@ -456,7 +461,12 @@ js_library("site_data.m") {
js_library("site_data_details_subpage.m") {
sources = [ "$root_gen_dir/chrome/browser/resources/settings/site_settings/site_data_details_subpage.m.js" ]
deps = [
# TODO: Fill those in.
":local_data_browser_proxy.m",
"..:route.m",
"..:router.m",
"//third_party/polymer/v3_0/components-chromium/iron-list:iron-list",
"//ui/webui/resources/js:load_time_data.m",
"//ui/webui/resources/js:web_ui_listener_behavior.m",
]
extra_deps = [ ":site_data_details_subpage_module" ]
}
......@@ -541,8 +551,6 @@ js_library("zoom_levels.m") {
extra_deps = [ ":zoom_levels_module" ]
}
import("//tools/polymer/polymer.gni")
group("polymer3_elements") {
public_deps = [
":add_site_dialog_module",
......@@ -653,6 +661,13 @@ polymer_modulizer("site_data_details_subpage") {
js_file = "site_data_details_subpage.js"
html_file = "site_data_details_subpage.html"
html_type = "dom-module"
auto_imports = settings_auto_imports + [
"chrome/browser/resources/settings/route.html|routes",
"chrome/browser/resources/settings/router.html|Route,Router,RouteObserverBehavior",
"chrome/browser/resources/settings/site_settings/cookie_info.html|CookieDataForDisplay,CookieDetails,getCookieData",
"chrome/browser/resources/settings/site_settings/local_data_browser_proxy.html|CookieList,LocalDataBrowserProxy,LocalDataBrowserProxyImpl",
]
namespace_rewrites = settings_namespace_rewrites
}
polymer_modulizer("site_data_entry") {
......@@ -703,8 +718,6 @@ polymer_modulizer("zoom_levels") {
html_type = "dom-module"
}
import("//ui/webui/resources/tools/js_modulizer.gni")
js_modulizer("modulize") {
input_files = [
"constants.js",
......@@ -714,4 +727,5 @@ js_modulizer("modulize") {
"site_settings_behavior.js",
"site_settings_prefs_browser_proxy.js",
]
namespace_rewrites = settings_namespace_rewrites
}
......@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// clang-format off
// #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
// clang-format on
/**
* @typedef {{hasChildren: boolean,
* id: string,
......@@ -10,13 +14,13 @@
* totalUsage: string,
* type: string}}
*/
let CookieDetails;
/* #export */ let CookieDetails;
/**
* @typedef {{content: string,
* label: string}}
*/
let CookieDataForDisplay;
/* #export */ let CookieDataForDisplay;
// This structure maps the various cookie type names from C++ (hence the
// underscores) to arrays of the different types of data each has, along with
......@@ -25,7 +29,7 @@ let CookieDataForDisplay;
// 1) to list what subset of the cookie data we want to show in the UI.
// 2) What order to show it in.
// 3) What user friendly label to prefix the data with.
const cookieInfo = {
/* #export */ const cookieInfo = {
'cookie': [
['name', 'cookieName'], ['content', 'cookieContent'],
['domain', 'cookieDomain'], ['path', 'cookiePath'],
......@@ -73,7 +77,7 @@ const cookieInfo = {
* @param {CookieDetails} data The contents of the cookie.
* @return {!Array<CookieDataForDisplay>}
*/
const getCookieData = function(data) {
/* #export */ const getCookieData = function(data) {
/** @type {!Array<CookieDataForDisplay>} */
const out = [];
const fields = cookieInfo[data.type];
......
......@@ -7,6 +7,11 @@
* section.
*/
// clang-format off
// #import {addSingletonGetter, sendWithPromise} from 'chrome://resources/js/cr.m.js';
// #import {CookieDetails} from './cookie_info.m.js';
// clang-format on
/**
* @typedef {{
* id: string,
......@@ -14,7 +19,7 @@
* children: !Array<CookieDetails>,
* }}
*/
let CookieList;
/* #export */ let CookieList;
/**
* @typedef {{
......@@ -44,7 +49,7 @@ let EtldPlus1CookieNumber;
cr.define('settings', function() {
/** @interface */
class LocalDataBrowserProxy {
/* #export */ class LocalDataBrowserProxy {
/**
* @param {string} filter Search filter (use "" for none).
* @return {!Promise<!LocalDataList>}
......@@ -110,7 +115,7 @@ cr.define('settings', function() {
/**
* @implements {settings.LocalDataBrowserProxy}
*/
class LocalDataBrowserProxyImpl {
/* #export */ class LocalDataBrowserProxyImpl {
/** @override */
getDisplayList(filter) {
return cr.sendWithPromise('localData.getDisplayList', filter);
......
......@@ -4,6 +4,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../route.html">
<link rel="import" href="../router.html">
<link rel="import" href="../settings_shared_css.html">
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
(function() {
'use strict';
const categoryLabels = {
app_cache: loadTimeData.getString('cookieAppCache'),
......
......@@ -252,7 +252,9 @@ js2gtest("browser_tests_js_webui") {
"$root_gen_dir/chrome/test/data/webui/settings/site_favicon_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/startup_urls_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_about_page_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_local_data_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_metrics_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/site_data_details_subpage_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/sync_test_util.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_extension_control_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/test_languages_browser_proxy.m.js",
......
......@@ -49,6 +49,7 @@ js_modulizer("modulize") {
"settings_textarea_tests.js",
"settings_toggle_button_tests.js",
"settings_ui_tests.js",
"site_data_details_subpage_tests.js",
"site_favicon_test.js",
"startup_urls_page_test.js",
"sync_test_util.js",
......@@ -56,6 +57,7 @@ js_modulizer("modulize") {
"test_extension_control_browser_proxy.js",
"test_languages_browser_proxy.js",
"test_lifetime_browser_proxy.js",
"test_local_data_browser_proxy.js",
"test_metrics_browser_proxy.js",
"test_open_window_proxy.js",
"test_password_manager_proxy.js",
......
......@@ -621,3 +621,15 @@ var CrSettingsPaymentsSectionV3Test = class extends CrSettingsV3BrowserTest {
TEST_F('CrSettingsPaymentsSectionV3Test', 'All', function() {
mocha.run();
});
// eslint-disable-next-line no-var
var CrSettingsSiteDataDetailsV3Test = class extends CrSettingsV3BrowserTest {
/** @override */
get browsePreload() {
return 'chrome://settings/test_loader.html?module=settings/site_data_details_subpage_tests.m.js';
}
};
TEST_F('CrSettingsSiteDataDetailsV3Test', 'All', function() {
mocha.run();
});
......@@ -2,6 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// clang-format off
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {cookieInfo, LocalDataBrowserProxyImpl} from 'chrome://settings/lazy_load.js';
// #import {routes, Router} from 'chrome://settings/settings.js';
// #import {TestLocalDataBrowserProxy} from 'chrome://test/settings/test_local_data_browser_proxy.m.js';
// clang-format on
/** @fileoverview Suite of tests for site-data-details-subpage. */
suite('SiteDataDetailsSubpage', function() {
/** @type {?SiteDataDetailsSubpageElement} */
......
......@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// clang-format off
// #import {TestBrowserProxy} from 'chrome://test/test_browser_proxy.m.js';
// clang-format on
/**
* A test version of LocalDataBrowserProxy. Provides helper methods
* for allowing tests to know when a method was called, as well as
......@@ -9,7 +13,7 @@
*
* @implements {settings.LocalDataBrowserProxy}
*/
class TestLocalDataBrowserProxy extends TestBrowserProxy {
/* #export */ class TestLocalDataBrowserProxy extends TestBrowserProxy {
constructor() {
super([
'getDisplayList',
......
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