Commit 67317286 authored by Friedrich [CET]'s avatar Friedrich [CET] Committed by Commit Bot

Revert "Nearby Share: Consolidate and autogenerate grd files"

This reverts commit 5c7c88d7.

Reason for revert: Most-likely suspect for CrOS compile failure:
https://ci.chromium.org/p/chromium/builders/ci/linux-chromeos-rel/42591

Log:
[5898/61571] ACTION //ui/file_manager/file_manager/test:create_test_main(//build/toolchain/linux:clang_x64)
 FAILED: gen/ui/file_manager/file_manager/test.html 
 /b/s/w/ir/cipd_bin_packages/cpython/bin/python ../../ui/file_manager/file_manager/test/scripts/create_test_main.py --output=gen/ui/file_manager/file_manager/test.html
 Traceback (most recent call last):
   File "../../ui/file_manager/file_manager/test/scripts/create_test_main.py", line 144, in <module>
     write(GEN + R_GEN + colors, open(GEN + '../../' + colors).read())
 IOError: [Errno 2] No such file or directory: '/b/s/w/ir/cache/builder/src/out/Release/gen/ui/file_manager/file_manager/../../chromeos/colors/cros_colors.generated.css'

Original change's description:
> Nearby Share: Consolidate and autogenerate grd files
>
> Bug: 1132403
> Change-Id: I809b1a97e43457b92ac67fde208b200bfbf37d58
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2507400
> Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: dpapad <dpapad@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#824322}

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

Change-Id: I275146470b9fc70dbff9203ee8f951eda7e624d8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1132403
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2517734Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Commit-Queue: Friedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824345}
parent b0b6da09
...@@ -1368,10 +1368,12 @@ group("extra_resources") { ...@@ -1368,10 +1368,12 @@ group("extra_resources") {
"//chrome/browser/resources:bluetooth_pairing_dialog_resources", "//chrome/browser/resources:bluetooth_pairing_dialog_resources",
"//chrome/browser/resources:multidevice_internals_resources", "//chrome/browser/resources:multidevice_internals_resources",
"//chrome/browser/resources:nearby_internals_resources", "//chrome/browser/resources:nearby_internals_resources",
"//chrome/browser/resources:nearby_share_dialog_resources",
"//chrome/browser/resources:nearby_shared_resources",
"//chrome/browser/resources:nearby_shared_resources_v3",
"//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/accessibility:build", "//chrome/browser/resources/chromeos/accessibility:build",
"//chrome/browser/resources/nearby_share:nearby_share_dialog_resources",
"//chrome/browser/resources/settings/chromeos:os_settings_resources", "//chrome/browser/resources/settings/chromeos:os_settings_resources",
"//third_party/ink:ink_resources", "//third_party/ink:ink_resources",
] ]
......
...@@ -243,6 +243,73 @@ if (is_chromeos) { ...@@ -243,6 +243,73 @@ if (is_chromeos) {
output_dir = "$root_gen_dir/chrome" output_dir = "$root_gen_dir/chrome"
} }
grit("nearby_share_dialog_resources") {
source = "nearby_share/nearby_share_dialog_resources.grd"
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [
"//chrome/browser/resources/nearby_share:web_components",
"//chrome/browser/resources/nearby_share/shared:polymer3_elements",
"//chrome/browser/ui/webui/nearby_share:mojom_js",
]
defines = chrome_grit_defines
outputs = [
"grit/nearby_share_dialog_resources.h",
"grit/nearby_share_dialog_resources_map.cc",
"grit/nearby_share_dialog_resources_map.h",
"nearby_share_dialog_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
grit("nearby_shared_resources") {
source = "nearby_share/shared/nearby_shared_resources.grd"
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [ "//chrome/browser/ui/webui/nearby_share:mojom_js" ]
defines = chrome_grit_defines
outputs = [
"grit/nearby_shared_resources.h",
"grit/nearby_shared_resources_map.cc",
"grit/nearby_shared_resources_map.h",
"nearby_shared_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
grit("nearby_shared_resources_v3") {
source = "nearby_share/shared/nearby_shared_resources_v3.grd"
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [
"//chrome/browser/resources/nearby_share/shared:polymer3_elements",
"//chrome/browser/ui/webui/nearby_share:mojom_js",
]
defines = chrome_grit_defines
outputs = [
"grit/nearby_shared_resources_v3.h",
"grit/nearby_shared_resources_v3_map.cc",
"grit/nearby_shared_resources_v3_map.h",
"nearby_shared_resources_v3.pak",
]
output_dir = "$root_gen_dir/chrome"
}
grit("bluetooth_pairing_dialog_resources") { grit("bluetooth_pairing_dialog_resources") {
grit_flags = [ grit_flags = [
"-E", "-E",
......
...@@ -2,99 +2,16 @@ ...@@ -2,99 +2,16 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//chrome/common/features.gni")
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
import("//tools/grit/grit_rule.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("//ui/webui/resources/tools/generate_grd.gni")
assert(is_chromeos, "Nearby Share is CrOS only") assert(is_chromeos, "Nearby Share is CrOS only")
preprocess_src_manifest = "preprocessed_src_manifest.json"
preprocess_gen_manifest = "preprocessed_gen_manifest.json"
preprocess_mojo_manifest = "preprocessed_mojo_manifest.json" preprocess_mojo_manifest = "preprocessed_mojo_manifest.json"
preprocess_folder = "preprocessed" preprocess_folder = "preprocessed"
grit("nearby_share_dialog_resources") {
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
"-E",
"root_src_dir=" + rebase_path("//", root_build_dir),
]
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) ]
source = "$target_gen_dir/nearby_share_dialog_resources.grd"
deps = [ ":build_grd" ]
outputs = [
"grit/nearby_share_dialog_resources.h",
"grit/nearby_share_dialog_resources_map.cc",
"grit/nearby_share_dialog_resources_map.h",
"nearby_share_dialog_resources.pak",
]
output_dir = "$root_gen_dir/chrome"
}
generate_grd("build_grd") {
grd_prefix = "nearby_share_dialog"
out_grd = "$target_gen_dir/${grd_prefix}_resources.grd"
deps = [
":build_mojo_grdp",
":preprocess_gen",
":preprocess_src",
"shared:build_v2_grdp",
"shared:build_v3_grdp",
]
grdp_files = [
"$target_gen_dir/nearby_share_mojo_resources.grdp",
"$target_gen_dir/shared/nearby_share_resources_v2.grdp",
"$target_gen_dir/shared/nearby_share_resources_v3.grdp",
]
input_files = [ "nearby_share_pulse_animation.json" ]
input_files_base_dir = rebase_path("shared", "//")
manifest_files = [
"$target_gen_dir/$preprocess_src_manifest",
"$target_gen_dir/$preprocess_gen_manifest",
]
resource_path_rewrites = [
"chrome/browser/ui/webui/nearby_share/nearby_share.mojom-lite.js|mojo/nearby_share.mojom-lite.js",
"chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom-lite.js|mojo/nearby_share_settings.mojom-lite.js",
"chromeos/services/nearby/public/mojom/nearby_share_target_types.mojom-lite.js|mojo/nearby_share_settings.mojom-lite.js",
]
}
preprocess_grit("preprocess_src") {
in_folder = "./"
out_folder = "$target_gen_dir/$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_src_manifest"
in_files = [
"nearby_share_dialog.html",
"discovery_manager.js",
]
}
preprocess_grit("preprocess_gen") {
deps = [ ":web_components" ]
in_folder = "$target_gen_dir"
out_folder = "$target_gen_dir/$preprocess_folder"
out_manifest = "$target_gen_dir/$preprocess_gen_manifest"
in_files = [
"app.js",
"icons.js",
"nearby_confirmation_page.js",
"nearby_device.js",
"nearby_device_icon.js",
"nearby_discovery_page.js",
"nearby_preview.js",
"nearby_progress.js",
]
}
generate_grd("build_mojo_grdp") { generate_grd("build_mojo_grdp") {
grd_prefix = "nearby_share" grd_prefix = "nearby_share"
out_grd = "$target_gen_dir/${grd_prefix}_mojo_resources.grdp" out_grd = "$target_gen_dir/${grd_prefix}_mojo_resources.grdp"
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js';
import './mojo/nearby_share_target_types.mojom-lite.js'; import './nearby_share_target_types.mojom-lite.js';
import './mojo/nearby_share.mojom-lite.js'; import './nearby_share.mojom-lite.js';
/** @type {?nearbyShare.mojom.DiscoveryManagerInterface} */ /** @type {?nearbyShare.mojom.DiscoveryManagerInterface} */
let discoveryManager = null; let discoveryManager = null;
......
...@@ -14,8 +14,8 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; ...@@ -14,8 +14,8 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js';
import './nearby_preview.js'; import './nearby_preview.js';
import './nearby_progress.js'; import './nearby_progress.js';
import './mojo/nearby_share_target_types.mojom-lite.js'; import './nearby_share_target_types.mojom-lite.js';
import './mojo/nearby_share.mojom-lite.js'; import './nearby_share.mojom-lite.js';
import './shared/nearby_page_template.m.js'; import './shared/nearby_page_template.m.js';
import './strings.m.js'; import './strings.m.js';
......
...@@ -11,8 +11,8 @@ import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-l ...@@ -11,8 +11,8 @@ import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-l
import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
import './icons.js'; import './icons.js';
import './nearby_device_icon.js'; import './nearby_device_icon.js';
import './mojo/nearby_share_target_types.mojom-lite.js'; import './nearby_share_target_types.mojom-lite.js';
import './mojo/nearby_share.mojom-lite.js'; import './nearby_share.mojom-lite.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
......
...@@ -12,8 +12,8 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; ...@@ -12,8 +12,8 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js';
import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
import './icons.js'; import './icons.js';
import './mojo/nearby_share_target_types.mojom-lite.js'; import './nearby_share_target_types.mojom-lite.js';
import './mojo/nearby_share.mojom-lite.js'; import './nearby_share.mojom-lite.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
......
...@@ -14,8 +14,8 @@ import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-l ...@@ -14,8 +14,8 @@ import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-l
import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import 'chrome://resources/polymer/v3_0/iron-list/iron-list.js';
import './nearby_device.js'; import './nearby_device.js';
import './nearby_preview.js'; import './nearby_preview.js';
import './mojo/nearby_share_target_types.mojom-lite.js'; import './nearby_share_target_types.mojom-lite.js';
import './mojo/nearby_share.mojom-lite.js'; import './nearby_share.mojom-lite.js';
import './shared/nearby_page_template.m.js'; import './shared/nearby_page_template.m.js';
import './strings.m.js'; import './strings.m.js';
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js';
import './nearby_device_icon.js'; import './nearby_device_icon.js';
import './mojo/nearby_share_target_types.mojom-lite.js'; import './nearby_share_target_types.mojom-lite.js';
import './mojo/nearby_share.mojom-lite.js'; import './nearby_share.mojom-lite.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
......
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/nearby_share_dialog_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/nearby_share_dialog_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/nearby_share_dialog_resources_map.h"
type="resource_map_header" />
<output filename="nearby_share_dialog_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_NEARBY_SHARE_NEARBY_SHARE_DIALOG_HTML"
file="nearby_share_dialog.html"
type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_MOJO_JS"
file="${root_gen_dir}/chrome/browser/ui/webui/nearby_share/nearby_share.mojom-lite.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_TARGET_TYPES_MOJO_JS"
file="${root_gen_dir}/chromeos/services/nearby/public/mojom/nearby_share_target_types.mojom-lite.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_SETTINGS_MOJOM_LITE_JS"
file="${root_gen_dir}/chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom-lite.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_DISCOVERY_MANAGER_JS"
file="discovery_manager.js"
type="BINDATA"/>
<!-- Generated Polymer 3 elements -->
<include name="IDR_NEARBY_SHARE_APP_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/app.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_ICONS_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/icons.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_NEARBY_CONFIRMATION_PAGE_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_confirmation_page.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_NEARBY_DEVICE_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_device.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_NEARBY_DEVICE_ICON_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_device_icon.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_NEARBY_DISCOVERY_PAGE_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_discovery_page.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_NEARBY_PREVIEW_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_preview.js"
use_base_dir="false" type="BINDATA"/>
<include name="IDR_NEARBY_SHARE_NEARBY_PROGRESS_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/nearby_progress.js"
use_base_dir="false" type="BINDATA"/>
</includes>
</release>
</grit>
...@@ -46,7 +46,6 @@ preprocess_grit("preprocess_v2") { ...@@ -46,7 +46,6 @@ preprocess_grit("preprocess_v2") {
"nearby_share_settings.js", "nearby_share_settings.js",
"nearby_share_settings_behavior.html", "nearby_share_settings_behavior.html",
"nearby_share_settings_behavior.js", "nearby_share_settings_behavior.js",
"nearby_shared_share_type_icons.html",
"nearby_shared_icons.html", "nearby_shared_icons.html",
"nearby_visibility_page.html", "nearby_visibility_page.html",
"nearby_visibility_page.js", "nearby_visibility_page.js",
...@@ -66,7 +65,6 @@ preprocess_grit("preprocess_v3") { ...@@ -66,7 +65,6 @@ preprocess_grit("preprocess_v3") {
"nearby_share_settings.m.js", "nearby_share_settings.m.js",
"nearby_share_settings_behavior.m.js", "nearby_share_settings_behavior.m.js",
"nearby_shared_icons.m.js", "nearby_shared_icons.m.js",
"nearby_shared_share_type_icons.m.js",
"nearby_visibility_page.m.js", "nearby_visibility_page.m.js",
] ]
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/nearby_shared_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/nearby_shared_resources_map.cc"
type="resource_file_map_source" />
<output filename="grit/nearby_shared_resources_map.h"
type="resource_map_header" />
<output filename="nearby_shared_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_NEARBY_SHARE_PULSE_ANIMATION_JSON"
file="nearby_share_pulse_animation.json" type="BINDATA" compress="false"/>
<!-- Shared Polymer 2 pages-->
<include name="IDR_NEARBY_CONTACT_MANAGER_HTML"
file="nearby_contact_manager.html" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_CONTACT_MANAGER_JS"
file="nearby_contact_manager.js" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_CONTACT_VISIBILITY_HTML"
file="nearby_contact_visibility.html" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_CONTACT_VISIBILITY_JS"
file="nearby_contact_visibility.js" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_ONBOARDING_PAGE_HTML"
file="nearby_onboarding_page.html" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_ONBOARDING_PAGE_JS"
file="nearby_onboarding_page.js" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_PAGE_TEMPLATE_HTML"
file="nearby_page_template.html" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_PAGE_TEMPLATE_JS"
file="nearby_page_template.js" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARE_SETTINGS_HTML"
file="nearby_share_settings.html" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARE_SETTINGS_JS"
file="nearby_share_settings.js" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARE_SETTINGS_BEHAVIOR_HTML"
file="nearby_share_settings_behavior.html" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARE_SETTINGS_BEHAVIOR_JS"
file="nearby_share_settings_behavior.js" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARED_ICONS_HTML"
file="nearby_shared_icons.html" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARED_SHARE_TYPE_ICONS_HTML"
file="nearby_shared_share_type_icons.html" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_VISIBILITY_PAGE_HTML"
file="nearby_visibility_page.html" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_VISIBILITY_PAGE_JS"
file="nearby_visibility_page.js" type="BINDATA" compress="false"/>
</includes>
</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/nearby_shared_resources_v3.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="grit/nearby_shared_resources_v3_map.cc"
type="resource_file_map_source" />
<output filename="grit/nearby_shared_resources_v3_map.h"
type="resource_map_header" />
<output filename="nearby_shared_resources_v3.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<!-- Generated Polymer 2 to 3 elements -->
<include name="IDR_NEARBY_CONTACT_MANAGER_M_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/shared/nearby_contact_manager.m.js"
use_base_dir="false" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_CONTACT_VISIBILITY_M_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/shared/nearby_contact_visibility.m.js"
use_base_dir="false" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_ONBOARDING_PAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/shared/nearby_onboarding_page.m.js"
use_base_dir="false" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_PAGE_TEMPLATE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/shared/nearby_page_template.m.js"
use_base_dir="false" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARE_SETTINGS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/shared/nearby_share_settings.m.js"
use_base_dir="false" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARE_SETTINGS_BEHAVIOR_M_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/shared/nearby_share_settings_behavior.m.js"
use_base_dir="false" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARED_ICONS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/shared/nearby_shared_icons.m.js"
use_base_dir="false" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_SHARED_SHARE_TYPE_ICONS_M_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/shared/nearby_shared_share_type_icons.m.js"
use_base_dir="false" type="BINDATA" compress="false"/>
<include name="IDR_NEARBY_VISIBILITY_PAGE_M_JS"
file="${root_gen_dir}/chrome/browser/resources/nearby_share/shared/nearby_visibility_page.m.js"
use_base_dir="false" type="BINDATA" compress="false"/>
</includes>
</release>
</grit>
...@@ -43,17 +43,15 @@ NearbyShareDialogUI::NearbyShareDialogUI(content::WebUI* web_ui) ...@@ -43,17 +43,15 @@ NearbyShareDialogUI::NearbyShareDialogUI(content::WebUI* web_ui)
webui::SetupWebUIDataSource(html_source, webui::SetupWebUIDataSource(html_source,
base::make_span(kNearbyShareDialogResources, base::make_span(kNearbyShareDialogResources,
kNearbyShareDialogResourcesSize), kNearbyShareDialogResourcesSize),
/*generated_path=*/std::string(), kNearbyShareGeneratedPath,
IDR_NEARBY_SHARE_DIALOG_NEARBY_SHARE_DIALOG_HTML); IDR_NEARBY_SHARE_NEARBY_SHARE_DIALOG_HTML);
// To use lottie, the worker-src CSP needs to be updated for the web ui that html_source->AddResourcePath("nearby_share.mojom-lite.js",
// is using it. Since as of now there are only a couple of webuis using IDR_NEARBY_SHARE_MOJO_JS);
// lottie animations, this update has to be performed manually. As the usage html_source->AddResourcePath("nearby_share_target_types.mojom-lite.js",
// increases, set this as the default so manual override is no longer IDR_NEARBY_SHARE_TARGET_TYPES_MOJO_JS);
// required.
html_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::WorkerSrc, "worker-src blob: 'self';");
RegisterNearbySharedResources(html_source);
RegisterNearbySharedStrings(html_source); RegisterNearbySharedStrings(html_source);
html_source->UseStringsJs(); html_source->UseStringsJs();
......
...@@ -10,8 +10,72 @@ ...@@ -10,8 +10,72 @@
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/ui/webui/webui_util.h" #include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/grit/nearby_share_dialog_resources.h"
#include "chrome/grit/nearby_share_dialog_resources_map.h"
#include "chrome/grit/nearby_shared_resources.h"
#include "chrome/grit/nearby_shared_resources_map.h"
#include "chrome/grit/nearby_shared_resources_v3.h"
#include "chrome/grit/nearby_shared_resources_v3_map.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/webui/web_ui_util.h" #include "ui/base/webui/web_ui_util.h"
const char kNearbyShareGeneratedPath[] =
"@out_folder@/gen/chrome/browser/resources/nearby_share/";
namespace {
void RegisterResourcesWithPrefix(
content::WebUIDataSource* data_source,
const base::span<const GritResourceMap>& resources,
std::string prefix) {
std::string generate_path{kNearbyShareGeneratedPath};
for (const GritResourceMap& resource : resources) {
std::string path = resource.name;
if (path.rfind(generate_path, 0) == 0) {
path = path.substr(generate_path.size());
} else {
path = prefix + path;
}
data_source->AddResourcePath(path, resource.value);
}
}
} // namespace
void RegisterNearbySharedMojoResources(content::WebUIDataSource* data_source) {
data_source->AddResourcePath("mojo/nearby_share.mojom-lite.js",
IDR_NEARBY_SHARE_MOJO_JS);
data_source->AddResourcePath("mojo/nearby_share_target_types.mojom-lite.js",
IDR_NEARBY_SHARE_TARGET_TYPES_MOJO_JS);
data_source->AddResourcePath("mojo/nearby_share_settings.mojom-lite.js",
IDR_NEARBY_SHARE_SETTINGS_MOJOM_LITE_JS);
}
void RegisterNearbySharedResources(content::WebUIDataSource* data_source) {
RegisterResourcesWithPrefix(
data_source,
/*resources=*/
base::make_span(kNearbySharedResources, kNearbySharedResourcesSize),
/*prefix=*/"shared/");
RegisterResourcesWithPrefix(
data_source,
/*resources=*/
base::make_span(kNearbySharedResourcesV3, kNearbySharedResourcesV3Size),
/*prefix=*/"shared/");
RegisterNearbySharedMojoResources(data_source);
data_source->AddResourcePath("nearby_share_pulse_animation.json",
IDR_NEARBY_SHARE_PULSE_ANIMATION_JSON);
// To use lottie, the worker-src CSP needs to be updated for the web ui that
// is using it. Since as of now there are only a couple of webuis using
// lottie animations, this update has to be performed manually. As the usage
// increases, set this as the default so manual override is no longer
// required.
data_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::WorkerSrc, "worker-src blob: 'self';");
}
void RegisterNearbySharedStrings(content::WebUIDataSource* data_source) { void RegisterNearbySharedStrings(content::WebUIDataSource* data_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = { static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"nearbyShareAccountRowLabel", IDS_NEARBY_ACCOUNT_ROW_LABEL}, {"nearbyShareAccountRowLabel", IDS_NEARBY_ACCOUNT_ROW_LABEL},
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
extern const char kNearbyShareGeneratedPath[];
void RegisterNearbySharedMojoResources(content::WebUIDataSource* data_source);
void RegisterNearbySharedResources(content::WebUIDataSource* data_source);
void RegisterNearbySharedStrings(content::WebUIDataSource* data_source); void RegisterNearbySharedStrings(content::WebUIDataSource* data_source);
#endif // CHROME_BROWSER_UI_WEBUI_NEARBY_SHARE_SHARED_RESOURCES_H_ #endif // CHROME_BROWSER_UI_WEBUI_NEARBY_SHARE_SHARED_RESOURCES_H_
...@@ -175,6 +175,8 @@ template("chrome_extra_paks") { ...@@ -175,6 +175,8 @@ template("chrome_extra_paks") {
"$root_gen_dir/chrome/multidevice_setup_resources.pak", "$root_gen_dir/chrome/multidevice_setup_resources.pak",
"$root_gen_dir/chrome/nearby_internals_resources.pak", "$root_gen_dir/chrome/nearby_internals_resources.pak",
"$root_gen_dir/chrome/nearby_share_dialog_resources.pak", "$root_gen_dir/chrome/nearby_share_dialog_resources.pak",
"$root_gen_dir/chrome/nearby_shared_resources.pak",
"$root_gen_dir/chrome/nearby_shared_resources_v3.pak",
"$root_gen_dir/chrome/os_settings_resources.pak", "$root_gen_dir/chrome/os_settings_resources.pak",
"$root_gen_dir/chromeos/chromeos_camera_app_resources.pak", "$root_gen_dir/chromeos/chromeos_camera_app_resources.pak",
"$root_gen_dir/chromeos/chromeos_diagnostics_app_resources.pak", "$root_gen_dir/chromeos/chromeos_diagnostics_app_resources.pak",
...@@ -194,9 +196,11 @@ template("chrome_extra_paks") { ...@@ -194,9 +196,11 @@ template("chrome_extra_paks") {
"//chrome/browser/resources:bluetooth_pairing_dialog_resources", "//chrome/browser/resources:bluetooth_pairing_dialog_resources",
"//chrome/browser/resources:multidevice_internals_resources", "//chrome/browser/resources:multidevice_internals_resources",
"//chrome/browser/resources:nearby_internals_resources", "//chrome/browser/resources:nearby_internals_resources",
"//chrome/browser/resources:nearby_share_dialog_resources",
"//chrome/browser/resources:nearby_shared_resources",
"//chrome/browser/resources:nearby_shared_resources_v3",
"//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/nearby_share:nearby_share_dialog_resources",
"//chrome/browser/resources/settings/chromeos:os_settings_resources", "//chrome/browser/resources/settings/chromeos:os_settings_resources",
"//chrome/browser/supervised_user:supervised_user_unscaled_resources", "//chrome/browser/supervised_user:supervised_user_unscaled_resources",
"//chromeos/resources", "//chromeos/resources",
......
...@@ -7,7 +7,7 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; ...@@ -7,7 +7,7 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js';
import 'chrome://nearby/nearby_device_icon.js'; import 'chrome://nearby/nearby_device_icon.js';
import 'chrome://nearby/mojo/nearby_share.mojom-lite.js'; import 'chrome://nearby/nearby_share.mojom-lite.js';
import {assertEquals} from '../chai_assert.js'; import {assertEquals} from '../chai_assert.js';
......
...@@ -7,7 +7,7 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; ...@@ -7,7 +7,7 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js';
import 'chrome://nearby/nearby_device.js'; import 'chrome://nearby/nearby_device.js';
import 'chrome://nearby/mojo/nearby_share.mojom-lite.js'; import 'chrome://nearby/nearby_share.mojom-lite.js';
import {assertEquals} from '../chai_assert.js'; import {assertEquals} from '../chai_assert.js';
......
...@@ -7,7 +7,7 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js'; ...@@ -7,7 +7,7 @@ import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js'; import 'chrome://resources/mojo/mojo/public/mojom/base/unguessable_token.mojom-lite.js';
import 'chrome://nearby/nearby_progress.js'; import 'chrome://nearby/nearby_progress.js';
import 'chrome://nearby/mojo/nearby_share.mojom-lite.js'; import 'chrome://nearby/nearby_share.mojom-lite.js';
import {assertEquals} from '../chai_assert.js'; import {assertEquals} from '../chai_assert.js';
......
...@@ -146,10 +146,15 @@ ...@@ -146,10 +146,15 @@
"chrome/browser/resources/nearby_internals/nearby_internals_resources.grd": { "chrome/browser/resources/nearby_internals/nearby_internals_resources.grd": {
"includes": [1630], "includes": [1630],
}, },
"<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/nearby_share/nearby_share_dialog_resources.grd": { "chrome/browser/resources/nearby_share/nearby_share_dialog_resources.grd": {
"META": {"sizes": {"includes": [100]}},
"includes": [1640], "includes": [1640],
}, },
"chrome/browser/resources/nearby_share/shared/nearby_shared_resources.grd": {
"includes": [1645],
},
"chrome/browser/resources/nearby_share/shared/nearby_shared_resources_v3.grd": {
"includes": [1650],
},
"chrome/browser/resources/new_tab_page/new_tab_page_resources_vulcanized.grd": { "chrome/browser/resources/new_tab_page/new_tab_page_resources_vulcanized.grd": {
"includes": [1660], "includes": [1660],
}, },
......
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