Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 910073003: <webview>: Make contentWindow available prior to attachment (on display:none). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use constants Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 7d3766006456ddf20376ef8faee2abcfb4eae3a1..461822d1602dba0940e9e6c5c8db5e171164e7d8 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3147,13 +3147,7 @@ void WebContentsImpl::OnPpapiBrokerPermissionResult(int routing_id,
void WebContentsImpl::OnBrowserPluginMessage(RenderFrameHost* render_frame_host,
const IPC::Message& message) {
- // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin
- // specific messages for this WebContents. This means that any message from
- // a BrowserPlugin prior to this will be ignored.
- // For more info, see comment above classes BrowserPluginEmbedder and
- // BrowserPluginGuest.
- CHECK(!browser_plugin_embedder_.get());
Charlie Reis 2015/03/04 20:08:36 Why not keep this CHECK before the CreateBrowserPl
Fady Samuel 2015/03/05 20:56:23 Good point. If a BrowserPluginEmbedder already exi
- browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this));
+ CreateBrowserPluginEmbedderIfNecessary();
browser_plugin_embedder_->OnMessageReceived(message, render_frame_host);
}
#endif // defined(ENABLE_PLUGINS)
@@ -3988,8 +3982,9 @@ void WebContentsImpl::RouteMessageEvent(
// probably not a risk for apps since other pages won't have references
// to App windows.
if (!rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()) &&
- !GetBrowserPluginGuest() && !GetBrowserPluginEmbedder())
+ !GetBrowserPluginGuest() && !GetBrowserPluginEmbedder()) {
Charlie Reis 2015/03/04 20:08:36 This change isn't necessary, and it's not related
Fady Samuel 2015/03/05 20:56:23 Done.
return;
+ }
ViewMsg_PostMessage_Params new_params(params);
@@ -4443,6 +4438,12 @@ BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const {
return browser_plugin_embedder_.get();
}
+void WebContentsImpl::CreateBrowserPluginEmbedderIfNecessary() {
+ if (browser_plugin_embedder_)
+ return;
+ browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this));
+}
+
void WebContentsImpl::ClearPowerSaveBlockers(
RenderFrameHost* render_frame_host) {
RemoveAllMediaPlayerEntries(render_frame_host, &active_audio_players_);

Powered by Google App Engine
This is Rietveld 408576698