Use the same pak files for the Alloy and Chrome runtimes (see issue #2969)
Chrome currently uses chrome_100_percent.pak, chrome_200_percent.pak, resources.pak and locales/<locale>.pak files. This change adds CEF resources to those existing pak files and updates the Alloy runtime to use them instead of the previous CEF-specific pak files (cef.pak, cef_100_percent.pak, cef_200_percent.pak, cef_extensions.pak, devtools_resources.pak) which are no longer generated. The addition of Chrome resources results in an ~16% (~4.1MB) increase in total combined pak file size vs. the previous CEF-specific pak files. While a size increase is not ideal for the Alloy runtime, it seems preferable to the alternative of distributing separate (and partially duplicated) pak files for each runtime, which would have added ~9.8MB to the total binary distribution size.
This commit is contained in:
parent
a6a8c0e845
commit
8424f166cc
274
BUILD.gn
274
BUILD.gn
|
@ -98,7 +98,6 @@ import("//build/config/features.gni")
|
|||
import("//build/config/locales.gni")
|
||||
import("//build/config/sanitizers/sanitizers.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//cef/cef_repack_locales.gni")
|
||||
import("//chrome/common/features.gni")
|
||||
import("//content/public/app/mac_helpers.gni")
|
||||
import("//extensions/buildflags/buildflags.gni")
|
||||
|
@ -1303,121 +1302,8 @@ if (is_mac) {
|
|||
# Resource grit/pack targets.
|
||||
#
|
||||
|
||||
# Helper for generating scaled resource packs.
|
||||
template("cef_pak_scaled") {
|
||||
percent = invoker.percent
|
||||
|
||||
repack("pak_${target_name}") {
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/components/components_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
|
||||
"$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//chrome/renderer:resources",
|
||||
"//components/resources:components_scaled_resources",
|
||||
"//content/app/resources",
|
||||
"//extensions:extensions_browser_resources",
|
||||
"//third_party/blink/public:scaled_resources",
|
||||
"//ui/resources:ui_resources_grd",
|
||||
]
|
||||
|
||||
deps = [
|
||||
# This repack target generates the blink_scaled_resources_*_percent.pak
|
||||
# file but doesn't expose the public_deps required by make_pack_header.
|
||||
"//third_party/blink/public:scaled_resources_${percent}_percent",
|
||||
]
|
||||
|
||||
if (toolkit_views) {
|
||||
sources += [
|
||||
"$root_gen_dir/ui/views/resources/views_resources_${percent}_percent.pak"
|
||||
]
|
||||
|
||||
public_deps += [
|
||||
"//ui/views/resources:resources_grd"
|
||||
]
|
||||
}
|
||||
|
||||
output = "$root_out_dir/cef_${percent}_percent.pak"
|
||||
}
|
||||
}
|
||||
|
||||
# Generate cef_100_percent.pak.
|
||||
cef_pak_scaled("100_percent") {
|
||||
percent = "100"
|
||||
}
|
||||
|
||||
# Generate cef_200_percent.pak.
|
||||
cef_pak_scaled("200_percent") {
|
||||
percent = "200"
|
||||
}
|
||||
|
||||
# Generate devtools_resources.pak.
|
||||
repack("pak_devtools") {
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/content/browser/devtools/devtools_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//content/browser/devtools:devtools_resources",
|
||||
"//third_party/blink/public:devtools_inspector_resources",
|
||||
]
|
||||
|
||||
output = "$root_out_dir/devtools_resources.pak"
|
||||
}
|
||||
|
||||
# Generate cef_extensions.pak.
|
||||
repack("pak_extensions") {
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/component_extension_resources.pak",
|
||||
"$root_gen_dir/chrome/pdf_resources.pak",
|
||||
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
|
||||
"$root_gen_dir/content/browser/webrtc/resources/webrtc_internals_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_renderer_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_resources.pak",
|
||||
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
||||
"$root_gen_dir/ui/resources/webui_generated_resources.pak",
|
||||
"$root_gen_dir/ui/resources/webui_resources.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//chrome/browser/resources/pdf:pdf_resources",
|
||||
"//content/browser/resources/media:media_internals_resources",
|
||||
"//content/browser/webrtc/resources",
|
||||
"//extensions:extensions_renderer_resources",
|
||||
"//extensions:extensions_resources_grd",
|
||||
"//mojo/public/js:resources",
|
||||
"//ui/resources:webui_generated_resources_grd",
|
||||
"//ui/resources:webui_resources_grd",
|
||||
]
|
||||
|
||||
output = "$root_out_dir/cef_extensions.pak"
|
||||
}
|
||||
|
||||
# Included in locales/*.pak via //chrome/chrome_repack_locales.gni.
|
||||
grit("cef_strings") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
source = "libcef/resources/cef_strings.grd"
|
||||
outputs = [
|
||||
"grit/cef_strings.h",
|
||||
|
@ -1428,22 +1314,8 @@ grit("cef_strings") {
|
|||
}
|
||||
}
|
||||
|
||||
# Generate locales/<locale>.pak.
|
||||
# See cef_repack_locales.gni for the list of input pak files and deps.
|
||||
cef_repack_locales("repack_locales_pack") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
input_locales = locales
|
||||
|
||||
if (is_mac) {
|
||||
output_locales = locales_as_mac_outputs
|
||||
} else {
|
||||
output_locales = locales
|
||||
}
|
||||
}
|
||||
|
||||
# Included in resources.pak via //chrome/chrome_paks.gni.
|
||||
grit("cef_resources") {
|
||||
visibility = [ ":*" ]
|
||||
source = "libcef/resources/cef_resources.grd"
|
||||
outputs = [
|
||||
"grit/cef_resources.h",
|
||||
|
@ -1455,54 +1327,11 @@ grit("cef_resources") {
|
|||
]
|
||||
}
|
||||
|
||||
# Generate cef.pak.
|
||||
repack("pak") {
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/base/tracing/protos/tracing_proto_resources.pak",
|
||||
"$root_gen_dir/chrome/browser_resources.pak",
|
||||
"$root_gen_dir/chrome/dev_ui_browser_resources.pak",
|
||||
"$root_gen_dir/chrome/net_internals_resources.pak",
|
||||
"$root_gen_dir/chrome/print_preview_resources.pak",
|
||||
"$root_gen_dir/chrome/common_resources.pak",
|
||||
"$root_gen_dir/components/components_resources.pak",
|
||||
"$root_gen_dir/components/dev_ui_components_resources.pak",
|
||||
"$root_gen_dir/cef/cef_resources.pak",
|
||||
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
|
||||
"$root_gen_dir/content/content_resources.pak",
|
||||
"$root_gen_dir/content/dev_ui_content_resources.pak",
|
||||
"$root_gen_dir/net/net_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//base/tracing/protos:chrome_track_event_resources",
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/browser:resources",
|
||||
"//chrome/browser/resources/net_internals:net_internals_resources",
|
||||
"//chrome/browser/resources/print_preview:print_preview_resources",
|
||||
"//chrome/common:resources",
|
||||
"//components/resources:components_resources",
|
||||
"//components/resources:dev_ui_components_resources",
|
||||
":cef_resources",
|
||||
"//content/browser/tracing:resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
"//net:net_resources",
|
||||
"//third_party/blink/public:resources",
|
||||
]
|
||||
|
||||
output = "$root_out_dir/cef.pak"
|
||||
}
|
||||
|
||||
# Helper for generating pack header files.
|
||||
template("make_pack_header") {
|
||||
assert(defined(invoker.header))
|
||||
assert(defined(invoker.inputs))
|
||||
assert(defined(invoker.deps))
|
||||
|
||||
action("make_pack_header_${target_name}") {
|
||||
script = "tools/make_pack_header.py"
|
||||
|
@ -1513,16 +1342,7 @@ template("make_pack_header") {
|
|||
args = rebase_path(outputs, root_build_dir) +
|
||||
rebase_path(inputs, root_build_dir)
|
||||
|
||||
deps = [
|
||||
# List all targets that generate pack files here. The grit targets that
|
||||
# generate |inputs| will be picked up via public_deps.
|
||||
":pak",
|
||||
":pak_100_percent",
|
||||
":pak_200_percent",
|
||||
":pak_devtools",
|
||||
":pak_extensions",
|
||||
":repack_locales_pack",
|
||||
]
|
||||
deps = invoker.deps
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1557,8 +1377,42 @@ make_pack_header("resources") {
|
|||
"$root_gen_dir/ui/resources/grit/ui_resources.h",
|
||||
"$root_gen_dir/ui/resources/grit/webui_generated_resources.h",
|
||||
"$root_gen_dir/ui/resources/grit/webui_resources.h",
|
||||
"$root_gen_dir/ui/views/resources/grit/views_resources.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":cef_resources",
|
||||
"//base/tracing/protos:chrome_track_event_resources",
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/browser:resources",
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//chrome/browser/resources/net_internals:net_internals_resources",
|
||||
"//chrome/browser/resources/pdf:pdf_resources",
|
||||
"//chrome/browser/resources/print_preview:print_preview_resources",
|
||||
"//chrome/common:resources",
|
||||
"//chrome/renderer:resources",
|
||||
"//components/resources:components_resources",
|
||||
"//components/resources:dev_ui_components_resources",
|
||||
"//content/browser/devtools:devtools_resources",
|
||||
"//content/browser/resources/media:media_internals_resources",
|
||||
"//content/browser/tracing:resources",
|
||||
"//content/browser/webrtc/resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
"//extensions:extensions_browser_resources",
|
||||
"//extensions:extensions_renderer_resources",
|
||||
"//extensions:extensions_resources_grd",
|
||||
"//mojo/public/js:resources",
|
||||
"//net:net_resources",
|
||||
"//third_party/blink/public:resources",
|
||||
"//ui/resources:ui_resources_grd",
|
||||
"//ui/resources:webui_generated_resources_grd",
|
||||
"//ui/resources:webui_resources_grd",
|
||||
]
|
||||
|
||||
if (toolkit_views) {
|
||||
inputs += [ "$root_gen_dir/ui/views/resources/grit/views_resources.h" ]
|
||||
deps += [ "//ui/views/resources:resources_grd" ]
|
||||
}
|
||||
}
|
||||
|
||||
# Generate cef_pack_strings.h.
|
||||
|
@ -1578,6 +1432,23 @@ make_pack_header("strings") {
|
|||
"$root_gen_dir/third_party/blink/public/strings/grit/blink_strings.h",
|
||||
"$root_gen_dir/ui/strings/grit/ui_strings.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":cef_strings",
|
||||
"//chrome/app:chromium_strings",
|
||||
"//chrome/app:generated_resources",
|
||||
"//chrome/app/resources:locale_settings",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/omnibox/resources:omnibox_resources",
|
||||
"//components/strings:components_chromium_strings",
|
||||
"//components/strings:components_locale_settings",
|
||||
"//components/strings:components_strings",
|
||||
"//extensions/strings",
|
||||
"//services/strings",
|
||||
"//third_party/blink/public/strings",
|
||||
"//ui/strings:app_locale_settings",
|
||||
"//ui/strings:ui_strings",
|
||||
]
|
||||
}
|
||||
|
||||
# Generate cef_api_hash.h.
|
||||
|
@ -1627,37 +1498,9 @@ if (is_mac) {
|
|||
]
|
||||
}
|
||||
|
||||
bundle_data("cef_framework_locales") {
|
||||
sources = []
|
||||
foreach(locale, locales_as_mac_outputs) {
|
||||
sources += [ "$root_gen_dir/repack/locales/$locale.pak" ]
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
":repack_locales_pack",
|
||||
]
|
||||
|
||||
outputs = [
|
||||
"{{bundle_resources_dir}}/{{source_name_part}}.lproj/locale.pak",
|
||||
]
|
||||
}
|
||||
|
||||
bundle_data("cef_framework_resources") {
|
||||
sources = [
|
||||
"$root_out_dir/cef.pak",
|
||||
"$root_out_dir/cef_100_percent.pak",
|
||||
"$root_out_dir/cef_200_percent.pak",
|
||||
"$root_out_dir/cef_extensions.pak",
|
||||
"$root_out_dir/devtools_resources.pak",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
":pak",
|
||||
":pak_100_percent",
|
||||
":pak_200_percent",
|
||||
":pak_devtools",
|
||||
":pak_extensions",
|
||||
]
|
||||
sources = []
|
||||
public_deps = []
|
||||
|
||||
if (icu_use_data_file) {
|
||||
sources += [ "$root_out_dir/icudtl.dat" ]
|
||||
|
@ -1748,7 +1591,6 @@ if (is_mac) {
|
|||
|
||||
deps = [
|
||||
":cef_framework_angle_library",
|
||||
":cef_framework_locales",
|
||||
":cef_framework_resources",
|
||||
":cef_framework_swiftshader_library",
|
||||
":libcef_static",
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
|
||||
# 2014 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.
|
||||
#
|
||||
# This is a copy of src/chrome/chrome_repack_locales.gni with the necessary
|
||||
# modifications to meet CEF's requirements.
|
||||
|
||||
import("//build/config/chrome_build.gni")
|
||||
import("//build/config/features.gni")
|
||||
import("//build/config/ui.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
|
||||
# Arguments:
|
||||
#
|
||||
# locale
|
||||
# Internal name of locale. e.g. "pt-BR"
|
||||
#
|
||||
# output
|
||||
# Output file name.
|
||||
#
|
||||
# visibility
|
||||
# Normal meaning.
|
||||
template("_repack_one_locale") {
|
||||
locale = invoker.locale
|
||||
|
||||
repack(target_name) {
|
||||
visibility = invoker.visibility
|
||||
|
||||
# Each input pak file should also have a deps line for completeness.
|
||||
# Add associated .h files in the make_pack_header("strings") target.
|
||||
sources = [
|
||||
"${root_gen_dir}/cef/cef_strings_${locale}.pak",
|
||||
"${root_gen_dir}/chrome/chromium_strings_${locale}.pak",
|
||||
"${root_gen_dir}/chrome/generated_resources_${locale}.pak",
|
||||
"${root_gen_dir}/chrome/locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/chrome/platform_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/components/omnibox/resources/omnibox_resources_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_chromium_strings_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_strings_${locale}.pak",
|
||||
"${root_gen_dir}/extensions/strings/extensions_strings_${locale}.pak",
|
||||
"${root_gen_dir}/services/strings/services_strings_${locale}.pak",
|
||||
"${root_gen_dir}/third_party/blink/public/strings/blink_strings_${locale}.pak",
|
||||
"${root_gen_dir}/ui/strings/app_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/ui/strings/ui_strings_${locale}.pak",
|
||||
]
|
||||
|
||||
# Use public_deps so that generated grit headers are discoverable from
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
":cef_strings",
|
||||
"//chrome/app:chromium_strings",
|
||||
"//chrome/app:generated_resources",
|
||||
"//chrome/app/resources:locale_settings",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/omnibox/resources:omnibox_resources",
|
||||
"//components/strings:components_chromium_strings",
|
||||
"//components/strings:components_locale_settings",
|
||||
"//components/strings:components_strings",
|
||||
"//extensions/strings",
|
||||
"//services/strings",
|
||||
"//third_party/blink/public/strings",
|
||||
"//ui/strings:app_locale_settings",
|
||||
"//ui/strings:ui_strings",
|
||||
]
|
||||
|
||||
output = invoker.output
|
||||
}
|
||||
}
|
||||
|
||||
# Creates an action to call the repack_locales script.
|
||||
#
|
||||
# The GYP version generates the locales in the "gen" directory and then copies
|
||||
# it to the root build directory. This isn't easy to express in a GN copy
|
||||
# rule since the files on Mac have a complex structure. So we generate the
|
||||
# files into the final place and skip the "gen" directory.
|
||||
#
|
||||
# This template uses GN's looping constructs to avoid the complex call to
|
||||
# chrome/tools/build/repack_locales.py which wraps the repack commands in the
|
||||
# GYP build.
|
||||
#
|
||||
# Arguments
|
||||
#
|
||||
# input_locales
|
||||
# List of locale names to use as inputs.
|
||||
#
|
||||
# output_locales
|
||||
# A list containing the corresponding output names for each of the
|
||||
# input names. Mac uses different names in some cases.
|
||||
#
|
||||
# visibility
|
||||
template("cef_repack_locales") {
|
||||
# This is the name of the group below that will collect all the invidual
|
||||
# locale targets. External targets will depend on this.
|
||||
group_target_name = target_name
|
||||
|
||||
# GN's subscript is too stupid to do invoker.output_locales[foo] so we need
|
||||
# to make a copy and do output_locales[foo].
|
||||
output_locales = invoker.output_locales
|
||||
|
||||
# Collects all targets the loop generates.
|
||||
locale_targets = []
|
||||
|
||||
# This loop iterates over the input locales and also keeps a counter so it
|
||||
# can simultaneously iterate over the output locales (using GN's very
|
||||
# limited looping capabilities).
|
||||
current_index = 0
|
||||
foreach(input_locale, invoker.input_locales) {
|
||||
output_locale = output_locales[current_index]
|
||||
|
||||
# Compute the name of the target for the current file. Save it for the deps.
|
||||
current_name = "${target_name}_${input_locale}"
|
||||
locale_targets += [ ":$current_name" ]
|
||||
|
||||
_repack_one_locale(current_name) {
|
||||
visibility = [ ":$group_target_name" ]
|
||||
locale = input_locale
|
||||
|
||||
# Compute the output name. Mac uses a different location.
|
||||
if (is_mac || is_ios) {
|
||||
output = "${root_gen_dir}/repack/locales/${output_locale}.pak"
|
||||
} else {
|
||||
output = "${root_out_dir}/locales/${output_locale}.pak"
|
||||
}
|
||||
}
|
||||
|
||||
current_index = current_index + 1
|
||||
}
|
||||
|
||||
# The group that external targets depend on which collects all deps.
|
||||
group(group_target_name) {
|
||||
forward_variables_from(invoker, [ "visibility" ])
|
||||
public_deps = locale_targets
|
||||
}
|
||||
}
|
|
@ -228,11 +228,9 @@ if(OS_LINUX)
|
|||
|
||||
# List of CEF resource files.
|
||||
set(CEF_RESOURCE_FILES
|
||||
cef.pak
|
||||
cef_100_percent.pak
|
||||
cef_200_percent.pak
|
||||
cef_extensions.pak
|
||||
devtools_resources.pak
|
||||
chrome_100_percent.pak
|
||||
chrome_200_percent.pak
|
||||
resources.pak
|
||||
icudtl.dat
|
||||
locales
|
||||
)
|
||||
|
@ -480,11 +478,9 @@ if(OS_WINDOWS)
|
|||
|
||||
# List of CEF resource files.
|
||||
set(CEF_RESOURCE_FILES
|
||||
cef.pak
|
||||
cef_100_percent.pak
|
||||
cef_200_percent.pak
|
||||
cef_extensions.pak
|
||||
devtools_resources.pak
|
||||
chrome_100_percent.pak
|
||||
chrome_200_percent.pak
|
||||
resources.pak
|
||||
icudtl.dat
|
||||
locales
|
||||
)
|
||||
|
|
|
@ -342,10 +342,10 @@ typedef struct _cef_settings_t {
|
|||
|
||||
///
|
||||
// The fully qualified path for the resources directory. If this value is
|
||||
// empty the cef.pak and/or devtools_resources.pak files must be located in
|
||||
// the module directory on Windows/Linux or the app bundle Resources directory
|
||||
// on Mac OS X. If this value is non-empty then it must be an absolute path.
|
||||
// Also configurable using the "resources-dir-path" command-line switch.
|
||||
// empty the *.pak files must be located in the module directory on
|
||||
// Windows/Linux or the app bundle Resources directory on Mac OS X. If this
|
||||
// value is non-empty then it must be an absolute path. Also configurable
|
||||
// using the "resources-dir-path" command-line switch.
|
||||
///
|
||||
cef_string_t resources_dir_path;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "chrome/browser/ui/browser_window.h"
|
||||
#include "chrome/browser/ui/tabs/tab_strip_model.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/url_formatter/url_fixer.h"
|
||||
#include "url/url_constants.h"
|
||||
|
||||
#if defined(TOOLKIT_VIEWS)
|
||||
|
@ -435,13 +436,24 @@ bool ChromeBrowserHostImpl::Navigate(const content::OpenURLParams& params) {
|
|||
}
|
||||
|
||||
if (browser_) {
|
||||
// Fix common problems with user-typed text. Among other things, this:
|
||||
// - Converts absolute file paths to "file://" URLs.
|
||||
// - Normalizes "about:" and "chrome:" to "chrome://" URLs.
|
||||
// - Adds the "http://" scheme if none was specified.
|
||||
GURL gurl = url_formatter::FixupURL(params.url.possibly_invalid_spec(),
|
||||
std::string());
|
||||
if (!gurl.is_valid()) {
|
||||
LOG(ERROR) << "Invalid URL: " << params.url.possibly_invalid_spec();
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is generally equivalent to calling Browser::OpenURL, except:
|
||||
// 1. It doesn't trigger a call to CefRequestHandler::OnOpenURLFromTab, and
|
||||
// 2. It navigates in this CefBrowserHost's WebContents instead of
|
||||
// (a) creating a new WebContents, or (b) using the Browser's active
|
||||
// WebContents (which may not be the same), and
|
||||
// 3. There is no risk of triggering chrome's popup blocker.
|
||||
NavigateParams nav_params(browser_, params.url, params.transition);
|
||||
NavigateParams nav_params(browser_, gurl, params.transition);
|
||||
nav_params.FillNavigateParamsFromOpenURLParams(params);
|
||||
|
||||
// Always navigate in the current tab.
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
|
||||
#include "chrome/browser/ui/webui/theme_source.h"
|
||||
#include "chrome/common/url_constants.h"
|
||||
#include "chrome/grit/chrome_unscaled_resources.h"
|
||||
#include "content/browser/renderer_host/debug_urls.h"
|
||||
#include "content/browser/webui/content_web_ui_controller_factory.h"
|
||||
#include "content/public/browser/browser_url_handler.h"
|
||||
|
@ -354,17 +353,9 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
|
|||
}
|
||||
|
||||
bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||
// TODO(chrome): Currently, CEF-specific resources for the Alloy runtime come
|
||||
// from cef/libcef/resources/cef_resources.grd via cef.pak and CEF-specific
|
||||
// resources for the Chrome runtime come from
|
||||
// chrome/app/theme/chrome_unscaled_resources.grd via chrome_100_percent.pak.
|
||||
// It would be better to have a single pak file (and single ID value) for
|
||||
// CEF-specific resources and share the same *.pak files as Chrome for the
|
||||
// other resources.
|
||||
std::string piece =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
cef::IsChromeRuntimeEnabled() ? IDR_CHROME_CEF_LICENSE_TXT
|
||||
: IDR_CEF_LICENSE_TXT);
|
||||
IDR_CEF_LICENSE_TXT);
|
||||
if (piece.empty()) {
|
||||
NOTREACHED() << "Failed to load license txt resource.";
|
||||
return false;
|
||||
|
|
|
@ -486,9 +486,8 @@ AlloyMainDelegate::GetWebWorkerTaskRunner() {
|
|||
void AlloyMainDelegate::InitializeResourceBundle() {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
base::FilePath cef_pak_file, cef_100_percent_pak_file,
|
||||
cef_200_percent_pak_file, cef_extensions_pak_file, devtools_pak_file,
|
||||
locales_dir;
|
||||
base::FilePath resources_pak_file, chrome_100_percent_pak_file,
|
||||
chrome_200_percent_pak_file, locales_dir;
|
||||
|
||||
base::FilePath resources_dir;
|
||||
if (command_line->HasSwitch(switches::kResourcesDirPath)) {
|
||||
|
@ -503,15 +502,12 @@ void AlloyMainDelegate::InitializeResourceBundle() {
|
|||
if (!resource_bundle_delegate_.pack_loading_disabled()) {
|
||||
if (!resources_dir.empty()) {
|
||||
CHECK(resources_dir.IsAbsolute());
|
||||
cef_pak_file = resources_dir.Append(FILE_PATH_LITERAL("cef.pak"));
|
||||
cef_100_percent_pak_file =
|
||||
resources_dir.Append(FILE_PATH_LITERAL("cef_100_percent.pak"));
|
||||
cef_200_percent_pak_file =
|
||||
resources_dir.Append(FILE_PATH_LITERAL("cef_200_percent.pak"));
|
||||
cef_extensions_pak_file =
|
||||
resources_dir.Append(FILE_PATH_LITERAL("cef_extensions.pak"));
|
||||
devtools_pak_file =
|
||||
resources_dir.Append(FILE_PATH_LITERAL("devtools_resources.pak"));
|
||||
resources_pak_file =
|
||||
resources_dir.Append(FILE_PATH_LITERAL("resources.pak"));
|
||||
chrome_100_percent_pak_file =
|
||||
resources_dir.Append(FILE_PATH_LITERAL("chrome_100_percent.pak"));
|
||||
chrome_200_percent_pak_file =
|
||||
resources_dir.Append(FILE_PATH_LITERAL("chrome_200_percent.pak"));
|
||||
}
|
||||
|
||||
if (command_line->HasSwitch(switches::kLocalesDirPath))
|
||||
|
@ -539,54 +535,36 @@ void AlloyMainDelegate::InitializeResourceBundle() {
|
|||
|
||||
resource_bundle_delegate_.set_allow_pack_file_load(true);
|
||||
|
||||
if (base::PathExists(cef_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(cef_pak_file, ui::SCALE_FACTOR_NONE);
|
||||
if (base::PathExists(resources_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(resources_pak_file,
|
||||
ui::SCALE_FACTOR_NONE);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load cef.pak";
|
||||
LOG(ERROR) << "Could not load resources.pak";
|
||||
}
|
||||
|
||||
// On OS X and Linux/Aura always load the 1x data pack first as the 2x data
|
||||
// pack contains both 1x and 2x images.
|
||||
const bool load_100_percent =
|
||||
#if defined(OS_WIN)
|
||||
resource_util::IsScaleFactorSupported(ui::SCALE_FACTOR_100P);
|
||||
#else
|
||||
true;
|
||||
#endif
|
||||
|
||||
if (load_100_percent) {
|
||||
if (base::PathExists(cef_100_percent_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(cef_100_percent_pak_file,
|
||||
// Always load the 1x data pack first as the 2x data pack contains both 1x
|
||||
// and 2x images. The 1x data pack only has 1x images, thus passes in an
|
||||
// accurate scale factor to gfx::ImageSkia::AddRepresentation.
|
||||
if (resource_util::IsScaleFactorSupported(ui::SCALE_FACTOR_100P)) {
|
||||
if (base::PathExists(chrome_100_percent_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(chrome_100_percent_pak_file,
|
||||
ui::SCALE_FACTOR_100P);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load cef_100_percent.pak";
|
||||
LOG(ERROR) << "Could not load chrome_100_percent.pak";
|
||||
}
|
||||
}
|
||||
|
||||
if (resource_util::IsScaleFactorSupported(ui::SCALE_FACTOR_200P)) {
|
||||
if (base::PathExists(cef_200_percent_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(cef_200_percent_pak_file,
|
||||
if (base::PathExists(chrome_200_percent_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(chrome_200_percent_pak_file,
|
||||
ui::SCALE_FACTOR_200P);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load cef_200_percent.pak";
|
||||
LOG(ERROR) << "Could not load chrome_200_percent.pak";
|
||||
}
|
||||
}
|
||||
|
||||
if (extensions::ExtensionsEnabled() ||
|
||||
!command_line->HasSwitch(switches::kDisablePlugins)) {
|
||||
if (base::PathExists(cef_extensions_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(cef_extensions_pak_file,
|
||||
ui::SCALE_FACTOR_NONE);
|
||||
} else {
|
||||
LOG(ERROR) << "Could not load cef_extensions.pak";
|
||||
}
|
||||
}
|
||||
|
||||
if (base::PathExists(devtools_pak_file)) {
|
||||
resource_bundle.AddDataPackFromPath(devtools_pak_file,
|
||||
ui::SCALE_FACTOR_NONE);
|
||||
}
|
||||
|
||||
// Skip the default pak file loading that would otherwise occur in
|
||||
// ResourceBundle::LoadChromeResources().
|
||||
resource_bundle_delegate_.set_allow_pack_file_load(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,18 +77,6 @@ index db85b6b2fcf5..bcf6867e8f4e 100644
|
|||
}
|
||||
|
||||
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
|
||||
diff --git chrome/app/theme/chrome_unscaled_resources.grd chrome/app/theme/chrome_unscaled_resources.grd
|
||||
index b4e4545e3520..29335f1614e2 100644
|
||||
--- chrome/app/theme/chrome_unscaled_resources.grd
|
||||
+++ chrome/app/theme/chrome_unscaled_resources.grd
|
||||
@@ -62,6 +62,7 @@
|
||||
</if>
|
||||
</if>
|
||||
<if expr="not _google_chrome">
|
||||
+ <include name="IDR_CHROME_CEF_LICENSE_TXT" file="../../../cef/LICENSE.txt" type="BINDATA" />
|
||||
<include name="IDR_PRODUCT_LOGO_64" file="chromium/product_logo_64.png" type="BINDATA" />
|
||||
<include name="IDR_PRODUCT_LOGO_128" file="chromium/product_logo_128.png" type="BINDATA" />
|
||||
<include name="IDR_PRODUCT_LOGO_256" file="chromium/product_logo_256.png" type="BINDATA" />
|
||||
diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc
|
||||
index fee4d5f1a8ca..2e4fb506d851 100644
|
||||
--- chrome/browser/chrome_browser_main.cc
|
||||
|
@ -140,7 +128,7 @@ index c30b73c2575f..5da45a243f9b 100644
|
|||
#import "chrome/browser/app_controller_mac.h"
|
||||
#include "chrome/browser/apps/app_shim/app_shim_listener.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
@@ -111,6 +112,7 @@
|
||||
@@ -111,6 +112,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +136,7 @@ index c30b73c2575f..5da45a243f9b 100644
|
|||
// Create the app delegate. This object is intentionally leaked as a global
|
||||
// singleton. It is accessed through -[NSApp delegate].
|
||||
AppController* app_controller = [[AppController alloc] init];
|
||||
@@ -119,6 +121,7 @@
|
||||
@@ -119,6 +121,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() {
|
||||
chrome::BuildMainMenu(NSApp, app_controller,
|
||||
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), false);
|
||||
[app_controller mainMenuCreated];
|
||||
|
@ -156,7 +144,7 @@ index c30b73c2575f..5da45a243f9b 100644
|
|||
|
||||
PrefService* local_state = g_browser_process->local_state();
|
||||
DCHECK(local_state);
|
||||
@@ -175,7 +178,9 @@
|
||||
@@ -175,7 +178,9 @@ void ChromeBrowserMainPartsMac::PostProfileInit() {
|
||||
}
|
||||
|
||||
void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() {
|
||||
|
@ -178,7 +166,7 @@ index 9e8fcb9f9f91..2a9eaca0fb0d 100644
|
|||
#include "chrome/browser/browser_features.h"
|
||||
#include "chrome/browser/notifications/notification_common.h"
|
||||
#include "chrome/browser/notifications/notification_display_service_impl.h"
|
||||
@@ -451,6 +452,12 @@ - (void)notificationClick:(NSDictionary*)notificationResponseData {
|
||||
@@ -451,6 +452,12 @@ getDisplayedAlertsForProfileId:(NSString*)profileId
|
||||
- (id<NotificationDelivery>)serviceProxy {
|
||||
id<NotificationDelivery> proxy = [_xpcConnection remoteObjectProxy];
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ index 839144aa1e9b..29c8ab32398a 100644
|
|||
+_OBJC_METACLASS_$_UnderlayOpenGLHostingWindow
|
||||
+
|
||||
diff --git chrome/chrome_paks.gni chrome/chrome_paks.gni
|
||||
index 6ad9c87a3adf..33716990c792 100644
|
||||
index 6ad9c87a3adf..a47694446b9a 100644
|
||||
--- chrome/chrome_paks.gni
|
||||
+++ chrome/chrome_paks.gni
|
||||
@@ -4,6 +4,7 @@
|
||||
|
@ -90,33 +90,40 @@ index 6ad9c87a3adf..33716990c792 100644
|
|||
import("//chrome/browser/buildflags.gni")
|
||||
import("//chrome/browser/resources/pdf/ink/ink.gni")
|
||||
import("//chrome/common/features.gni")
|
||||
@@ -344,6 +345,7 @@ template("chrome_paks") {
|
||||
@@ -255,6 +256,10 @@ template("chrome_extra_paks") {
|
||||
"//chrome/browser/resources/welcome:welcome_resources",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+ if (!enable_cef) {
|
||||
chrome_repack_locales("${target_name}_locales") {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
@@ -366,14 +368,17 @@ template("chrome_paks") {
|
||||
output_locales = locales
|
||||
}
|
||||
}
|
||||
+ } # !enable_cef
|
||||
|
||||
group(target_name) {
|
||||
forward_variables_from(invoker, [ "deps" ])
|
||||
public_deps = [
|
||||
":${target_name}_100_percent",
|
||||
":${target_name}_extra",
|
||||
- ":${target_name}_locales",
|
||||
]
|
||||
+ if (!enable_cef) {
|
||||
+ public_deps += [ ":${target_name}_locales" ]
|
||||
+ if (enable_cef) {
|
||||
+ sources += [ "$root_gen_dir/cef/cef_resources.pak" ]
|
||||
+ deps += [ "//cef:cef_resources" ]
|
||||
+ }
|
||||
if (enable_hidpi) {
|
||||
public_deps += [ ":${target_name}_200_percent" ]
|
||||
if (enable_extensions) {
|
||||
sources += [
|
||||
"$root_gen_dir/chrome/extensions_resources.pak",
|
||||
diff --git chrome/chrome_repack_locales.gni chrome/chrome_repack_locales.gni
|
||||
index a64a23560460..b08eee1f789a 100644
|
||||
--- chrome/chrome_repack_locales.gni
|
||||
+++ chrome/chrome_repack_locales.gni
|
||||
@@ -6,6 +6,7 @@ import("//build/config/chrome_build.gni")
|
||||
import("//build/config/chromeos/ui_mode.gni")
|
||||
import("//build/config/features.gni")
|
||||
import("//build/config/ui.gni")
|
||||
+import("//cef/libcef/features/features.gni")
|
||||
import("//extensions/buildflags/buildflags.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
|
||||
@@ -83,6 +84,10 @@ template("chrome_repack_locales") {
|
||||
]
|
||||
compress = true
|
||||
}
|
||||
+ if (enable_cef) {
|
||||
+ source_patterns += [ "${root_gen_dir}/cef/cef_strings_" ]
|
||||
+ deps += [ "//cef:cef_strings" ]
|
||||
+ }
|
||||
if (enable_extensions) {
|
||||
source_patterns +=
|
||||
[ "${root_gen_dir}/extensions/strings/extensions_strings_" ]
|
||||
diff --git chrome/installer/mini_installer/BUILD.gn chrome/installer/mini_installer/BUILD.gn
|
||||
index 5f5cb1c752f2..ef0a01caf9cd 100644
|
||||
--- chrome/installer/mini_installer/BUILD.gn
|
||||
|
|
|
@ -41,22 +41,12 @@ run but any related functionality may become broken or disabled.
|
|||
CefSettings.pack_loading_disabled. The resources directory path can be
|
||||
customized using CefSettings.resources_dir_path.
|
||||
|
||||
* cef.pak
|
||||
* cef_100_percent.pak
|
||||
* cef_200_percent.pak
|
||||
* chrome_100_percent.pak
|
||||
* chrome_200_percent.pak
|
||||
* resources.pak
|
||||
These files contain non-localized resources used by CEF, Chromium and Blink.
|
||||
Without these files arbitrary Web components may display incorrectly.
|
||||
|
||||
* cef_extensions.pak
|
||||
This file contains non-localized resources required for extension loading.
|
||||
Pass the `--disable-extensions` command-line flag to disable use of this
|
||||
file. Without this file components that depend on the extension system,
|
||||
such as the PDF viewer, will not function.
|
||||
|
||||
* devtools_resources.pak
|
||||
This file contains non-localized resources required for Chrome Developer
|
||||
Tools. Without this file Chrome Developer Tools will not function.
|
||||
|
||||
* Angle support.
|
||||
* libEGL.so
|
||||
* libGLESv2.so
|
||||
|
|
|
@ -20,11 +20,9 @@ cefclient.app/
|
|||
libswiftshader_libEGL.dylib <= swiftshader support libraries
|
||||
libswiftshader_libGLESv2.dylib <=^
|
||||
Resources/
|
||||
cef.pak <= non-localized resources and strings
|
||||
cef_100_percent.pak <====^
|
||||
cef_200_percent.pak <====^
|
||||
cef_extensions.pak <=====^
|
||||
devtools_resources.pak <=^
|
||||
chrome_100_percent.pak <= non-localized resources and strings
|
||||
chrome_200_percent.pak <=^
|
||||
resources.pak <=^
|
||||
icudtl.dat <= unicode support
|
||||
snapshot_blob.bin, v8_context_snapshot.[x86_64|arm64].bin <= V8 initial snapshot
|
||||
en.lproj/, ... <= locale-specific resources and strings
|
||||
|
@ -87,22 +85,12 @@ run but any related functionality may become broken or disabled.
|
|||
Pack file loading can be disabled completely using
|
||||
CefSettings.pack_loading_disabled.
|
||||
|
||||
* Chromium Embedded Framework.framework/Resources/cef.pak
|
||||
* Chromium Embedded Framework.framework/Resources/cef_100_percent.pak
|
||||
* Chromium Embedded Framework.framework/Resources/cef_200_percent.pak
|
||||
* Chromium Embedded Framework.framework/Resources/chrome_100_percent.pak
|
||||
* Chromium Embedded Framework.framework/Resources/chrome_200_percent.pak
|
||||
* Chromium Embedded Framework.framework/Resources/resources.pak
|
||||
These files contain non-localized resources used by CEF, Chromium and Blink.
|
||||
Without these files arbitrary Web components may display incorrectly.
|
||||
|
||||
* Chromium Embedded Framework.framework/Resources/cef_extensions.pak
|
||||
This file contains non-localized resources required for extension loading.
|
||||
Pass the `--disable-extensions` command-line flag to disable use of this
|
||||
file. Without this file components that depend on the extension system,
|
||||
such as the PDF viewer, will not function.
|
||||
|
||||
* Chromium Embedded Framework.framework/Resources/devtools_resources.pak
|
||||
This file contains non-localized resources required for Chrome Developer
|
||||
Tools. Without this file Chrome Developer Tools will not function.
|
||||
|
||||
* Angle support.
|
||||
* Chromium Embedded Framework.framework/Libraries/libEGL.dylib
|
||||
* Chromium Embedded Framework.framework/Libraries/libGLESv2.dylib
|
||||
|
|
|
@ -42,22 +42,12 @@ run but any related functionality may become broken or disabled.
|
|||
CefSettings.pack_loading_disabled. The resources directory path can be
|
||||
customized using CefSettings.resources_dir_path.
|
||||
|
||||
* cef.pak
|
||||
* cef_100_percent.pak
|
||||
* cef_200_percent.pak
|
||||
* chrome_100_percent.pak
|
||||
* chrome_200_percent.pak
|
||||
* resources.pak
|
||||
These files contain non-localized resources used by CEF, Chromium and Blink.
|
||||
Without these files arbitrary Web components may display incorrectly.
|
||||
|
||||
* cef_extensions.pak
|
||||
This file contains non-localized resources required for extension loading.
|
||||
Pass the `--disable-extensions` command-line flag to disable use of this
|
||||
file. Without this file components that depend on the extension system,
|
||||
such as the PDF viewer, will not function.
|
||||
|
||||
* devtools_resources.pak
|
||||
This file contains non-localized resources required for Chrome Developer
|
||||
Tools. Without this file Chrome Developer Tools will not function.
|
||||
|
||||
* Angle and Direct3D support.
|
||||
* d3dcompiler_47.dll (required for Windows Vista and newer)
|
||||
* libEGL.dll
|
||||
|
|
|
@ -868,11 +868,9 @@ if platform == 'windows':
|
|||
|
||||
# yapf: disable
|
||||
resources = [
|
||||
{'path': 'cef.pak'},
|
||||
{'path': 'cef_100_percent.pak'},
|
||||
{'path': 'cef_200_percent.pak'},
|
||||
{'path': 'cef_extensions.pak'},
|
||||
{'path': 'devtools_resources.pak'},
|
||||
{'path': 'chrome_100_percent.pak'},
|
||||
{'path': 'chrome_200_percent.pak'},
|
||||
{'path': 'resources.pak'},
|
||||
{'path': 'icudtl.dat'},
|
||||
{'path': 'locales', 'delete': '*.info'},
|
||||
]
|
||||
|
@ -1185,11 +1183,9 @@ elif platform == 'linux':
|
|||
|
||||
# yapf: disable
|
||||
resources = [
|
||||
{'path': 'cef.pak'},
|
||||
{'path': 'cef_100_percent.pak'},
|
||||
{'path': 'cef_200_percent.pak'},
|
||||
{'path': 'cef_extensions.pak'},
|
||||
{'path': 'devtools_resources.pak'},
|
||||
{'path': 'chrome_100_percent.pak'},
|
||||
{'path': 'chrome_200_percent.pak'},
|
||||
{'path': 'resources.pak'},
|
||||
{'path': 'icudtl.dat'},
|
||||
{'path': 'locales', 'delete': '*.info'},
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue