OLD | NEW |
---|---|
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 <string> | |
8 | |
7 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
9 #include "content/common/frame_messages.h" | 11 #include "content/common/frame_messages.h" |
10 #include "content/public/common/content_constants.h" | 12 #include "content/public/common/content_constants.h" |
11 #include "content/public/renderer/render_frame.h" | 13 #include "content/public/renderer/render_frame.h" |
12 #include "ppapi/shared_impl/ppapi_constants.h" | 14 #include "ppapi/shared_impl/ppapi_constants.h" |
13 #include "third_party/WebKit/public/web/WebDocument.h" | 15 #include "third_party/WebKit/public/web/WebDocument.h" |
14 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 16 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
15 #include "third_party/WebKit/public/web/WebPluginParams.h" | 17 #include "third_party/WebKit/public/web/WebPluginParams.h" |
16 #include "third_party/WebKit/public/web/WebView.h" | 18 #include "third_party/WebKit/public/web/WebView.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 bool PluginPowerSaverHelper::ShouldThrottleContent( | 116 bool PluginPowerSaverHelper::ShouldThrottleContent( |
115 const GURL& content_origin, | 117 const GURL& content_origin, |
116 const std::string& plugin_module_name, | 118 const std::string& plugin_module_name, |
117 int width, | 119 int width, |
118 int height, | 120 int height, |
119 bool* cross_origin_main_content) const { | 121 bool* cross_origin_main_content) const { |
120 DCHECK_EQ(content_origin.GetOrigin(), content_origin); | 122 DCHECK_EQ(content_origin.GetOrigin(), content_origin); |
121 if (cross_origin_main_content) | 123 if (cross_origin_main_content) |
122 *cross_origin_main_content = false; | 124 *cross_origin_main_content = false; |
123 | 125 |
126 if (plugin_module_name == content::kAlwaysThrottleTestPluginName) | |
jam
2015/05/18 15:44:04
we shouldn't have knowledge of this test plugin na
| |
127 return true; | |
128 | |
124 // This feature has only been tested throughly with Flash thus far. | 129 // This feature has only been tested throughly with Flash thus far. |
125 // It is also enabled for the Power Saver test plugin for browser tests. | 130 // It is also enabled for the Power Saver test plugin for browser tests. |
126 if (plugin_module_name != content::kFlashPluginName && | 131 if (plugin_module_name != content::kFlashPluginName && |
127 plugin_module_name != ppapi::kPowerSaverTestPluginName) { | 132 plugin_module_name != ppapi::kPowerSaverTestPluginName) { |
128 return false; | 133 return false; |
129 } | 134 } |
130 | 135 |
131 if (width <= 0 || height <= 0) | 136 if (width <= 0 || height <= 0) |
132 return false; | 137 return false; |
133 | 138 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 void PluginPowerSaverHelper::WhitelistContentOrigin( | 182 void PluginPowerSaverHelper::WhitelistContentOrigin( |
178 const GURL& content_origin) { | 183 const GURL& content_origin) { |
179 DCHECK_EQ(content_origin.GetOrigin(), content_origin); | 184 DCHECK_EQ(content_origin.GetOrigin(), content_origin); |
180 if (origin_whitelist_.insert(content_origin).second) { | 185 if (origin_whitelist_.insert(content_origin).second) { |
181 Send(new FrameHostMsg_PluginContentOriginAllowed( | 186 Send(new FrameHostMsg_PluginContentOriginAllowed( |
182 render_frame()->GetRoutingID(), content_origin)); | 187 render_frame()->GetRoutingID(), content_origin)); |
183 } | 188 } |
184 } | 189 } |
185 | 190 |
186 } // namespace content | 191 } // namespace content |
OLD | NEW |