Commit 93c6f107 authored by rbpotter's avatar rbpotter Committed by Commit Bot

Profile Picker: Autogenerate grd files

Bug: 1132403
Change-Id: I7c86e8e57dd780e04fb2fb8d67dd33940cbe9ca8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2486681Reviewed-by: default avatardpapad <dpapad@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818944}
parent 072b81e1
...@@ -533,17 +533,20 @@ if (!is_android && !is_chromeos) { ...@@ -533,17 +533,20 @@ if (!is_android && !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),
] ]
if (optimize_webui) {
source = "signin/profile_picker/profile_picker_resources_vulcanized.grd"
deps = [ "//chrome/browser/resources/signin/profile_picker:build" ]
} else {
source = "signin/profile_picker/profile_picker_resources.grd"
deps =
[ "//chrome/browser/resources/signin/profile_picker:web_components" ]
}
defines = chrome_grit_defines defines = chrome_grit_defines
# These arguments are needed since the grd is generated at build time.
enable_input_discovery_for_gn_analyze = false
defines += [ "SHARED_INTERMEDIATE_DIR=" +
rebase_path(root_gen_dir, root_build_dir) ]
signin_gen_dir = "$root_gen_dir/chrome/browser/resources/signin"
source = "$signin_gen_dir/profile_picker/profile_picker_resources.grd"
deps = [ "//chrome/browser/resources/signin/profile_picker:build_grd" ]
outputs = [ outputs = [
"grit/profile_picker_resources.h", "grit/profile_picker_resources.h",
"grit/profile_picker_resources_map.cc", "grit/profile_picker_resources_map.cc",
......
...@@ -6,10 +6,16 @@ import("//chrome/common/features.gni") ...@@ -6,10 +6,16 @@ import("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/preprocess_grit.gni") import("//tools/grit/preprocess_grit.gni")
import("//tools/polymer/html_to_js.gni") import("//tools/polymer/html_to_js.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
import("../../optimize_webui.gni") import("../../optimize_webui.gni")
preprocess_folder = "preprocessed"
preprocess_manifest = "preprocessed_manifest.json"
preprocess_gen_manifest = "preprocessed_gen_manifest.json"
preprocess_shared_manifest = "preprocessed_shared_manifest.json"
if (optimize_webui) { if (optimize_webui) {
preprocess_folder = "preprocessed" build_manifest = "build_manifest.json"
optimize_webui("build") { optimize_webui("build") {
host = "profile-picker" host = "profile-picker"
...@@ -18,6 +24,7 @@ if (optimize_webui) { ...@@ -18,6 +24,7 @@ if (optimize_webui) {
"lazy_load.js", "lazy_load.js",
] ]
input = rebase_path("$target_gen_dir/$preprocess_folder", root_build_dir) input = rebase_path("$target_gen_dir/$preprocess_folder", root_build_dir)
out_manifest = "$target_gen_dir/$build_manifest"
js_out_files = [ js_out_files = [
"profile_picker.rollup.js", "profile_picker.rollup.js",
"lazy_load.rollup.js", "lazy_load.rollup.js",
...@@ -36,42 +43,80 @@ if (optimize_webui) { ...@@ -36,42 +43,80 @@ if (optimize_webui) {
"chrome://resources/mojo/skia/public/mojom/skcolor.mojom-lite.js", "chrome://resources/mojo/skia/public/mojom/skcolor.mojom-lite.js",
] ]
} }
}
preprocess_grit("preprocess") { generate_grd("build_grd") {
in_folder = "./" grd_prefix = "profile_picker"
out_folder = "$target_gen_dir/$preprocess_folder" out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
in_files = [ input_files = [
"profile_picker.js", "profile_picker.html",
"navigation_behavior.js", "images/left_banner_image.svg",
"policy_helper.js", "images/right_banner_image.svg",
"icons.js", "images/dark_mode_left_banner_image.svg",
"lazy_load.js", "images/dark_mode_right_banner_image.svg",
"ensure_lazy_loaded.js", "profile_creation_flow/images/banner_dark_image.svg",
"manage_profiles_browser_proxy.js", "profile_creation_flow/images/banner_light_image.svg",
]
input_files_base_dir = rebase_path(".", "//")
if (optimize_webui) {
deps = [ ":build" ]
manifest_files = [ "$target_gen_dir/$build_manifest" ]
resource_path_rewrites = [
"profile_picker.rollup.js|profile_picker.js",
"lazy_load.rollup.js|lazy_load.js",
]
} else {
deps = [
":preprocess",
":preprocess_generated",
":shared",
]
manifest_files = [
"$target_gen_dir/$preprocess_manifest",
"$target_gen_dir/$preprocess_gen_manifest",
"$target_gen_dir/$preprocess_shared_manifest",
] ]
} }
}
preprocess_grit("shared") { preprocess_grit("preprocess") {
in_folder = "../" in_folder = "./"
out_folder = "$target_gen_dir/$preprocess_folder" out_folder = "$target_gen_dir/$preprocess_folder"
in_files = [ "signin_icons.js" ] out_manifest = "$target_gen_dir/$preprocess_manifest"
} in_files = [
"profile_picker.js",
"navigation_behavior.js",
"policy_helper.js",
"icons.js",
"lazy_load.js",
"ensure_lazy_loaded.js",
"manage_profiles_browser_proxy.js",
]
}
preprocess_grit("preprocess_generated") { preprocess_grit("shared") {
deps = [ ":web_components" ] in_folder = "../"
in_folder = target_gen_dir out_folder = "$target_gen_dir/$preprocess_folder"
out_folder = "$target_gen_dir/$preprocess_folder" out_manifest = "$target_gen_dir/$preprocess_shared_manifest"
in_files = [ in_files = [ "signin_icons.js" ]
"profile_picker_app.js", }
"profile_picker_main_view.js",
"profile_card.js", preprocess_grit("preprocess_generated") {
"profile_card_menu.js", deps = [ ":web_components" ]
"profile_creation_flow/profile_type_choice.js", in_folder = target_gen_dir
"profile_creation_flow/local_profile_customization.js", out_folder = "$target_gen_dir/$preprocess_folder"
"profile_picker_shared_css.js", out_manifest = "$target_gen_dir/$preprocess_gen_manifest"
"profile_creation_flow/shared_css.js", in_files = [
] "profile_picker_app.js",
} "profile_picker_main_view.js",
"profile_card.js",
"profile_card_menu.js",
"profile_creation_flow/profile_type_choice.js",
"profile_creation_flow/local_profile_customization.js",
"profile_picker_shared_css.js",
"profile_creation_flow/shared_css.js",
]
} }
group("closure_compile") { group("closure_compile") {
......
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/profile_picker_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/profile_picker_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/profile_picker_resources_map.h"
type="resource_map_header" />
<output filename="profile_picker_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_PROFILE_PICKER_IMAGES_LEFT_BANNER_IMAGE"
file="images/left_banner_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_IMAGES_RIGHT_BANNER_IMAGE"
file="images/right_banner_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_IMAGES_DARK_MODE_LEFT_BANNER_IMAGE"
file="images/dark_mode_left_banner_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_IMAGES_DARK_MODE_RIGHT_BANNER_IMAGE"
file="images/dark_mode_right_banner_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_PROFILE_CREATION_FLOW_IMAGES_BANNER_LIGHT_IMAGE"
file="profile_creation_flow/images/banner_light_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_PROFILE_CREATION_FLOW_IMAGES_BANNER_DARK_IMAGE"
file="profile_creation_flow/images/banner_dark_image.svg"
type="BINDATA" />
<!-- Generated Polymer 3 elements -->
<include name="IDR_PROFILE_PICKER_PROFILE_PICKER_MAIN_VIEW_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/profile_picker_main_view.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_PROFILE_PICKER_PROFILE_PICKER_APP_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/profile_picker_app.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_PROFILE_PICKER_PROFILE_CARD_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/profile_card.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_PROFILE_PICKER_PROFILE_CARD_MENU_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/profile_card_menu.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_PROFILE_PICKER_PROFILE_CREATION_FLOW_PROFILE_TYPE_CHOICE_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/profile_creation_flow/profile_type_choice.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_PROFILE_PICKER_PROFILE_CREATION_FLOW_LOCAL_PROFILE_CUSTOMIZATION_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/profile_creation_flow/local_profile_customization.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_PROFILE_PICKER_PROFILE_PICKER_SHARED_CSS_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/profile_picker_shared_css.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_PROFILE_PICKER_PROFILE_CREATION_FLOW_SHARED_CSS_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/profile_creation_flow/shared_css.js"
use_base_dir="false" type="BINDATA"/>
</includes>
<structures>
<structure
name="IDR_PROFILE_PICKER_PROFILE_PICKER_HTML"
file="profile_picker.html"
type="chrome_html"
compress="false"/>
<structure
name="IDR_PROFILE_PICKER_PROFILE_PICKER_JS"
file="profile_picker.js"
type="chrome_html"
compress="false"/>
<structure
name="IDR_PROFILE_PICKER_NAVIGATION_BEHAVIOR_JS"
file="navigation_behavior.js"
type="chrome_html"
compress="false"/>
<structure
name="IDR_PROFILE_PICKER_POLICY_HELPER_JS"
file="policy_helper.js"
type="chrome_html"
compress="false"/>
<structure
name="IDR_PROFILE_PICKER_ICONS_JS"
file="icons.js"
type="chrome_html"
compress="false"/>
<structure
name="IDR_PROFILE_PICKER_LAZY_LOAD_JS"
file="lazy_load.js"
type="chrome_html"
compress="false"/>
<structure
name="IDR_PROFILE_PICKER_ENSURE_LAZY_LOADED_JS"
file="ensure_lazy_loaded.js"
type="chrome_html"
compress="false"/>
<structure
name="IDR_PROFILE_PICKER_MANAGE_PROFILES_BROWSER_PROXY_JS"
file="manage_profiles_browser_proxy.js"
type="chrome_html"
compress="false"/>
</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/profile_picker_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/profile_picker_resources_map.cc"
type="resource_map_source" />
<output filename="grit/profile_picker_resources_map.h"
type="resource_map_header" />
<output filename="profile_picker_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_PROFILE_PICKER_PROFILE_PICKER_HTML"
file="profile_picker.html"
type="chrome_html" />
<include name="IDR_PROFILE_PICKER_PROFILE_PICKER_ROLLUP_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/profile_picker.rollup.js"
use_base_dir="false"
type="chrome_html" />
<include name="IDR_PROFILE_PICKER_LAZY_LOAD_ROLLUP_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/lazy_load.rollup.js"
type="BINDATA"
use_base_dir="false" />
<include name="IDR_PROFILE_PICKER_SHARED_ROLLUP_JS"
file="${root_gen_dir}/chrome/browser/resources/signin/profile_picker/shared.rollup.js"
type="BINDATA"
use_base_dir="false" />
<include name="IDR_PROFILE_PICKER_IMAGES_LEFT_BANNER_IMAGE"
file="images/left_banner_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_IMAGES_RIGHT_BANNER_IMAGE"
file="images/right_banner_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_IMAGES_DARK_MODE_LEFT_BANNER_IMAGE"
file="images/dark_mode_left_banner_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_IMAGES_DARK_MODE_RIGHT_BANNER_IMAGE"
file="images/dark_mode_right_banner_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_PROFILE_CREATION_FLOW_IMAGES_BANNER_LIGHT_IMAGE"
file="profile_creation_flow/images/banner_light_image.svg"
type="BINDATA" />
<include name="IDR_PROFILE_PICKER_PROFILE_CREATION_FLOW_IMAGES_BANNER_DARK_IMAGE"
file="profile_creation_flow/images/banner_dark_image.svg"
type="BINDATA" />
</includes>
</release>
</grit>
...@@ -160,42 +160,11 @@ ProfilePickerUI::ProfilePickerUI(content::WebUI* web_ui) ...@@ -160,42 +160,11 @@ ProfilePickerUI::ProfilePickerUI(content::WebUI* web_ui)
raw_handler->EnableStartupMetrics(); raw_handler->EnableStartupMetrics();
} }
std::string generated_path =
"@out_folder@/gen/chrome/browser/resources/signin/profile_picker/";
AddStrings(html_source); AddStrings(html_source);
#if BUILDFLAG(OPTIMIZE_WEBUI)
webui::SetupBundledWebUIDataSource(
html_source, "profile_picker.js",
IDR_PROFILE_PICKER_PROFILE_PICKER_ROLLUP_JS,
IDR_PROFILE_PICKER_PROFILE_PICKER_HTML);
html_source->AddResourcePath("lazy_load.js",
IDR_PROFILE_PICKER_LAZY_LOAD_ROLLUP_JS);
html_source->AddResourcePath("shared.rollup.js",
IDR_PROFILE_PICKER_SHARED_ROLLUP_JS);
html_source->AddResourcePath("images/left_banner_image.svg",
IDR_PROFILE_PICKER_IMAGES_LEFT_BANNER_IMAGE);
html_source->AddResourcePath("images/right_banner_image.svg",
IDR_PROFILE_PICKER_IMAGES_RIGHT_BANNER_IMAGE);
html_source->AddResourcePath(
"images/dark_mode_left_banner_image.svg",
IDR_PROFILE_PICKER_IMAGES_DARK_MODE_LEFT_BANNER_IMAGE);
html_source->AddResourcePath(
"images/dark_mode_right_banner_image.svg",
IDR_PROFILE_PICKER_IMAGES_DARK_MODE_RIGHT_BANNER_IMAGE);
html_source->AddResourcePath(
"profile_creation_flow/images/banner_light_image.svg",
IDR_PROFILE_PICKER_PROFILE_CREATION_FLOW_IMAGES_BANNER_LIGHT_IMAGE);
html_source->AddResourcePath(
"profile_creation_flow/images/banner_dark_image.svg",
IDR_PROFILE_PICKER_PROFILE_CREATION_FLOW_IMAGES_BANNER_DARK_IMAGE);
#else
html_source->AddResourcePath("signin_icons.js", IDR_SIGNIN_ICONS_JS);
webui::SetupWebUIDataSource( webui::SetupWebUIDataSource(
html_source, html_source,
base::make_span(kProfilePickerResources, kProfilePickerResourcesSize), base::make_span(kProfilePickerResources, kProfilePickerResourcesSize), "",
generated_path, IDR_PROFILE_PICKER_PROFILE_PICKER_HTML); IDR_PROFILE_PICKER_PROFILE_PICKER_HTML);
#endif
content::WebUIDataSource::Add(profile, html_source); content::WebUIDataSource::Add(profile, html_source);
} }
......
...@@ -175,13 +175,10 @@ ...@@ -175,13 +175,10 @@
"META": {"sizes": {"includes": [500],}}, "META": {"sizes": {"includes": [500],}},
"includes": [1830], "includes": [1830],
}, },
"chrome/browser/resources/signin/profile_picker/profile_picker_resources_vulcanized.grd": { "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/signin/profile_picker/profile_picker_resources.grd": {
"META": {"sizes": {"includes": [50],}},
"includes": [1850], "includes": [1850],
}, },
"chrome/browser/resources/signin/profile_picker/profile_picker_resources.grd": {
"includes": [1860],
"structures": [1870],
},
"chrome/browser/resources/tab_search/tab_search_resources.grd": { "chrome/browser/resources/tab_search/tab_search_resources.grd": {
"includes": [1880], "includes": [1880],
}, },
......
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