Commit fe8946d3 authored by May Lippert's avatar May Lippert Committed by Commit Bot

Add unoptimized build configs for new OS settings

Build this by setting optimize_webui = false (default is true)

What's in this change:
    - Move os_settings.html to c/b/r/settings/chromeos
    - Add new os_settings_resources.grd

What's still WIP:
    - Optimized webui build

BUG=950007

Change-Id: I752153668877a25a29b315cb82456ed564fd52df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1553820Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: May Lippert <maybelle@chromium.org>
Auto-Submit: May Lippert <maybelle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649259}
parent c3e3793b
...@@ -1582,6 +1582,7 @@ group("extra_resources") { ...@@ -1582,6 +1582,7 @@ group("extra_resources") {
if (is_chromeos) { if (is_chromeos) {
public_deps += [ public_deps += [
"//chrome/browser/resources:os_settings_resources",
"//chrome/browser/resources/chromeos:cellular_setup_resources", "//chrome/browser/resources/chromeos:cellular_setup_resources",
"//chrome/browser/resources/chromeos:multidevice_setup_resources", "//chrome/browser/resources/chromeos:multidevice_setup_resources",
"//chrome/browser/resources/chromeos/chromevox", "//chrome/browser/resources/chromeos/chromevox",
......
...@@ -649,9 +649,6 @@ ...@@ -649,9 +649,6 @@
<include name="IDR_DEVICE_EMULATOR_PAGES_HTML" file="resources\chromeos\emulator\device_emulator_pages.html" type="BINDATA" /> <include name="IDR_DEVICE_EMULATOR_PAGES_HTML" file="resources\chromeos\emulator\device_emulator_pages.html" type="BINDATA" />
<include name="IDR_DEVICE_EMULATOR_PAGES_JS" file="resources\chromeos\emulator\device_emulator_pages.js" type="BINDATA" /> <include name="IDR_DEVICE_EMULATOR_PAGES_JS" file="resources\chromeos\emulator\device_emulator_pages.js" type="BINDATA" />
<include name="IDR_DEVICE_EMULATOR_SHARED_STYLES_HTML" file="resources\chromeos\emulator\shared_styles.html" type="BINDATA" /> <include name="IDR_DEVICE_EMULATOR_SHARED_STYLES_HTML" file="resources\chromeos\emulator\shared_styles.html" type="BINDATA" />
<!-- TODO(jamescook): Create separate files os_settings.grd and
os_settings_vulcanized.grd and move this placeholder. -->
<include name="IDR_OS_SETTINGS_HTML" file="resources\chromeos\os_settings.html" type="BINDATA" compress="gzip" />
</if> </if>
<if expr="chromeos"> <if expr="chromeos">
<include name="IDR_SET_TIME_HTML" file="resources\chromeos\md_set_time\set_time.html" type="BINDATA" compress="gzip" /> <include name="IDR_SET_TIME_HTML" file="resources\chromeos\md_set_time\set_time.html" type="BINDATA" compress="gzip" />
......
...@@ -168,6 +168,37 @@ if (!is_android) { ...@@ -168,6 +168,37 @@ if (!is_android) {
} }
} }
if (is_chromeos) {
grit("os_settings_resources") {
if (optimize_webui) {
source = "settings/os_settings_resources_vulcanized.grd"
# The .grd contains references to generated files.
source_is_generated = true
deps = [
"//chrome/browser/resources/settings/chromeos:build",
]
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
} else {
source = "settings/os_settings_resources.grd"
}
defines = chrome_grit_defines
outputs = [
"grit/os_settings_resources.h",
"grit/os_settings_resources_map.cc",
"grit/os_settings_resources_map.h",
"os_settings_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
}
if (!is_android && !is_chromeos) { if (!is_android && !is_chromeos) {
grit("onboarding_welcome_resources") { grit("onboarding_welcome_resources") {
source = "welcome/onboarding_welcome/onboarding_welcome_resources.grd" source = "welcome/onboarding_welcome/onboarding_welcome_resources.grd"
......
# Copyright 2019 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("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.gni")
import("//ui/webui/webui_features.gni")
import("../../optimize_webui.gni")
if (optimize_webui) {
settings_pak_file = "os_settings_resources.pak"
unpak_folder = "os_settings_resources.unpak"
optimize_webui("build") {
host = "os-settings"
html_in_files = [
"chromeos/os_settings.html",
"chromeos/lazy_load.html",
]
html_out_files = [
"vulcanized.html",
"lazy_load.vulcanized.html",
]
html_out_files_polymer2 = [
"vulcanized.p2.html",
"lazy_load.vulcanized.p2.html",
]
insert_in_head = "<base href=\"chrome://os-settings\">"
input = rebase_path("$target_gen_dir/$unpak_folder", root_build_dir)
js_out_files = [
"crisper.js",
"lazy_load.crisper.js",
]
deps = [
":unpak",
]
}
unpak("unpak") {
pak_file = settings_pak_file
out_folder = unpak_folder
deps = [
":flattened_resources",
]
}
grit("flattened_resources") {
source = "../os_settings_resources.grd"
# The .grd contains references to generated files.
source_is_generated = true
defines = chrome_grit_defines
outputs = [
"grit/os_settings_resources.h",
"grit/os_settings_resources_map.cc",
"grit/os_settings_resources_map.h",
settings_pak_file,
]
output_dir = "$root_gen_dir/chrome/browser/resources/settings/chromeos"
}
}
<html>
<head></head>
<body>
<!-- TODO: Add imports here -->
<!--
TODO(maybelle): Remove dummy script tag once we add in real
elements. This is necessary for the optimized webui build step.
-->
<script>
</script>
</body>
</html>
<!doctype html> <!doctype html>
<html> <html>
<!-- TODO(jamescook): Text direction, language, title, etc. --> <!-- TODO(jamescook): Text direction, language, title, etc. -->
<head>
<meta charset="utf-8">
<title>Hello settings!</title>
</head>
<body> <body>
Hello, settings! Hello, settings!
<!--
TODO(maybelle): Remove dummy script tag once we add in real elements.
This is necessary for the optimized webui build step.
-->
<script>
</script>
</body> </body>
</html> </html>
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/os_settings_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/os_settings_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/os_settings_resources_map.h"
type="resource_map_header" />
<output filename="os_settings_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<structures>
<structure name="IDR_SETTINGS_OS_SETTINGS_HTML"
preprocess="true"
file="chromeos/os_settings.html"
type="chrome_html" />
<structure name="IDR_SETTINGS_OS_LAZY_LOAD_HTML"
preprocess="true"
file="chromeos/lazy_load.html"
type="chrome_html" />
</structures>
</release>
</grit>
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/os_settings_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/os_settings_resources_map.cc"
type="resource_map_source" />
<output filename="grit/os_settings_resources_map.h"
type="resource_map_header" />
<output filename="os_settings_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_OS_MD_SETTINGS_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\vulcanized.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_OS_MD_SETTINGS_VULCANIZED_P2_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\vulcanized.p2.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_OS_MD_SETTINGS_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\crisper.js" use_base_dir="false" flattenhtml="true" type="BINDATA" compress="gzip" />
<include name="IDR_OS_MD_SETTINGS_LAZY_LOAD_VULCANIZED_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\lazy_load.vulcanized.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_OS_MD_SETTINGS_LAZY_LOAD_VULCANIZED_P2_HTML" file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\lazy_load.vulcanized.p2.html" use_base_dir="false" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" />
<include name="IDR_OS_MD_SETTINGS_LAZY_LOAD_CRISPER_JS" file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\lazy_load.crisper.js" use_base_dir="false" flattenhtml="true" type="BINDATA" compress="gzip" />
<include name="IDR_OS_MD_SETTINGS_MANIFEST" file="manifest.json" type="BINDATA" compress="gzip" />
</includes>
</release>
</grit>
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include "chrome/browser/ui/webui/settings/tts_handler.h" #include "chrome/browser/ui/webui/settings/tts_handler.h"
#include "chrome/common/webui_url_constants.h" #include "chrome/common/webui_url_constants.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "chrome/grit/os_settings_resources.h"
#include "chrome/grit/os_settings_resources_map.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/chromeos_switches.h"
#include "chromeos/services/multidevice_setup/public/cpp/prefs.h" #include "chromeos/services/multidevice_setup/public/cpp/prefs.h"
...@@ -47,16 +49,19 @@ namespace settings { ...@@ -47,16 +49,19 @@ namespace settings {
OSSettingsUI::OSSettingsUI(content::WebUI* web_ui) OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) { : content::WebUIController(web_ui) {
#if !BUILDFLAG(OPTIMIZE_WEBUI)
Profile* profile = Profile::FromWebUI(web_ui); Profile* profile = Profile::FromWebUI(web_ui);
content::WebUIDataSource* html_source = content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUIOSSettingsHost); content::WebUIDataSource::Create(chrome::kChromeUIOSSettingsHost);
InitWebUIHandlers(profile, web_ui, html_source); InitWebUIHandlers(profile, web_ui, html_source);
html_source->UseGzip(); html_source->SetDefaultResource(IDR_SETTINGS_OS_SETTINGS_HTML);
html_source->SetDefaultResource(IDR_OS_SETTINGS_HTML);
content::WebUIDataSource::Add(profile, html_source); content::WebUIDataSource::Add(profile, html_source);
#endif //! BUILDFLAG(OPTIMIZE_WEBUI)
// TODO(maybelle): Add optimized build
} }
OSSettingsUI::~OSSettingsUI() = default; OSSettingsUI::~OSSettingsUI() = default;
......
...@@ -152,12 +152,14 @@ template("chrome_extra_paks") { ...@@ -152,12 +152,14 @@ template("chrome_extra_paks") {
"$root_gen_dir/ash/public/cpp/resources/ash_public_unscaled_resources.pak", "$root_gen_dir/ash/public/cpp/resources/ash_public_unscaled_resources.pak",
"$root_gen_dir/chrome/cellular_setup_resources.pak", "$root_gen_dir/chrome/cellular_setup_resources.pak",
"$root_gen_dir/chrome/multidevice_setup_resources.pak", "$root_gen_dir/chrome/multidevice_setup_resources.pak",
"$root_gen_dir/chrome/os_settings_resources.pak",
"$root_gen_dir/chromeos/chromeos_resources.pak", "$root_gen_dir/chromeos/chromeos_resources.pak",
"$root_gen_dir/third_party/ink/ink_resources.pak", "$root_gen_dir/third_party/ink/ink_resources.pak",
"$root_gen_dir/ui/file_manager/file_manager_resources.pak", "$root_gen_dir/ui/file_manager/file_manager_resources.pak",
] ]
deps += [ deps += [
"//ash/public/cpp/resources:ash_public_unscaled_resources", "//ash/public/cpp/resources:ash_public_unscaled_resources",
"//chrome/browser/resources:os_settings_resources",
"//chrome/browser/resources/chromeos:cellular_setup_resources", "//chrome/browser/resources/chromeos:cellular_setup_resources",
"//chrome/browser/resources/chromeos:multidevice_setup_resources", "//chrome/browser/resources/chromeos:multidevice_setup_resources",
"//chromeos/resources", "//chromeos/resources",
......
...@@ -117,53 +117,59 @@ ...@@ -117,53 +117,59 @@
"chrome/browser/resources/quota_internals/quota_internals_resources.grd": { "chrome/browser/resources/quota_internals/quota_internals_resources.grd": {
"includes": [12810], "includes": [12810],
}, },
"chrome/browser/resources/settings/settings_resources_vulcanized.grd": { "chrome/browser/resources/settings/os_settings_resources_vulcanized.grd": {
"includes": [12830], "includes": [12830],
}, },
"chrome/browser/resources/settings/settings_resources.grd": { "chrome/browser/resources/settings/os_settings_resources.grd": {
"structures": [12840], "structures": [12840],
}, },
"chrome/browser/resources/sync_file_system_internals/sync_file_system_internals_resources.grd": { "chrome/browser/resources/settings/settings_resources_vulcanized.grd": {
"includes": [13340], "includes": [13340],
}, },
"chrome/browser/resources/settings/settings_resources.grd": {
"structures": [13350],
},
"chrome/browser/resources/sync_file_system_internals/sync_file_system_internals_resources.grd": {
"includes": [13850],
},
"chrome/browser/resources/translate_internals/translate_internals_resources.grd": { "chrome/browser/resources/translate_internals/translate_internals_resources.grd": {
"includes": [13370], "includes": [13880],
}, },
"chrome/browser/resources/webapks/webapks_ui_resources.grd": { "chrome/browser/resources/webapks/webapks_ui_resources.grd": {
"includes": [13380], "includes": [13890],
}, },
"chrome/browser/resources/welcome/onboarding_welcome/onboarding_welcome_resources.grd": { "chrome/browser/resources/welcome/onboarding_welcome/onboarding_welcome_resources.grd": {
"includes": [13390], "includes": [13900],
"structures": [13440], "structures": [13950],
}, },
"chrome/browser/vr/testapp/vr_testapp_resources.grd": { "chrome/browser/vr/testapp/vr_testapp_resources.grd": {
"includes": [13480], "includes": [13990],
}, },
# END chrome/browser section. # END chrome/browser section.
# START chrome/ miscellaneous section. # START chrome/ miscellaneous section.
"chrome/common/common_resources.grd": { "chrome/common/common_resources.grd": {
"includes": [13650], "includes": [14160],
}, },
"chrome/credential_provider/gaiacp/gaia_resources.grd": { "chrome/credential_provider/gaiacp/gaia_resources.grd": {
"includes": [13670], "includes": [14180],
"messages": [13680], "messages": [14190],
}, },
"chrome/renderer/resources/renderer_resources.grd": { "chrome/renderer/resources/renderer_resources.grd": {
"includes": [13720], "includes": [14230],
"structures": [13830], "structures": [14340],
}, },
"chrome/test/data/webui_test_resources.grd": { "chrome/test/data/webui_test_resources.grd": {
"includes": [13870], "includes": [14380],
}, },
# END chrome/ miscellaneous section. # END chrome/ miscellaneous section.
# START chromeos/ section. # START chromeos/ section.
"chromeos/chromeos_strings.grd": { "chromeos/chromeos_strings.grd": {
"messages": [14000], "messages": [14510],
}, },
"chromeos/resources/chromeos_resources.grd": { "chromeos/resources/chromeos_resources.grd": {
"includes": [14050], "includes": [14560],
}, },
# END chromeos/ section. # END chromeos/ section.
......
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