Commit 28455e96 authored by Patti's avatar Patti Committed by Commit Bot

Revert "OS Settings: Autogenerate grd files"

This reverts commit 85415a2c.

Reason for revert: Suspected for tree closing compile error described in crbug.com/1143504 - optimize_webui.py failures.

Original change's description:
> OS Settings: Autogenerate grd files
>
> Bug: 1132403
> Change-Id: Ief77c7d304940fa9eec0c553d91674c0806cb790
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2493991
> Reviewed-by: dpapad <dpapad@chromium.org>
> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
> Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#821744}

TBR=khorimoto@chromium.org,dpapad@chromium.org,rbpotter@chromium.org

Change-Id: I6aed7b6ca7003e5baf616520bf901ced8bd527a8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1132403, 1143504
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505699
Commit-Queue: Patti <patricialor@chromium.org>
Reviewed-by: default avatarPatti <patricialor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821997}
parent 3b067da5
...@@ -355,23 +355,26 @@ if (is_chromeos) { ...@@ -355,23 +355,26 @@ if (is_chromeos) {
grit_flags = [ grit_flags = [
"-E", "-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
"-E",
"root_src_dir=" + rebase_path("//", root_build_dir),
] ]
deps = [ "//chrome/browser/ui/webui/settings/chromeos:mojom_js" ]
if (optimize_webui) {
# Required due to flattenhtml="true" on a generated file.
enable_input_discovery_for_gn_analyze = false
source = "settings/os_settings_resources_vulcanized.grd"
defines = chrome_grit_defines deps += [
"//chrome/browser/resources/settings/chromeos:build",
# These arguments are needed since the grd is generated at build time. "//chrome/browser/resources/settings/chromeos:build_polymer3",
enable_input_discovery_for_gn_analyze = false ]
defines += [ "SHARED_INTERMEDIATE_DIR=" + } else {
rebase_path(root_gen_dir, root_build_dir) ] source = "settings/os_settings_resources.grd"
settings_gen_dir = "$root_gen_dir/chrome/browser/resources/settings" deps += [
source = "$settings_gen_dir/chromeos/os_settings_resources.grd" "//chrome/browser/resources/settings/chromeos:polymer3_elements",
deps = [ "//chrome/browser/ui/webui/settings/chromeos/search:mojo_bindings_js",
"//chrome/browser/resources/settings/chromeos:build_grd", ]
"//chrome/browser/ui/webui/settings/chromeos:mojom_js", }
]
defines = chrome_grit_defines
outputs = [ outputs = [
"grit/os_settings_resources.h", "grit/os_settings_resources.h",
"grit/os_settings_resources_map.cc", "grit/os_settings_resources_map.cc",
......
...@@ -413,10 +413,7 @@ def main(argv): ...@@ -413,10 +413,7 @@ def main(argv):
if args.out_manifest: if args.out_manifest:
manifest_data = {} manifest_data = {}
manifest_data['base_dir'] = '%s' % args.out_folder manifest_data['base_dir'] = '%s' % args.out_folder
if (is_polymer3): manifest_data['files'] = manifest.keys()
manifest_data['files'] = manifest.keys()
else:
manifest_data['files'] = args.html_out_files + args.js_out_files
manifest_file = open( manifest_file = open(
os.path.normpath(os.path.join(_CWD, args.out_manifest)), 'wb') os.path.normpath(os.path.join(_CWD, args.out_manifest)), 'wb')
json.dump(manifest_data, manifest_file) json.dump(manifest_data, manifest_file)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<?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_SETTINGS_VULCANIZED_HTML"
file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\vulcanized.html"
use_base_dir="false"
flattenhtml="true"
allowexternalscript="true"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_CRISPER_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\crisper.js"
use_base_dir="false"
flattenhtml="true"
type="BINDATA" />
<include name="IDR_OS_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" />
<include name="IDR_OS_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" />
<!-- Constants -->
<include name="IDR_OS_SETTINGS_ROUTES_MOJOM_LITE_JS"
file="${root_gen_dir}\chrome\browser\ui\webui\settings\chromeos\constants\routes.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_SETTING_MOJOM_LITE_JS"
file="${root_gen_dir}\chrome\browser\ui\webui\settings\chromeos\constants\setting.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
<!-- App Management -->
<include name="IDR_OS_SETTINGS_APP_MANAGEMENT_FILE_PATH_MOJO_LITE_JS"
file="${root_gen_dir}\mojo\public\mojom\base\file_path.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_APP_MANAGEMENT_IMAGE_MOJO_LITE_JS"
file="${root_gen_dir}\ui\gfx\image\mojom\image.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_APP_MANAGEMENT_MOJO_LITE_JS"
file="${root_gen_dir}\chrome\browser\ui\webui\app_management\app_management.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_APP_MANAGEMENT_TYPES_MOJO_LITE_JS"
file="${root_gen_dir}\components\services\app_service\public\mojom\types.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
<!-- Search -->
<include name="IDR_OS_SETTINGS_SEARCH_MOJOM_LITE_JS"
file="${root_gen_dir}\chrome\browser\ui\webui\settings\chromeos\search\search.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_SEARCH_RESULT_ICON_MOJOM_LITE_JS"
file="${root_gen_dir}\chrome\browser\ui\webui\settings\chromeos\search\search_result_icon.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_USER_ACTION_RECORDER_MOJOM_LITE_JS"
file="${root_gen_dir}\chrome\browser\ui\webui\settings\chromeos\search\user_action_recorder.mojom-lite.js"
use_base_dir="false"
type="BINDATA" />
<!-- Polymer3 related files-->
<include name="IDR_OS_SETTINGS_OS_SETTINGS_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\os_settings.rollup.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_OS_SETTINGS_V3_HTML"
file="chromeos/os_settings_v3.html"
type="BINDATA" />
<include name="IDR_OS_SETTINGS_LAZY_LOAD_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\lazy_load.rollup.js"
type="BINDATA"
use_base_dir="false" />
<include name="IDR_OS_SETTINGS_SHARED_ROLLUP_JS"
file="${root_gen_dir}\chrome\browser\resources\settings\chromeos\shared.rollup.js"
type="BINDATA"
use_base_dir="false" />
<!-- SVG assets -->
<include name="IDR_OS_SETTINGS_ICON_ADD_CIRCLE_SVG"
file="chromeos/images/icon_add_circle.svg"
type="BINDATA"
compress="gzip" />
<include name="IDR_OS_SETTINGS_ICON_ADD_WIFI_SVG"
file="chromeos/images/icon_add_wifi.svg"
type="BINDATA"
compress="gzip" />
<include name="IDR_OS_SETTINGS_ICON_ADD_CELLULAR_SVG"
file="chromeos/images/icon_add_cellular.svg"
type="BINDATA"
compress="gzip" />
</includes>
</release>
</grit>
...@@ -181,6 +181,18 @@ void AppsSection::AddLoadTimeData(content::WebUIDataSource* html_source) { ...@@ -181,6 +181,18 @@ void AppsSection::AddLoadTimeData(content::WebUIDataSource* html_source) {
}; };
AddLocalizedStringsBulk(html_source, kLocalizedStrings); AddLocalizedStringsBulk(html_source, kLocalizedStrings);
html_source->AddResourcePath("app-management/app_management.mojom-lite.js",
IDR_OS_SETTINGS_APP_MANAGEMENT_MOJO_LITE_JS);
html_source->AddResourcePath(
"app-management/types.mojom-lite.js",
IDR_OS_SETTINGS_APP_MANAGEMENT_TYPES_MOJO_LITE_JS);
html_source->AddResourcePath(
"app-management/file_path.mojom-lite.js",
IDR_OS_SETTINGS_APP_MANAGEMENT_FILE_PATH_MOJO_LITE_JS);
html_source->AddResourcePath(
"app-management/image.mojom-lite.js",
IDR_OS_SETTINGS_APP_MANAGEMENT_IMAGE_MOJO_LITE_JS);
// We have 2 variants of Android apps settings. Default case, when the Play // We have 2 variants of Android apps settings. Default case, when the Play
// Store app exists we show expandable section that allows as to // Store app exists we show expandable section that allows as to
// enable/disable the Play Store and link to Android settings which is // enable/disable the Play Store and link to Android settings which is
......
...@@ -173,6 +173,20 @@ void MainSection::AddLoadTimeData(content::WebUIDataSource* html_source) { ...@@ -173,6 +173,20 @@ void MainSection::AddLoadTimeData(content::WebUIDataSource* html_source) {
// Add the System Web App resources for Settings. // Add the System Web App resources for Settings.
html_source->AddResourcePath("icon-192.png", IDR_SETTINGS_LOGO_192); html_source->AddResourcePath("icon-192.png", IDR_SETTINGS_LOGO_192);
html_source->AddResourcePath("constants/routes.mojom-lite.js",
IDR_OS_SETTINGS_ROUTES_MOJOM_LITE_JS);
html_source->AddResourcePath("constants/setting.mojom-lite.js",
IDR_OS_SETTINGS_SETTING_MOJOM_LITE_JS);
html_source->AddResourcePath(
"search/user_action_recorder.mojom-lite.js",
IDR_OS_SETTINGS_USER_ACTION_RECORDER_MOJOM_LITE_JS);
html_source->AddResourcePath(
"search/search_result_icon.mojom-lite.js",
IDR_OS_SETTINGS_SEARCH_RESULT_ICON_MOJOM_LITE_JS);
html_source->AddResourcePath("search/search.mojom-lite.js",
IDR_OS_SETTINGS_SEARCH_MOJOM_LITE_JS);
AddSearchInSettingsStrings(html_source); AddSearchInSettingsStrings(html_source);
AddChromeOSUserStrings(html_source); AddChromeOSUserStrings(html_source);
AddUpdateRequiredEolStrings(html_source); AddUpdateRequiredEolStrings(html_source);
......
...@@ -36,6 +36,13 @@ ...@@ -36,6 +36,13 @@
namespace chromeos { namespace chromeos {
namespace settings { namespace settings {
#if !BUILDFLAG(OPTIMIZE_WEBUI)
namespace {
const char kOsGeneratedPath[] =
"@out_folder@/gen/chrome/browser/resources/settings/";
}
#endif
// static // static
void OSSettingsUI::RegisterProfilePrefs( void OSSettingsUI::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { user_prefs::PrefRegistrySyncable* registry) {
...@@ -63,32 +70,54 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui) ...@@ -63,32 +70,54 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
std::make_unique<chromeos::settings::StorageHandler>(profile, std::make_unique<chromeos::settings::StorageHandler>(profile,
html_source)); html_source));
#if BUILDFLAG(OPTIMIZE_WEBUI)
if (base::FeatureList::IsEnabled(::chromeos::features::kOsSettingsPolymer3)) {
// Polymer3 Source files
webui::SetupBundledWebUIDataSource(html_source, "chromeos/os_settings.js",
IDR_OS_SETTINGS_OS_SETTINGS_ROLLUP_JS,
IDR_OS_SETTINGS_OS_SETTINGS_V3_HTML);
html_source->AddResourcePath("chromeos/shared.rollup.js",
IDR_OS_SETTINGS_SHARED_ROLLUP_JS);
html_source->AddResourcePath("chromeos/lazy_load.js",
IDR_OS_SETTINGS_LAZY_LOAD_ROLLUP_JS);
} else {
// Polymer2 Source files
html_source->AddResourcePath("crisper.js", IDR_OS_SETTINGS_CRISPER_JS);
html_source->AddResourcePath("lazy_load.crisper.js",
IDR_OS_SETTINGS_LAZY_LOAD_CRISPER_JS);
html_source->AddResourcePath("chromeos/lazy_load.html",
IDR_OS_SETTINGS_LAZY_LOAD_VULCANIZED_HTML);
html_source->SetDefaultResource(IDR_OS_SETTINGS_VULCANIZED_HTML);
}
// We only need to register the mojo resources here because the rest are // We only need to register the mojo resources here because the rest are
// bundled or included in the grd. // bundled in.
RegisterNearbySharedMojoResources(html_source); RegisterNearbySharedMojoResources(html_source);
int default_resource =
base::FeatureList::IsEnabled(chromeos::features::kOsSettingsPolymer3)
? IDR_OS_SETTINGS_CHROMEOS_OS_SETTINGS_V3_HTML
#if BUILDFLAG(OPTIMIZE_WEBUI)
: IDR_OS_SETTINGS_VULCANIZED_HTML;
#else #else
: IDR_OS_SETTINGS_CHROMEOS_OS_SETTINGS_HTML;
#endif
webui::SetupWebUIDataSource( webui::SetupWebUIDataSource(
html_source, html_source,
base::make_span(kOsSettingsResources, kOsSettingsResourcesSize), base::make_span(kOsSettingsResources, kOsSettingsResourcesSize),
/*generated_path=*/std::string(), default_resource); kOsGeneratedPath,
base::FeatureList::IsEnabled(chromeos::features::kOsSettingsPolymer3)
// For Polymer 2 optimized builds that rely on loading individual subpages, ? IDR_OS_SETTINGS_OS_SETTINGS_V3_HTML
// set the default resource for tests. : IDR_OS_SETTINGS_SETTINGS_HTML);
#if BUILDFLAG(OPTIMIZE_WEBUI)
if (!base::FeatureList::IsEnabled(chromeos::features::kOsSettingsPolymer3)) { // Register chrome://nearby resources so they are available at
html_source->SetDefaultResource(default_resource); // chrome://os-settings. This allows the sharing of resources without having
} // to put everything in chrome://resources. This is necessary because portions
// of the nearby UI need to be re-used in both places.
// This is not nessary when OPTIMIZE_WEBUI is true because the files will be
// added to the optimized bundles.
RegisterNearbySharedResources(html_source);
#endif #endif
html_source->AddResourcePath("images/icon_add_circle.svg",
IDR_OS_SETTINGS_ICON_ADD_CIRCLE_SVG);
html_source->AddResourcePath("images/icon_add_wifi.svg",
IDR_OS_SETTINGS_ICON_ADD_WIFI_SVG);
html_source->AddResourcePath("images/icon_add_cellular.svg",
IDR_OS_SETTINGS_ICON_ADD_CELLULAR_SVG);
ManagedUIHandler::Initialize(web_ui, html_source); ManagedUIHandler::Initialize(web_ui, html_source);
content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(), content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
......
...@@ -1873,7 +1873,7 @@ TEST_F('OSSettingsInputMethodOptionsPageTest', 'AllJsTests', () => { ...@@ -1873,7 +1873,7 @@ TEST_F('OSSettingsInputMethodOptionsPageTest', 'AllJsTests', () => {
var OSSettingsInputPageTest = class extends OSSettingsBrowserTest { var OSSettingsInputPageTest = class extends OSSettingsBrowserTest {
/** @override */ /** @override */
get browsePreload() { get browsePreload() {
return super.browsePreload + 'chromeos/os_languages_page/input_page.html'; return super.browsePreload + 'chromeos/os_language_page/input_page.html';
} }
/** @override */ /** @override */
......
...@@ -168,10 +168,13 @@ ...@@ -168,10 +168,13 @@
"chrome/browser/resources/read_later/read_later_resources.grd": { "chrome/browser/resources/read_later/read_later_resources.grd": {
"includes": [1760], "includes": [1760],
}, },
"<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/settings/chromeos/os_settings_resources.grd": { "chrome/browser/resources/settings/os_settings_resources_vulcanized.grd": {
"META": {"sizes": {"includes": [1000],}},
"includes": [1770], "includes": [1770],
}, },
"chrome/browser/resources/settings/os_settings_resources.grd": {
"includes": [1780],
"structures": [1800],
},
"<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/settings/settings_resources.grd": { "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/settings/settings_resources.grd": {
"META": {"sizes": {"includes": [500],}}, "META": {"sizes": {"includes": [500],}},
"includes": [1830], "includes": [1830],
......
...@@ -66,10 +66,6 @@ GRD_BEGIN_TEMPLATE = '<?xml version="1.0" encoding="UTF-8"?>\n'\ ...@@ -66,10 +66,6 @@ GRD_BEGIN_TEMPLATE = '<?xml version="1.0" encoding="UTF-8"?>\n'\
GRD_INCLUDE_TEMPLATE = ' <include name="{name}" ' \ GRD_INCLUDE_TEMPLATE = ' <include name="{name}" ' \
'file="{file}" resource_path="{path}" ' \ 'file="{file}" resource_path="{path}" ' \
'use_base_dir="false" type="{type}" />\n' 'use_base_dir="false" type="{type}" />\n'
GRD_INCLUDE_TEMPLATE_PP = ' <include name="{name}" ' \
'file="{file}" resource_path="{path}" ' \
'use_base_dir="false" preprocess="true" '\
'type="{type}" />\n'
GRD_END_TEMPLATE = ' </includes>\n'\ GRD_END_TEMPLATE = ' </includes>\n'\
' </release>\n'\ ' </release>\n'\
...@@ -95,16 +91,6 @@ def _generate_include_row(grd_prefix, filename, pathname, \ ...@@ -95,16 +91,6 @@ def _generate_include_row(grd_prefix, filename, pathname, \
if resource_path_prefix != None: if resource_path_prefix != None:
resource_path = resource_path_prefix + '/' + resource_path resource_path = resource_path_prefix + '/' + resource_path
# This is a temporary workaround, since Polymer 2 shared resource files are
# not preprocessed.
# TODO(rbpotter): Remove this once OS Settings has been migrated to Polymer 3.
if ('vulcanized' in pathname or 'crisper' in pathname):
return GRD_INCLUDE_TEMPLATE_PP.format(
file=pathname,
path=resource_path,
name=name,
type=type)
return GRD_INCLUDE_TEMPLATE.format( return GRD_INCLUDE_TEMPLATE.format(
file=pathname, file=pathname,
path=resource_path, path=resource_path,
......
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