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

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

Issue 1528653002: Revert of Plugin Power Saver: Improve Poster behavior for essential plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 #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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "content/public/renderer/render_frame.h"
14 #include "content/public/renderer/render_frame_observer.h" 13 #include "content/public/renderer/render_frame_observer.h"
15 #include "url/origin.h" 14 #include "url/origin.h"
16 15
17 namespace blink { 16 namespace blink {
18 struct WebPluginParams; 17 struct WebPluginParams;
19 struct WebRect; 18 struct WebRect;
20 } 19 }
21 20
22 namespace gfx {
23 class Size;
24 }
25
26 namespace content { 21 namespace content {
27 22
28 class CONTENT_EXPORT PluginPowerSaverHelper : public RenderFrameObserver { 23 class CONTENT_EXPORT PluginPowerSaverHelper : public RenderFrameObserver {
29 public: 24 public:
30 explicit PluginPowerSaverHelper(RenderFrame* render_frame); 25 explicit PluginPowerSaverHelper(RenderFrame* render_frame);
31 ~PluginPowerSaverHelper() override; 26 ~PluginPowerSaverHelper() override;
32 27
33 private: 28 private:
34 friend class RenderFrameImpl; 29 friend class RenderFrameImpl;
35 30
36 struct PeripheralPlugin { 31 struct PeripheralPlugin {
37 PeripheralPlugin(const url::Origin& content_origin, 32 PeripheralPlugin(const url::Origin& content_origin,
38 const base::Closure& unthrottle_callback); 33 const base::Closure& unthrottle_callback);
39 ~PeripheralPlugin(); 34 ~PeripheralPlugin();
40 35
41 url::Origin content_origin; 36 url::Origin content_origin;
42 base::Closure unthrottle_callback; 37 base::Closure unthrottle_callback;
43 }; 38 };
44 39
45 // See RenderFrame for documentation. 40 // See RenderFrame for documentation.
46 void RegisterPeripheralPlugin(const url::Origin& content_origin, 41 void RegisterPeripheralPlugin(const url::Origin& content_origin,
47 const base::Closure& unthrottle_callback); 42 const base::Closure& unthrottle_callback);
48 RenderFrame::PeripheralContentStatus GetPeripheralContentStatus( 43 bool ShouldThrottleContent(const url::Origin& main_frame_origin,
49 const url::Origin& main_frame_origin, 44 const url::Origin& content_origin,
50 const url::Origin& content_origin, 45 int width,
51 const gfx::Size& unobscured_size) const; 46 int height,
47 bool* cross_origin_main_content) const;
52 void WhitelistContentOrigin(const url::Origin& content_origin); 48 void WhitelistContentOrigin(const url::Origin& content_origin);
53 49
54 // RenderFrameObserver implementation. 50 // RenderFrameObserver implementation.
55 void DidCommitProvisionalLoad(bool is_new_navigation, 51 void DidCommitProvisionalLoad(bool is_new_navigation,
56 bool is_same_page_navigation) override; 52 bool is_same_page_navigation) override;
57 bool OnMessageReceived(const IPC::Message& message) override; 53 bool OnMessageReceived(const IPC::Message& message) override;
58 54
59 void OnUpdatePluginContentOriginWhitelist( 55 void OnUpdatePluginContentOriginWhitelist(
60 const std::set<url::Origin>& origin_whitelist); 56 const std::set<url::Origin>& origin_whitelist);
61 57
62 // Local copy of the whitelist for the entire tab. 58 // Local copy of the whitelist for the entire tab.
63 std::set<url::Origin> origin_whitelist_; 59 std::set<url::Origin> origin_whitelist_;
64 60
65 // Set of peripheral plugins eligible to be unthrottled ex post facto. 61 // Set of peripheral plugins eligible to be unthrottled ex post facto.
66 std::vector<PeripheralPlugin> peripheral_plugins_; 62 std::vector<PeripheralPlugin> peripheral_plugins_;
67 63
68 DISALLOW_COPY_AND_ASSIGN(PluginPowerSaverHelper); 64 DISALLOW_COPY_AND_ASSIGN(PluginPowerSaverHelper);
69 }; 65 };
70 66
71 } // namespace content 67 } // namespace content
72 68
73 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_H_ 69 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_POWER_SAVER_HELPER_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/plugin_instance_throttler_impl.cc ('k') | content/renderer/pepper/plugin_power_saver_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698