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

Unified Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 669703003: Plugin Power Saver: Restrict Power Saver to cross-origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/renderer/pepper/pepper_plugin_instance_impl.cc
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index 97a85c90f253966dd8e964bd7232cfe7d199e90f..bb5788fe2e499671aea8a9195dda734371b9159c 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -395,7 +395,8 @@ PepperPluginInstanceImpl* PepperPluginInstanceImpl::Create(
RenderFrameImpl* render_frame,
PluginModule* module,
WebPluginContainer* container,
- const GURL& plugin_url) {
+ const GURL& plugin_url,
+ const GURL& top_frame_url) {
base::Callback<const void*(const char*)> get_plugin_interface_func =
base::Bind(&PluginModule::GetPluginInterface, module);
PPP_Instance_Combined* ppp_instance_combined =
@@ -407,7 +408,8 @@ PepperPluginInstanceImpl* PepperPluginInstanceImpl::Create(
module,
ppp_instance_combined,
container,
- plugin_url);
+ plugin_url,
+ top_frame_url);
}
PepperPluginInstanceImpl::ExternalDocumentLoader::ExternalDocumentLoader()
@@ -478,7 +480,8 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl(
PluginModule* module,
ppapi::PPP_Instance_Combined* instance_interface,
WebPluginContainer* container,
- const GURL& plugin_url)
+ const GURL& plugin_url,
+ const GURL& top_frame_url)
: RenderFrameObserver(render_frame),
render_frame_(render_frame),
module_(module),
@@ -591,7 +594,8 @@ PepperPluginInstanceImpl::PepperPluginInstanceImpl(
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePluginPowerSaver);
- if (power_saver_enabled_) {
+ if (power_saver_enabled_ &&
+ plugin_url.GetOrigin() != top_frame_url.GetOrigin()) {
throttler_.reset(new PepperPluginInstanceThrottler(
base::Bind(&PepperPluginInstanceImpl::SetPluginThrottled,
weak_factory_.GetWeakPtr(), true /* throttled */)));

Powered by Google App Engine
This is Rietveld 408576698