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_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_H_ |
6 #define CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 private: | 61 private: |
62 struct PeripheralPlugin { | 62 struct PeripheralPlugin { |
63 PeripheralPlugin(const GURL& content_origin, | 63 PeripheralPlugin(const GURL& content_origin, |
64 const base::Closure& unthrottle_callback); | 64 const base::Closure& unthrottle_callback); |
65 ~PeripheralPlugin(); | 65 ~PeripheralPlugin(); |
66 | 66 |
67 GURL content_origin; | 67 GURL content_origin; |
68 base::Closure unthrottle_callback; | 68 base::Closure unthrottle_callback; |
69 }; | 69 }; |
70 | 70 |
| 71 enum OverrideForTesting { |
| 72 Normal, |
| 73 Never, |
| 74 IgnoreList, |
| 75 Always |
| 76 }; |
| 77 |
71 // RenderFrameObserver implementation. | 78 // RenderFrameObserver implementation. |
72 void DidCommitProvisionalLoad(bool is_new_navigation, | 79 void DidCommitProvisionalLoad(bool is_new_navigation, |
73 bool is_same_page_navigation) override; | 80 bool is_same_page_navigation) override; |
74 bool OnMessageReceived(const IPC::Message& message) override; | 81 bool OnMessageReceived(const IPC::Message& message) override; |
75 | 82 |
76 void OnUpdatePluginContentOriginWhitelist( | 83 void OnUpdatePluginContentOriginWhitelist( |
77 const std::set<GURL>& origin_whitelist); | 84 const std::set<GURL>& origin_whitelist); |
78 | 85 |
| 86 OverrideForTesting override_for_testing_; |
| 87 |
79 // Local copy of the whitelist for the entire tab. | 88 // Local copy of the whitelist for the entire tab. |
80 std::set<GURL> origin_whitelist_; | 89 std::set<GURL> origin_whitelist_; |
81 | 90 |
82 // Set of peripheral plugins eligible to be unthrottled ex post facto. | 91 // Set of peripheral plugins eligible to be unthrottled ex post facto. |
83 std::vector<PeripheralPlugin> peripheral_plugins_; | 92 std::vector<PeripheralPlugin> peripheral_plugins_; |
84 | 93 |
85 DISALLOW_COPY_AND_ASSIGN(PluginPowerSaverHelper); | 94 DISALLOW_COPY_AND_ASSIGN(PluginPowerSaverHelper); |
86 }; | 95 }; |
87 | 96 |
88 } // namespace content | 97 } // namespace content |
89 | 98 |
90 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_H_ | 99 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_H_ |
OLD | NEW |