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

Side by Side Diff: chrome/renderer/plugins/power_saver_info.cc

Issue 2627493002: [PPS] Exclude same-origin tiny plugins. (Closed)
Patch Set: fix test Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/renderer/plugins/power_saver_info.h" 10 #include "chrome/renderer/plugins/power_saver_info.h"
11 #include "content/public/common/content_constants.h" 11 #include "content/public/common/content_constants.h"
12 #include "content/public/common/content_features.h"
12 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
13 #include "content/public/common/webplugininfo.h" 14 #include "content/public/common/webplugininfo.h"
14 #include "content/public/renderer/render_frame.h" 15 #include "content/public/renderer/render_frame.h"
15 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 16 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
16 #include "third_party/WebKit/public/web/WebLocalFrame.h" 17 #include "third_party/WebKit/public/web/WebLocalFrame.h"
17 #include "third_party/WebKit/public/web/WebPluginParams.h" 18 #include "third_party/WebKit/public/web/WebPluginParams.h"
18 #include "url/origin.h" 19 #include "url/origin.h"
19 20
20 namespace { 21 namespace {
21 22
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 info.blocked_for_background_tab = render_frame->IsHidden(); 101 info.blocked_for_background_tab = render_frame->IsHidden();
101 102
102 auto status = render_frame->GetPeripheralContentStatus( 103 auto status = render_frame->GetPeripheralContentStatus(
103 render_frame->GetWebFrame()->top()->getSecurityOrigin(), 104 render_frame->GetWebFrame()->top()->getSecurityOrigin(),
104 url::Origin(params.url), gfx::Size(), 105 url::Origin(params.url), gfx::Size(),
105 content::RenderFrame::RECORD_DECISION); 106 content::RenderFrame::RECORD_DECISION);
106 107
107 // Early-exit from the whole Power Saver system if the content is 108 // Early-exit from the whole Power Saver system if the content is
108 // same-origin or whitelisted-origin. We ignore the other possibilities, 109 // same-origin or whitelisted-origin. We ignore the other possibilities,
109 // because we don't know the unobscured size of the plugin content yet. 110 // because we don't know the unobscured size of the plugin content yet.
111 // If we are filtering same-origin tiny content, we cannot early exit here.
110 // 112 //
111 // Once the plugin is loaded, the peripheral content status is re-tested 113 // Once the plugin is loaded, the peripheral content status is re-tested
112 // with the actual unobscured plugin size. 114 // with the actual unobscured plugin size.
113 if (status == content::RenderFrame::CONTENT_STATUS_ESSENTIAL_SAME_ORIGIN || 115 if (!base::FeatureList::IsEnabled(features::kFilterSameOriginTinyPlugin) &&
114 status == content::RenderFrame:: 116 (status == content::RenderFrame::CONTENT_STATUS_ESSENTIAL_SAME_ORIGIN ||
115 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_WHITELISTED) { 117 status == content::RenderFrame::
118 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_WHITELISTED)) {
116 info.power_saver_enabled = false; 119 info.power_saver_enabled = false;
117 } else { 120 } else {
118 info.poster_attribute = GetPluginInstancePosterAttribute(params); 121 info.poster_attribute = GetPluginInstancePosterAttribute(params);
119 info.base_url = document_url; 122 info.base_url = document_url;
120 } 123 }
121 } 124 }
122 125
123 if (is_flash) 126 if (is_flash)
124 TrackPosterParamPresence(params, info.power_saver_enabled); 127 TrackPosterParamPresence(params, info.power_saver_enabled);
125 128
126 return info; 129 return info;
127 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698