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

Side by Side Diff: content/renderer/pepper/plugin_power_saver_helper.cc

Issue 1088763002: Plugin Power Saver: Add comprehensive browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0260-plugins-overhaul-prerender-tests
Patch Set: Created 5 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/renderer/pepper/plugin_power_saver_helper.h" 5 #include "content/renderer/pepper/plugin_power_saver_helper.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "content/common/frame_messages.h" 9 #include "content/common/frame_messages.h"
10 #include "content/public/common/content_constants.h" 10 #include "content/public/common/content_constants.h"
11 #include "content/public/renderer/render_frame.h" 11 #include "content/public/renderer/render_frame.h"
12 #include "content/public/test/ppapi_test_utils.h"
13 #include "ppapi/shared_impl/ppapi_constants.h"
12 #include "third_party/WebKit/public/web/WebDocument.h" 14 #include "third_party/WebKit/public/web/WebDocument.h"
13 #include "third_party/WebKit/public/web/WebLocalFrame.h" 15 #include "third_party/WebKit/public/web/WebLocalFrame.h"
14 #include "third_party/WebKit/public/web/WebPluginParams.h" 16 #include "third_party/WebKit/public/web/WebPluginParams.h"
15 #include "third_party/WebKit/public/web/WebView.h" 17 #include "third_party/WebKit/public/web/WebView.h"
16 18
17 namespace content { 19 namespace content {
18 20
19 namespace { 21 namespace {
20 22
21 // Initial decision of the peripheral content decision. 23 // Initial decision of the peripheral content decision.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 const GURL& content_origin, 116 const GURL& content_origin,
115 const std::string& plugin_module_name, 117 const std::string& plugin_module_name,
116 int width, 118 int width,
117 int height, 119 int height,
118 bool* cross_origin_main_content) const { 120 bool* cross_origin_main_content) const {
119 DCHECK_EQ(content_origin.GetOrigin(), content_origin); 121 DCHECK_EQ(content_origin.GetOrigin(), content_origin);
120 if (cross_origin_main_content) 122 if (cross_origin_main_content)
121 *cross_origin_main_content = false; 123 *cross_origin_main_content = false;
122 124
123 // This feature has only been tested throughly with Flash thus far. 125 // This feature has only been tested throughly with Flash thus far.
124 if (plugin_module_name != content::kFlashPluginName) 126 // It is also enabled for the PPAPI test library for browser tests.
127 if (plugin_module_name != content::kFlashPluginName &&
128 plugin_module_name != ppapi::kPpapiTestLibraryName) {
125 return false; 129 return false;
130 }
126 131
127 if (width <= 0 || height <= 0) 132 if (width <= 0 || height <= 0)
128 return false; 133 return false;
129 134
130 // TODO(alexmos): Update this to use the origin of the RemoteFrame when 426512 135 // TODO(alexmos): Update this to use the origin of the RemoteFrame when 426512
131 // is fixed. For now, case 3 in the class level comment doesn't work in 136 // is fixed. For now, case 3 in the class level comment doesn't work in
132 // --site-per-process mode. 137 // --site-per-process mode.
133 blink::WebFrame* main_frame = 138 blink::WebFrame* main_frame =
134 render_frame()->GetWebFrame()->view()->mainFrame(); 139 render_frame()->GetWebFrame()->view()->mainFrame();
135 if (main_frame->isWebRemoteFrame()) { 140 if (main_frame->isWebRemoteFrame()) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 void PluginPowerSaverHelper::WhitelistContentOrigin( 178 void PluginPowerSaverHelper::WhitelistContentOrigin(
174 const GURL& content_origin) { 179 const GURL& content_origin) {
175 DCHECK_EQ(content_origin.GetOrigin(), content_origin); 180 DCHECK_EQ(content_origin.GetOrigin(), content_origin);
176 if (origin_whitelist_.insert(content_origin).second) { 181 if (origin_whitelist_.insert(content_origin).second) {
177 Send(new FrameHostMsg_PluginContentOriginAllowed( 182 Send(new FrameHostMsg_PluginContentOriginAllowed(
178 render_frame()->GetRoutingID(), content_origin)); 183 render_frame()->GetRoutingID(), content_origin));
179 } 184 }
180 } 185 }
181 186
182 } // namespace content 187 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698