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

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: change mechanism to look at top level navigation instead of renderframe lifecycle 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 4ce4f972db0f278193541181710e527129cdb364..e1113049d3a5c7d8a84d5f80da1c5ffa40a7c9e2 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -493,6 +493,8 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
IPC_BEGIN_MESSAGE_MAP(WebContentsImpl, message)
IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung)
IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_PluginContentOriginAllowed,
+ OnPluginContentOriginAllowed)
IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse,
OnDomOperationResponse)
IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeThemeColor,
@@ -2568,6 +2570,10 @@ void WebContentsImpl::DidNavigateMainFramePostCommit(
// clear the bubble when a user navigates to a named anchor in the same
// page.
UpdateTargetURL(GURL());
+
+ // Clear the tab-wide origin whitelist. We expect RenderFrames to clear
+ // their replicated origin whitelist independently.
+ plugin_content_origin_whitelist_.clear();
}
if (!details.is_in_page) {
@@ -2899,6 +2905,16 @@ 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_));
+}
+
void WebContentsImpl::OnDomOperationResponse(const std::string& json_string,
int automation_id) {
DomOperationNotificationDetails details(json_string, automation_id);
@@ -3332,10 +3348,16 @@ void WebContentsImpl::RenderFrameCreated(RenderFrameHost* render_frame_host) {
observers_,
RenderFrameCreated(render_frame_host));
SetAccessibilityModeOnFrame(accessibility_mode_, render_frame_host);
+
+ if (!plugin_content_origin_whitelist_.empty()) {
+ Send(new FrameMsg_UpdatePluginContentOriginWhitelist(
+ render_frame_host->GetRoutingID(), plugin_content_origin_whitelist_));
+ }
}
void WebContentsImpl::RenderFrameDeleted(RenderFrameHost* render_frame_host) {
ClearPowerSaveBlockers(render_frame_host);
+
FOR_EACH_OBSERVER(WebContentsObserver,
observers_,
RenderFrameDeleted(render_frame_host));

Powered by Google App Engine
This is Rietveld 408576698