Commit da8a069e authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

[WebLayer] Use Chrome's sad frame bitmap in WebLayer

This makes WebLayer match Chrome's sad frame/plugin bitmap. This
required moving the images into //components.

Bug: 1023811
Change-Id: Ib3dedd7fb7a901bd1a393fac5f39b370c536046e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2250920Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779934}
parent 0f572485
......@@ -750,8 +750,10 @@ repack("repack_100_percent") {
"$root_gen_dir/content/app/resources/content_resources_100_percent.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_100_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
"$target_gen_dir/components_resources_100_percent.pak",
]
deps = [
":generate_components_scaled_resources",
"//content/app/resources",
"//third_party/blink/public:scaled_resources_100_percent",
"//ui/resources",
......@@ -965,6 +967,29 @@ grit("generate_components_resources") {
]
}
grit("generate_components_scaled_resources") {
source = "../components/resources/components_scaled_resources.grd"
# See :generate_webui_resources for an explanation of the allowlist
_allowlist = rebase_path("$target_gen_dir/grit_resources_allowlist.txt",
root_build_dir)
grit_flags = [
"-w",
_allowlist,
]
outputs = [
"grit/components_scaled_resources.h",
"grit/components_scaled_resources_map.cc",
"grit/components_scaled_resources_map.h",
"components_resources_100_percent.pak",
"components_resources_200_percent.pak",
"components_resources_300_percent.pak",
]
deps = [ ":concatenate_resources_allowlists" ]
}
grit("generate_components_strings") {
source = "../components/components_strings.grd"
......
......@@ -82,6 +82,7 @@
#include "components/dom_distiller/core/url_constants.h"
#include "components/error_page/common/error.h"
#include "components/error_page/common/localized_error.h"
#include "components/grit/components_scaled_resources.h"
#include "components/network_hints/renderer/web_prescient_networking_impl.h"
#include "components/page_load_metrics/renderer/metrics_render_frame_observer.h"
#include "components/paint_preview/buildflags/buildflags.h"
......
......@@ -9,10 +9,6 @@
<output filename="renderer_resources_300_percent.pak" type="data_package" context="default_300_percent" />
</outputs>
<release seq="1">
<structures fallback_to_low_resolution="true">
<structure type="chrome_scaled_image" name="IDR_SAD_WEBVIEW" file="common\webview-crash.png" />
<structure type="chrome_scaled_image" name="IDR_SAD_PLUGIN" file="common\sadplugin.png" />
</structures>
<includes>
<include name="IDR_BLOCKED_PLUGIN_HTML" file="plugins/blocked_plugin.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_DISABLED_PLUGIN_HTML" file="plugins/disabled_plugin.html" flattenhtml="true" type="BINDATA" />
......
......@@ -21,6 +21,8 @@
<!-- Generic resources -->
<structure type="chrome_scaled_image" name="IDR_HISTORY_FAVICON" file="favicon_history.png" />
<structure type="chrome_scaled_image" name="IDR_SAD_WEBVIEW" file="webview-crash.png" />
<structure type="chrome_scaled_image" name="IDR_SAD_PLUGIN" file="sadplugin.png" />
</structures>
</release>
</grit>
IDR_SAD_PLUGIN
IDR_SAD_WEBVIEW
IDR_TRANSLATE_JS
......@@ -4,6 +4,7 @@ include_rules = [
"+components/cdm/renderer",
"+components/content_settings/renderer",
"+components/error_page/common",
"+components/grit",
"+components/page_load_metrics/renderer",
"+components/safe_browsing/content/common",
"+components/safe_browsing/content/renderer",
......
......@@ -10,10 +10,12 @@
#include "components/autofill/content/renderer/password_autofill_agent.h"
#include "components/content_settings/renderer/content_settings_agent_impl.h"
#include "components/error_page/common/error.h"
#include "components/grit/components_scaled_resources.h"
#include "components/js_injection/renderer/js_communication.h"
#include "components/page_load_metrics/renderer/metrics_render_frame_observer.h"
#include "content/public/renderer/render_thread.h"
#include "third_party/blink/public/platform/platform.h"
#include "ui/base/resource/resource_bundle.h"
#include "weblayer/common/features.h"
#include "weblayer/renderer/error_page_helper.h"
#include "weblayer/renderer/weblayer_render_frame_observer.h"
......@@ -106,6 +108,18 @@ void ContentRendererClientImpl::RenderFrameCreated(
new js_injection::JsCommunication(render_frame);
}
SkBitmap* ContentRendererClientImpl::GetSadPluginBitmap() {
return const_cast<SkBitmap*>(ui::ResourceBundle::GetSharedInstance()
.GetImageNamed(IDR_SAD_PLUGIN)
.ToSkBitmap());
}
SkBitmap* ContentRendererClientImpl::GetSadWebViewBitmap() {
return const_cast<SkBitmap*>(ui::ResourceBundle::GetSharedInstance()
.GetImageNamed(IDR_SAD_WEBVIEW)
.ToSkBitmap());
}
bool ContentRendererClientImpl::HasErrorPage(int http_status_code) {
return http_status_code >= 400;
}
......
......@@ -27,6 +27,8 @@ class ContentRendererClientImpl : public content::ContentRendererClient {
// content::ContentRendererClient:
void RenderThreadStarted() override;
void RenderFrameCreated(content::RenderFrame* render_frame) override;
SkBitmap* GetSadPluginBitmap() override;
SkBitmap* GetSadWebViewBitmap() override;
bool HasErrorPage(int http_status_code) override;
bool ShouldSuppressErrorPage(content::RenderFrame* render_frame,
const GURL& url,
......
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