Commit 53fe8fd8 authored by lukasza's avatar lukasza Committed by Commit Bot

Move *GetWebApplicationInfo IPCs from "view" to "frame".

This CL addresses a TODO from
chrome/renderer/chrome_render_view_observer.cc to associate
ChromeViewMsg_GetWebApplicationInfo and
ChromeViewHostMsg_DidGetWebApplicationInfo IPCs with frame, rather than
view.

This CL helps ensure that
ChromeRenderFrameObserver::OnGetWebApplicationInfo (formerly a method of
ChromeRender*View*Observer) always operates on a local frame (and
therefore this CL helps with moving GetDocument method from WebFrame to
WebLocalFrame in a follow-up CL - https://crrev.com/2928033002).

BUG=416660

Review-Url: https://codereview.chromium.org/2942583004
Cr-Commit-Position: refs/heads/master@{#481026}
parent f9af74e7
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "components/favicon_base/favicon_types.h" #include "components/favicon_base/favicon_types.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/manifest_icon_selector.h" #include "content/public/browser/manifest_icon_selector.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/common/manifest.h" #include "content/public/common/manifest.h"
...@@ -97,7 +98,9 @@ AddToHomescreenDataFetcher::AddToHomescreenDataFetcher( ...@@ -97,7 +98,9 @@ AddToHomescreenDataFetcher::AddToHomescreenDataFetcher(
DCHECK(minimum_splash_image_size_in_px <= ideal_splash_image_size_in_px); DCHECK(minimum_splash_image_size_in_px <= ideal_splash_image_size_in_px);
// Send a message to the renderer to retrieve information about the page. // Send a message to the renderer to retrieve information about the page.
Send(new ChromeViewMsg_GetWebApplicationInfo(routing_id())); content::RenderFrameHost* main_frame = web_contents->GetMainFrame();
main_frame->Send(
new ChromeFrameMsg_GetWebApplicationInfo(main_frame->GetRoutingID()));
} }
void AddToHomescreenDataFetcher::OnDidGetWebApplicationInfo( void AddToHomescreenDataFetcher::OnDidGetWebApplicationInfo(
...@@ -166,14 +169,15 @@ AddToHomescreenDataFetcher::~AddToHomescreenDataFetcher() { ...@@ -166,14 +169,15 @@ AddToHomescreenDataFetcher::~AddToHomescreenDataFetcher() {
} }
bool AddToHomescreenDataFetcher::OnMessageReceived( bool AddToHomescreenDataFetcher::OnMessageReceived(
const IPC::Message& message) { const IPC::Message& message,
content::RenderFrameHost* sender) {
if (!is_waiting_for_web_application_info_) if (!is_waiting_for_web_application_info_)
return false; return false;
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AddToHomescreenDataFetcher, message) IPC_BEGIN_MESSAGE_MAP(AddToHomescreenDataFetcher, message)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidGetWebApplicationInfo, IPC_MESSAGE_HANDLER(ChromeFrameHostMsg_DidGetWebApplicationInfo,
OnDidGetWebApplicationInfo) OnDidGetWebApplicationInfo)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP() IPC_END_MESSAGE_MAP()
......
...@@ -96,7 +96,8 @@ class AddToHomescreenDataFetcher ...@@ -96,7 +96,8 @@ class AddToHomescreenDataFetcher
~AddToHomescreenDataFetcher() override; ~AddToHomescreenDataFetcher() override;
// WebContentsObserver: // WebContentsObserver:
bool OnMessageReceived(const IPC::Message& message) override; bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* sender) override;
// Called if either InstallableManager or the favicon fetch takes too long. // Called if either InstallableManager or the favicon fetch takes too long.
void OnDataTimedout(); void OnDataTimedout();
......
...@@ -52,7 +52,7 @@ class TestBookmarkAppHelper : public BookmarkAppHelper { ...@@ -52,7 +52,7 @@ class TestBookmarkAppHelper : public BookmarkAppHelper {
DISALLOW_COPY_AND_ASSIGN(TestBookmarkAppHelper); DISALLOW_COPY_AND_ASSIGN(TestBookmarkAppHelper);
}; };
// Intercepts the ChromeViewHostMsg_DidGetWebApplicationInfo that would usually // Intercepts the ChromeFrameHostMsg_DidGetWebApplicationInfo that would usually
// get sent to extensions::TabHelper to create a BookmarkAppHelper that lets us // get sent to extensions::TabHelper to create a BookmarkAppHelper that lets us
// detect when icons are downloaded and the dialog is ready to show. // detect when icons are downloaded and the dialog is ready to show.
class WebAppReadyMsgWatcher : public content::BrowserMessageFilter { class WebAppReadyMsgWatcher : public content::BrowserMessageFilter {
...@@ -96,14 +96,14 @@ class WebAppReadyMsgWatcher : public content::BrowserMessageFilter { ...@@ -96,14 +96,14 @@ class WebAppReadyMsgWatcher : public content::BrowserMessageFilter {
// BrowserMessageFilter: // BrowserMessageFilter:
void OverrideThreadForMessage(const IPC::Message& message, void OverrideThreadForMessage(const IPC::Message& message,
content::BrowserThread::ID* thread) override { content::BrowserThread::ID* thread) override {
if (message.type() == ChromeViewHostMsg_DidGetWebApplicationInfo::ID) if (message.type() == ChromeFrameHostMsg_DidGetWebApplicationInfo::ID)
*thread = content::BrowserThread::UI; *thread = content::BrowserThread::UI;
} }
bool OnMessageReceived(const IPC::Message& message) override { bool OnMessageReceived(const IPC::Message& message) override {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WebAppReadyMsgWatcher, message) IPC_BEGIN_MESSAGE_MAP(WebAppReadyMsgWatcher, message)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidGetWebApplicationInfo, IPC_MESSAGE_HANDLER(ChromeFrameHostMsg_DidGetWebApplicationInfo,
OnDidGetWebApplicationInfo) OnDidGetWebApplicationInfo)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP() IPC_END_MESSAGE_MAP()
......
...@@ -332,20 +332,12 @@ void TabHelper::DidFinishNavigation( ...@@ -332,20 +332,12 @@ void TabHelper::DidFinishNavigation(
ExtensionActionAPI::Get(context)->ClearAllValuesForTab(web_contents()); ExtensionActionAPI::Get(context)->ClearAllValuesForTab(web_contents());
} }
bool TabHelper::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(TabHelper, message)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidGetWebApplicationInfo,
OnDidGetWebApplicationInfo)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
bool TabHelper::OnMessageReceived(const IPC::Message& message, bool TabHelper::OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* render_frame_host) { content::RenderFrameHost* sender) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(TabHelper, message, render_frame_host) IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(TabHelper, message, sender)
IPC_MESSAGE_HANDLER(ChromeFrameHostMsg_DidGetWebApplicationInfo,
OnDidGetWebApplicationInfo)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppInstallState, IPC_MESSAGE_HANDLER(ExtensionHostMsg_GetAppInstallState,
OnGetAppInstallState) OnGetAppInstallState)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_ContentScriptsExecuting, IPC_MESSAGE_HANDLER(ExtensionHostMsg_ContentScriptsExecuting,
...@@ -366,7 +358,8 @@ void TabHelper::DidCloneToNewWebContents(WebContents* old_web_contents, ...@@ -366,7 +358,8 @@ void TabHelper::DidCloneToNewWebContents(WebContents* old_web_contents,
new_helper->extension_app_icon_ = extension_app_icon_; new_helper->extension_app_icon_ = extension_app_icon_;
} }
void TabHelper::OnDidGetWebApplicationInfo(const WebApplicationInfo& info) { void TabHelper::OnDidGetWebApplicationInfo(content::RenderFrameHost* sender,
const WebApplicationInfo& info) {
web_app_info_ = info; web_app_info_ = info;
NavigationEntry* entry = NavigationEntry* entry =
...@@ -624,7 +617,9 @@ void TabHelper::GetApplicationInfo(WebAppAction action) { ...@@ -624,7 +617,9 @@ void TabHelper::GetApplicationInfo(WebAppAction action) {
pending_web_app_action_ = action; pending_web_app_action_ = action;
last_committed_nav_entry_unique_id_ = entry->GetUniqueID(); last_committed_nav_entry_unique_id_ = entry->GetUniqueID();
Send(new ChromeViewMsg_GetWebApplicationInfo(routing_id())); content::RenderFrameHost* main_frame = web_contents()->GetMainFrame();
main_frame->Send(
new ChromeFrameMsg_GetWebApplicationInfo(main_frame->GetRoutingID()));
} }
void TabHelper::Observe(int type, void TabHelper::Observe(int type,
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
#include "extensions/common/stack_frame.h" #include "extensions/common/stack_frame.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
namespace content {
class RenderFrameHost;
}
namespace gfx { namespace gfx {
class Image; class Image;
} }
...@@ -142,9 +146,8 @@ class TabHelper : public content::WebContentsObserver, ...@@ -142,9 +146,8 @@ class TabHelper : public content::WebContentsObserver,
void RenderFrameCreated(content::RenderFrameHost* host) override; void RenderFrameCreated(content::RenderFrameHost* host) override;
void DidFinishNavigation( void DidFinishNavigation(
content::NavigationHandle* navigation_handle) override; content::NavigationHandle* navigation_handle) override;
bool OnMessageReceived(const IPC::Message& message) override;
bool OnMessageReceived(const IPC::Message& message, bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* render_frame_host) override; content::RenderFrameHost* sender) override;
void DidCloneToNewWebContents( void DidCloneToNewWebContents(
content::WebContents* old_web_contents, content::WebContents* old_web_contents,
content::WebContents* new_web_contents) override; content::WebContents* new_web_contents) override;
...@@ -166,7 +169,8 @@ class TabHelper : public content::WebContentsObserver, ...@@ -166,7 +169,8 @@ class TabHelper : public content::WebContentsObserver,
DoInlineInstallCallback callback) override; DoInlineInstallCallback callback) override;
// Message handlers. // Message handlers.
void OnDidGetWebApplicationInfo(const WebApplicationInfo& info); void OnDidGetWebApplicationInfo(content::RenderFrameHost* sender,
const WebApplicationInfo& info);
void OnGetAppInstallState(content::RenderFrameHost* host, void OnGetAppInstallState(content::RenderFrameHost* host,
const GURL& requestor_url, const GURL& requestor_url,
int return_route_id, int return_route_id,
......
...@@ -46,8 +46,9 @@ TEST_F(WebApplicationTest, GetShortcutInfoForTab) { ...@@ -46,8 +46,9 @@ TEST_F(WebApplicationTest, GetShortcutInfoForTab) {
content::RenderFrameHostTester::For(main_rfh()) content::RenderFrameHostTester::For(main_rfh())
->InitializeRenderFrameIfNeeded(); ->InitializeRenderFrameIfNeeded();
RenderViewHostTester::TestOnMessageReceived( content::RenderFrameHostTester::TestOnMessageReceived(
rvh(), ChromeViewHostMsg_DidGetWebApplicationInfo(0, web_app_info)); rvh()->GetMainFrame(),
ChromeFrameHostMsg_DidGetWebApplicationInfo(0, web_app_info));
std::unique_ptr<web_app::ShortcutInfo> info = std::unique_ptr<web_app::ShortcutInfo> info =
web_app::GetShortcutInfoForTab(web_contents()); web_app::GetShortcutInfoForTab(web_contents());
......
...@@ -146,9 +146,9 @@ IPC_MESSAGE_ROUTED3(ChromeViewMsg_UpdateBrowserControlsState, ...@@ -146,9 +146,9 @@ IPC_MESSAGE_ROUTED3(ChromeViewMsg_UpdateBrowserControlsState,
IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetWindowFeatures, IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetWindowFeatures,
blink::mojom::WindowFeatures /* window_features */) blink::mojom::WindowFeatures /* window_features */)
// Requests application info for the page. The renderer responds back with // Requests application info for the frame. The renderer responds back with
// ChromeViewHostMsg_DidGetWebApplicationInfo. // ChromeFrameHostMsg_DidGetWebApplicationInfo.
IPC_MESSAGE_ROUTED0(ChromeViewMsg_GetWebApplicationInfo) IPC_MESSAGE_ROUTED0(ChromeFrameMsg_GetWebApplicationInfo)
// chrome.principals messages ------------------------------------------------ // chrome.principals messages ------------------------------------------------
...@@ -327,7 +327,7 @@ IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_BlockedUnauthorizedPlugin, ...@@ -327,7 +327,7 @@ IPC_MESSAGE_ROUTED2(ChromeViewHostMsg_BlockedUnauthorizedPlugin,
// a secure page by a security policy. The page may appear incomplete. // a secure page by a security policy. The page may appear incomplete.
IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_DidBlockDisplayingInsecureContent) IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_DidBlockDisplayingInsecureContent)
IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_DidGetWebApplicationInfo, IPC_MESSAGE_ROUTED1(ChromeFrameHostMsg_DidGetWebApplicationInfo,
WebApplicationInfo) WebApplicationInfo)
// Tells the renderer a list of URLs which should be bounced back to the browser // Tells the renderer a list of URLs which should be bounced back to the browser
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_isolated_world_ids.h" #include "chrome/common/chrome_isolated_world_ids.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/crash_keys.h" #include "chrome/common/crash_keys.h"
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
#include "chrome/common/render_messages.h" #include "chrome/common/render_messages.h"
#include "chrome/renderer/prerender/prerender_helper.h" #include "chrome/renderer/prerender/prerender_helper.h"
#include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
#include "chrome/renderer/web_apps.h"
#include "components/translate/content/renderer/translate_helper.h" #include "components/translate/content/renderer/translate_helper.h"
#include "content/public/common/associated_interface_provider.h" #include "content/public/common/associated_interface_provider.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
...@@ -149,6 +151,8 @@ bool ChromeRenderFrameObserver::OnMessageReceived(const IPC::Message& message) { ...@@ -149,6 +151,8 @@ bool ChromeRenderFrameObserver::OnMessageReceived(const IPC::Message& message) {
return false; return false;
IPC_BEGIN_MESSAGE_MAP(ChromeRenderFrameObserver, message) IPC_BEGIN_MESSAGE_MAP(ChromeRenderFrameObserver, message)
IPC_MESSAGE_HANDLER(ChromeFrameMsg_GetWebApplicationInfo,
OnGetWebApplicationInfo)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection, IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection,
OnSetClientSidePhishingDetection) OnSetClientSidePhishingDetection)
#if BUILDFLAG(ENABLE_PRINTING) #if BUILDFLAG(ENABLE_PRINTING)
...@@ -231,6 +235,47 @@ void ChromeRenderFrameObserver::OnPrintNodeUnderContextMenu() { ...@@ -231,6 +235,47 @@ void ChromeRenderFrameObserver::OnPrintNodeUnderContextMenu() {
#endif #endif
} }
void ChromeRenderFrameObserver::OnGetWebApplicationInfo() {
WebLocalFrame* frame = render_frame()->GetWebFrame();
WebApplicationInfo web_app_info;
web_apps::ParseWebAppFromWebDocument(frame, &web_app_info);
// The warning below is specific to mobile but it doesn't hurt to show it even
// if the Chromium build is running on a desktop. It will get more exposition.
if (web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_APPLE) {
blink::WebConsoleMessage message(
blink::WebConsoleMessage::kLevelWarning,
"<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"> is "
"deprecated. Please include <meta name=\"mobile-web-app-capable\" "
"content=\"yes\"> - "
"http://developers.google.com/chrome/mobile/docs/installtohomescreen");
frame->AddMessageToConsole(message);
}
// Prune out any data URLs in the set of icons. The browser process expects
// any icon with a data URL to have originated from a favicon. We don't want
// to decode arbitrary data URLs in the browser process. See
// http://b/issue?id=1162972
for (std::vector<WebApplicationInfo::IconInfo>::iterator it =
web_app_info.icons.begin();
it != web_app_info.icons.end();) {
if (it->url.SchemeIs(url::kDataScheme))
it = web_app_info.icons.erase(it);
else
++it;
}
// Truncate the strings we send to the browser process.
web_app_info.title =
web_app_info.title.substr(0, chrome::kMaxMetaTagAttributeLength);
web_app_info.description =
web_app_info.description.substr(0, chrome::kMaxMetaTagAttributeLength);
Send(new ChromeFrameHostMsg_DidGetWebApplicationInfo(routing_id(),
web_app_info));
}
void ChromeRenderFrameObserver::OnSetClientSidePhishingDetection( void ChromeRenderFrameObserver::OnSetClientSidePhishingDetection(
bool enable_phishing_detection) { bool enable_phishing_detection) {
#if defined(SAFE_BROWSING_CSD) #if defined(SAFE_BROWSING_CSD)
......
...@@ -66,6 +66,7 @@ class ChromeRenderFrameObserver ...@@ -66,6 +66,7 @@ class ChromeRenderFrameObserver
chrome::mojom::ThumbnailCapturerRequest request); chrome::mojom::ThumbnailCapturerRequest request);
// IPC handlers // IPC handlers
void OnGetWebApplicationInfo();
void OnSetIsPrerendering(prerender::PrerenderMode mode); void OnSetIsPrerendering(prerender::PrerenderMode mode);
void OnRequestThumbnailForContextNode( void OnRequestThumbnailForContextNode(
int thumbnail_min_area_pixels, int thumbnail_min_area_pixels,
......
...@@ -16,12 +16,10 @@ ...@@ -16,12 +16,10 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/crash_keys.h" #include "chrome/common/crash_keys.h"
#include "chrome/common/render_messages.h" #include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "chrome/renderer/prerender/prerender_helper.h" #include "chrome/renderer/prerender/prerender_helper.h"
#include "chrome/renderer/web_apps.h"
#include "components/web_cache/renderer/web_cache_impl.h" #include "components/web_cache/renderer/web_cache_impl.h"
#include "content/public/common/bindings_policy.h" #include "content/public/common/bindings_policy.h"
#include "content/public/renderer/content_renderer_client.h" #include "content/public/renderer/content_renderer_client.h"
...@@ -61,8 +59,6 @@ bool ChromeRenderViewObserver::OnMessageReceived(const IPC::Message& message) { ...@@ -61,8 +59,6 @@ bool ChromeRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ChromeViewMsg_UpdateBrowserControlsState, IPC_MESSAGE_HANDLER(ChromeViewMsg_UpdateBrowserControlsState,
OnUpdateBrowserControlsState) OnUpdateBrowserControlsState)
#endif #endif
IPC_MESSAGE_HANDLER(ChromeViewMsg_GetWebApplicationInfo,
OnGetWebApplicationInfo)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetWindowFeatures, OnSetWindowFeatures) IPC_MESSAGE_HANDLER(ChromeViewMsg_SetWindowFeatures, OnSetWindowFeatures)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP() IPC_END_MESSAGE_MAP()
...@@ -86,50 +82,6 @@ void ChromeRenderViewObserver::OnUpdateBrowserControlsState( ...@@ -86,50 +82,6 @@ void ChromeRenderViewObserver::OnUpdateBrowserControlsState(
} }
#endif #endif
void ChromeRenderViewObserver::OnGetWebApplicationInfo() {
WebFrame* main_frame = render_view()->GetWebView()->MainFrame();
DCHECK(main_frame);
WebApplicationInfo web_app_info;
web_apps::ParseWebAppFromWebDocument(main_frame, &web_app_info);
// The warning below is specific to mobile but it doesn't hurt to show it even
// if the Chromium build is running on a desktop. It will get more exposition.
// TODO(mlamouri): Associate this message with an actual frame, to avoid the
// need to check whether or not the main frame is local.
if (web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_APPLE &&
main_frame->IsWebLocalFrame()) {
blink::WebConsoleMessage message(
blink::WebConsoleMessage::kLevelWarning,
"<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"> is "
"deprecated. Please include <meta name=\"mobile-web-app-capable\" "
"content=\"yes\"> - "
"http://developers.google.com/chrome/mobile/docs/installtohomescreen");
main_frame->ToWebLocalFrame()->AddMessageToConsole(message);
}
// Prune out any data URLs in the set of icons. The browser process expects
// any icon with a data URL to have originated from a favicon. We don't want
// to decode arbitrary data URLs in the browser process. See
// http://b/issue?id=1162972
for (std::vector<WebApplicationInfo::IconInfo>::iterator it =
web_app_info.icons.begin(); it != web_app_info.icons.end();) {
if (it->url.SchemeIs(url::kDataScheme))
it = web_app_info.icons.erase(it);
else
++it;
}
// Truncate the strings we send to the browser process.
web_app_info.title =
web_app_info.title.substr(0, chrome::kMaxMetaTagAttributeLength);
web_app_info.description =
web_app_info.description.substr(0, chrome::kMaxMetaTagAttributeLength);
Send(new ChromeViewHostMsg_DidGetWebApplicationInfo(
routing_id(), web_app_info));
}
void ChromeRenderViewObserver::OnSetWindowFeatures( void ChromeRenderViewObserver::OnSetWindowFeatures(
const blink::mojom::WindowFeatures& window_features) { const blink::mojom::WindowFeatures& window_features) {
render_view()->GetWebView()->SetWindowFeatures( render_view()->GetWebView()->SetWindowFeatures(
......
...@@ -48,7 +48,6 @@ class ChromeRenderViewObserver : public content::RenderViewObserver { ...@@ -48,7 +48,6 @@ class ChromeRenderViewObserver : public content::RenderViewObserver {
content::BrowserControlsState current, content::BrowserControlsState current,
bool animate); bool animate);
#endif #endif
void OnGetWebApplicationInfo();
void OnSetWindowFeatures(const blink::mojom::WindowFeatures& window_features); void OnSetWindowFeatures(const blink::mojom::WindowFeatures& window_features);
// Determines if a host is in the strict security host set. // Determines if a host is in the strict security host set.
......
...@@ -58,6 +58,12 @@ RenderFrameHostTester* RenderFrameHostTester::For(RenderFrameHost* host) { ...@@ -58,6 +58,12 @@ RenderFrameHostTester* RenderFrameHostTester::For(RenderFrameHost* host) {
return static_cast<TestRenderFrameHost*>(host); return static_cast<TestRenderFrameHost*>(host);
} }
// static
bool RenderFrameHostTester::TestOnMessageReceived(RenderFrameHost* rfh,
const IPC::Message& msg) {
return static_cast<RenderFrameHostImpl*>(rfh)->OnMessageReceived(msg);
}
// static // static
void RenderFrameHostTester::CommitPendingLoad( void RenderFrameHostTester::CommitPendingLoad(
NavigationController* controller) { NavigationController* controller) {
......
...@@ -58,6 +58,11 @@ class RenderFrameHostTester { ...@@ -58,6 +58,11 @@ class RenderFrameHostTester {
// RenderViewHostTestEnabler instance (see below) to do this. // RenderViewHostTestEnabler instance (see below) to do this.
static RenderFrameHostTester* For(RenderFrameHost* host); static RenderFrameHostTester* For(RenderFrameHost* host);
// Calls the RenderFrameHost's private OnMessageReceived function with the
// given message.
static bool TestOnMessageReceived(RenderFrameHost* rfh,
const IPC::Message& msg);
static void CommitPendingLoad(NavigationController* controller); static void CommitPendingLoad(NavigationController* controller);
virtual ~RenderFrameHostTester() {} virtual ~RenderFrameHostTester() {}
......
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