Chromium Code Reviews| 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 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 // PluginPluginPowerSaverHelper implementation. | 25 // PluginPluginPowerSaverHelper implementation. |
| 26 GURL GetPluginInstancePosterImage(const blink::WebPluginParams& params, | 26 GURL GetPluginInstancePosterImage(const blink::WebPluginParams& params, |
| 27 const GURL& base_url) const override; | 27 const GURL& base_url) const override; |
| 28 void RegisterPeripheralPlugin( | 28 void RegisterPeripheralPlugin( |
| 29 const GURL& content_origin, | 29 const GURL& content_origin, |
| 30 const base::Closure& unthrottle_callback) override; | 30 const base::Closure& unthrottle_callback) override; |
| 31 | 31 |
| 32 // Returns true if this plugin should have power saver enabled. | 32 // Returns true if this plugin should have power saver enabled. |
| 33 // | 33 // |
| 34 // Power Saver is enabled for plugin content that are cross-origin and | 34 // Power Saver is enabled for plugin content that are cross-origin and |
| 35 // heuristically determined to be not the "main attraction" of the webpage. | 35 // heuristically determined to be not essential to the web page content. |
| 36 // | 36 // |
| 37 // Plugin content is defined to be cross-origin when the plugin source's | 37 // Plugin content is defined to be cross-origin when the plugin source's |
| 38 // origin differs from the top level frame's origin. For example: | 38 // origin differs from the top level frame's origin. For example: |
| 39 // - Cross-origin: a.com -> b.com/plugin.swf | 39 // - Cross-origin: a.com -> b.com/plugin.swf |
| 40 // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf | 40 // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf |
| 41 // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf | 41 // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf |
| 42 // | 42 // |
| 43 // |cross_origin| may not be NULL. | 43 // |is_main_attraction| may be NULL. It is set to true if the plugin content |
| 44 // is cross-origin and determined to be the "main attraction" of the page. | |
|
groby-ooo-7-16
2014/12/03 00:57:27
Is there a reason why we can't handle the whitelis
tommycli
2014/12/03 19:34:12
Originally it handled the whitelisting within this
groby-ooo-7-16
2014/12/04 02:42:58
Let's take this out of this CL, but I don't like t
| |
| 44 virtual bool ShouldThrottleContent(const GURL& content_origin, | 45 virtual bool ShouldThrottleContent(const GURL& content_origin, |
| 45 int width, | 46 int width, |
| 46 int height, | 47 int height, |
| 47 bool* cross_origin) const; | 48 bool* is_main_attraction) const; |
|
groby-ooo-7-16
2014/12/03 00:57:27
You should probably rename it in plugin_power_save
tommycli
2014/12/03 19:34:12
This doesn't exist in the public interface due to
groby-ooo-7-16
2014/12/04 02:42:58
Ah - I'm still operating on outdated codesearch re
| |
| 48 | 49 |
| 49 virtual void WhitelistContentOrigin(const GURL& content_origin); | 50 virtual void WhitelistContentOrigin(const GURL& content_origin); |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 struct PeripheralPlugin { | 53 struct PeripheralPlugin { |
| 53 PeripheralPlugin(const GURL& content_origin, | 54 PeripheralPlugin(const GURL& content_origin, |
| 54 const base::Closure& unthrottle_callback); | 55 const base::Closure& unthrottle_callback); |
| 55 ~PeripheralPlugin(); | 56 ~PeripheralPlugin(); |
| 56 | 57 |
| 57 GURL content_origin; | 58 GURL content_origin; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 70 | 71 |
| 71 // Set of peripheral plugins eligible to be unthrottled ex post facto. | 72 // Set of peripheral plugins eligible to be unthrottled ex post facto. |
| 72 std::vector<PeripheralPlugin> peripheral_plugins_; | 73 std::vector<PeripheralPlugin> peripheral_plugins_; |
| 73 | 74 |
| 74 DISALLOW_COPY_AND_ASSIGN(PluginPowerSaverHelperImpl); | 75 DISALLOW_COPY_AND_ASSIGN(PluginPowerSaverHelperImpl); |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 } // namespace content | 78 } // namespace content |
| 78 | 79 |
| 79 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_ | 80 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_IMPL_H_ |
| OLD | NEW |