Commit 2efe4277 authored by Yuzhu Shen's avatar Yuzhu Shen Committed by Commit Bot

Move the mojo JS bindings resource into a separate grd file in mojo/pubilc/js.

So that the resource could be used from both WebUI and extensions.

BUG=699569, 718047

Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation;master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: If2ce60b15e0351aba801746cd863e5a2b9e85485
Reviewed-on: https://chromium-review.googlesource.com/762393
Commit-Queue: Yuzhu Shen <yzshen@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515792}
parent 8a6e6350
......@@ -35,7 +35,10 @@ template("ash_test_resources") {
]
if (percent == "100") {
sources += [ "$root_gen_dir/ui/resources/webui_resources.pak" ]
sources += [
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
]
}
if (defined(invoker.sources)) {
......@@ -44,6 +47,7 @@ template("ash_test_resources") {
deps = [
"//ash/resources",
"//mojo/public/js:resources",
"//ui/app_list/resources",
"//ui/chromeos/resources",
"//ui/resources",
......
......@@ -101,6 +101,7 @@ template("chrome_extra_paks") {
"$root_gen_dir/components/components_resources.pak",
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
]
......@@ -116,6 +117,7 @@ template("chrome_extra_paks") {
"//components/resources",
"//content:resources",
"//content/browser/tracing:resources",
"//mojo/public/js:resources",
"//net:net_resources",
"//third_party/WebKit/public:resources",
"//ui/resources",
......
......@@ -468,6 +468,7 @@ repack("cast_shell_pak") {
"$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
"$root_gen_dir/content/app/strings/content_strings_en-US.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
......@@ -483,6 +484,7 @@ repack("cast_shell_pak") {
"//content:resources",
"//content/app/resources",
"//content/app/strings",
"//mojo/public/js:resources",
"//net:net_resources",
"//third_party/WebKit/public:resources",
"//third_party/WebKit/public:scaled_resources_100_percent",
......
......@@ -105,6 +105,7 @@ source_set("browser") {
"//mojo/edk/system",
"//mojo/public/cpp/bindings",
"//mojo/public/js",
"//mojo/public/js:resources",
"//net",
"//net:extras",
"//net:http_server",
......
......@@ -15,6 +15,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
#include "mojo/public/js/grit/mojo_bindings_resources.h"
#include "ui/base/layout.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/resources/grit/webui_resources.h"
......@@ -45,7 +46,7 @@ const struct {
const char* const path;
const int resource_id;
} kAdditionalResourceMapEntries[] = {
{"js/mojo_bindings.js", IDR_WEBUI_MOJO_BINDINGS_JS},
{"js/mojo_bindings.js", IDR_MOJO_BINDINGS_JS},
};
void AddResource(const std::string& path,
......
......@@ -461,6 +461,7 @@ repack("pak") {
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/content/shell/shell_resources.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
......@@ -474,6 +475,7 @@ repack("pak") {
"//content/app/resources",
"//content/app/strings",
"//content/browser/tracing:resources",
"//mojo/public/js:resources",
"//net:net_resources",
"//third_party/WebKit/public:resources",
"//third_party/WebKit/public:scaled_resources_100_percent",
......
......@@ -167,6 +167,7 @@ repack("shell_and_test_pak") {
"$root_gen_dir/extensions/extensions_resources.pak",
"$root_gen_dir/extensions/shell/app_shell_resources.pak",
"$root_gen_dir/extensions/strings/extensions_strings_en-US.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
"$root_gen_dir/ui/strings/ui_strings_en-US.pak",
......@@ -182,6 +183,7 @@ repack("shell_and_test_pak") {
"//content/shell:resources",
"//extensions/shell:resources",
"//extensions/strings",
"//mojo/public/js:resources",
"//third_party/WebKit/public:resources",
"//third_party/WebKit/public:scaled_resources_100_percent",
"//ui/resources",
......
......@@ -39,6 +39,7 @@ repack("pak") {
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/headless/headless_lib_resources.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
......@@ -61,6 +62,7 @@ repack("pak") {
"//content/app/strings",
"//content/browser/devtools:resources",
"//content/browser/tracing:resources",
"//mojo/public/js:resources",
"//net:net_resources",
"//third_party/WebKit/public:resources",
"//third_party/WebKit/public:scaled_resources_100_percent",
......
......@@ -58,6 +58,7 @@ repack("repack_unscaled_resources") {
"$root_gen_dir/components/components_resources.pak",
"$root_gen_dir/ios/chrome/ios_resources.pak",
"$root_gen_dir/ios/web/ios_web_resources.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
]
......@@ -65,6 +66,7 @@ repack("repack_unscaled_resources") {
":ios_resources",
"//components/resources",
"//ios/web:resources",
"//mojo/public/js:resources",
"//net:net_resources",
"//ui/resources",
]
......
......@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//tools/grit/grit_rule.gni")
interfaces_bindings_gen_dir = "$root_gen_dir/mojo/public/interfaces/bindings"
source_set("js") {
......@@ -95,3 +97,22 @@ group("tests") {
":bindings",
]
}
grit("resources") {
source = "mojo_bindings_resources.grd"
# The .grd contains references to generated files.
source_is_generated = true
outputs = [
"grit/mojo_bindings_resources.h",
"mojo_bindings_resources.pak",
]
grit_flags = [
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [
":new_bindings",
]
}
<?xml version="1.0" encoding="UTF-8"?>
<grit latest_public_release="0" current_release="1" output_all_resource_defines="false">
<outputs>
<output filename="grit/mojo_bindings_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
<output filename="mojo_bindings_resources.pak" type="data_package" />
</outputs>
<translations />
<release seq="1">
<includes>
<include name="IDR_MOJO_BINDINGS_JS"
file="${root_gen_dir}\mojo\public\js\mojo_bindings.js"
type="BINDATA" use_base_dir="false" compress="gzip" />
</includes>
</release>
</grit>
......@@ -379,6 +379,10 @@
"third_party/libaddressinput/chromium/address_input_strings.grd": {
"messages": [28700],
},
"mojo/public/js/mojo_bindings_resources.grd": {
"includes": [28800],
},
# END "everything else" section.
# Everything but chrome/, components/, content/, and ios/
......
......@@ -49,9 +49,6 @@ grit("webui_resources_grd") {
"-E",
"root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
]
deps = [
"//mojo/public/js:new_bindings",
]
}
if (!is_mac) {
......@@ -168,6 +165,7 @@ repack("repack_ui_test_pak_100_percent") {
]
sources = [
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
......@@ -184,6 +182,7 @@ repack("repack_ui_test_pak_100_percent") {
output = "$root_out_dir/ui_test.pak"
deps = [
"//mojo/public/js:resources",
"//ui/resources",
"//ui/strings",
]
......
......@@ -16,9 +16,6 @@ without changes to the corresponding grd file. -->
<include name="IDR_WEBUI_I18N_TEMPLATE_JS" file="js/i18n_template.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_WEBUI_JSTEMPLATE_JS" file="js/jstemplate_compiled.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_WEBUI_ANALYTICS_JS" file="js/analytics.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_WEBUI_MOJO_BINDINGS_JS"
file="${root_gen_dir}\mojo\public\js\mojo_bindings.js"
flattenhtml="true" type="BINDATA" use_base_dir="false" compress="gzip" />
<!-- Roboto Font. Roboto-Regular and Roboto-Light is already available on
Android, and Roboto-Medium is not used on Android. All 6 weights of
Roboto are available on Chrome OS.-->
......
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