Commit 1c78868a authored by Nnamdi Theodore Johnson-Kanu's avatar Nnamdi Theodore Johnson-Kanu Committed by Commit Bot

[CrOS settings] Create dummy chromeos/os_settings_v3.html page

 - Add top-level JS/HTML files that will host the V3 version.
 - Use a JS import for the generated chromeos/search_handler.m.js
   as a proof of concept.
 - Update BUILD.gn files as needed.
 - Currently only works when optimize_webui = false

Bug: 1045266
Change-Id: I421f9090833731748d18ac2d19013faef3199648
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2171981Reviewed-by: default avatardpapad <dpapad@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Nnamdi Theodore Johnson-kanu <tjohnsonkanu@google.com>
Cr-Commit-Position: refs/heads/master@{#766520}
parent 5e31454a
......@@ -5,6 +5,7 @@
import("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//ui/webui/resources/tools/js_modulizer.gni")
import("//ui/webui/webui_features.gni")
import("../../optimize_webui.gni")
......@@ -68,6 +69,7 @@ if (optimize_webui) {
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps += [ ":polymer3_elements" ]
defines = chrome_grit_defines
outputs = [
"grit/os_settings_resources.h",
......@@ -357,8 +359,6 @@ polymer_modulizer("os_settings_icons_css") {
html_type = "style-module"
}
import("//ui/webui/resources/tools/js_modulizer.gni")
js_modulizer("modulize") {
input_files = [
"os_settings_routes.js",
......
// 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 {getSearchHandler} from './search_handler.m.js';
console.log('getSearchHandler', getSearchHandler);
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<!--TODO(crbug.com/1045266): Add Polymer 3 files here-->
<include name="IDR_OS_SETTINGS_SEARCH_HANDLER_M_JS"
file="${root_gen_dir}/chrome/browser/resources/settings/chromeos/search_handler.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_SETTINGS_V3_HTML"
file="chromeos/os_settings_v3.html"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_SETTINGS_V3_JS"
file="chromeos/os_settings.js"
type="BINDATA" />
</grit-part>
\ No newline at end of file
<!doctype html>
<html dir="$i18n{textdirection}" lang="$i18n{language}" class="loading"
$i18n{a11yenhanced} cros>
<head>
<meta charset="utf-8">
<title>$i18n{settings}</title>
<base href="chrome://os-settings">
<link rel="stylesheet" href="chrome://resources/css/cros_colors.generated.css">
<style>
html {
background-color: var(--cros-default-bg-color);
overflow: hidden;
/* Remove 300ms delay for 'click' event, when using touch interface. */
touch-action: manipulation;
}
html.loading::before {
background-color: var(--md-toolbar-color);
border-bottom: var(--md-toolbar-border);
box-sizing: border-box;
content: '';
display: block;
height: var(--md-toolbar-height);
}
</style>
</head>
<body>
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<script type="module" src="chromeos/os_settings.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -23,7 +23,7 @@ cr.define('settings', function() {
/**
* @return {!chromeos.settings.mojom.SearchHandlerInterface} Search handler.
*/
function getSearchHandler() {
/* #export */ function getSearchHandler() {
if (settingsSearchHandler) {
return settingsSearchHandler;
}
......
......@@ -87,6 +87,13 @@
namespace chromeos {
namespace settings {
#if !BUILDFLAG(OPTIMIZE_WEBUI)
namespace {
const char kOsGeneratedPath[] =
"@out_folder@/gen/chrome/browser/resources/settings/";
}
#endif
// static
void OSSettingsUI::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
......@@ -142,12 +149,10 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
IDR_OS_SETTINGS_LAZY_LOAD_VULCANIZED_HTML);
html_source->SetDefaultResource(IDR_OS_SETTINGS_VULCANIZED_HTML);
#else
// Add all settings resources.
for (size_t i = 0; i < kOsSettingsResourcesSize; ++i) {
html_source->AddResourcePath(kOsSettingsResources[i].name,
kOsSettingsResources[i].value);
}
html_source->SetDefaultResource(IDR_OS_SETTINGS_SETTINGS_HTML);
webui::SetupWebUIDataSource(
html_source,
base::make_span(kOsSettingsResources, kOsSettingsResourcesSize),
kOsGeneratedPath, IDR_OS_SETTINGS_SETTINGS_V3_HTML);
#endif
html_source->AddResourcePath("constants/routes.mojom-lite.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