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

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

Issue 680193002: Plugin Power Saver: Implement size-based heuristic for peripheral content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: spinoff ifdef changes into separate cl Created 6 years, 2 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 fe1f367c23944475d8f5c55c9d27af2e38867916..d7de21fb88d74f069d72ac0a16cfa2124e7bc0b8 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -498,6 +498,8 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
#if defined(ENABLE_PLUGINS)
IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung)
IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_PluginContentOriginAllowed,
+ OnPluginContentOriginAllowed)
#endif
IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse,
OnDomOperationResponse)
@@ -2576,6 +2578,12 @@ void WebContentsImpl::DidNavigateMainFramePostCommit(
// clear the bubble when a user navigates to a named anchor in the same
// page.
UpdateTargetURL(GURL());
+
+#if defined(ENABLE_PLUGINS)
+ // Clear the tab-wide origin whitelist. We expect RenderFrames to clear
+ // their replicated origin whitelist independently.
+ plugin_content_origin_whitelist_.clear();
+#endif
}
if (!details.is_in_page) {
@@ -2907,6 +2915,15 @@ void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path,
PluginCrashed(plugin_path, plugin_pid));
}
+void WebContentsImpl::OnPluginContentOriginAllowed(const GURL& content_origin) {
+ DCHECK(render_frame_message_source_);
+ DCHECK(!render_view_message_source_);
+
+ plugin_content_origin_whitelist_.insert(content_origin);
+
+ SendToAllFrames(new FrameMsg_UpdatePluginContentOriginWhitelist(
+ MSG_ROUTING_NONE, plugin_content_origin_whitelist_));
+}
#endif // defined(ENABLE_PLUGINS)
void WebContentsImpl::OnDomOperationResponse(const std::string& json_string,
@@ -3342,6 +3359,13 @@ void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) {
observers_,
RenderFrameCreated(render_frame_host));
SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host);
+
+#if defined(ENABLE_PLUGINS)
+ if (!plugin_content_origin_whitelist_.empty()) {
Charlie Reis 2014/10/30 22:13:16 This feels like it belongs in a WebContentsObserve
tommycli 2014/10/31 00:01:21 Done.
+ Send(new FrameMsg_UpdatePluginContentOriginWhitelist(
+ render_frame_host->GetRoutingID(), plugin_content_origin_whitelist_));
+ }
+#endif
}
void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) {

Powered by Google App Engine
This is Rietveld 408576698