OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_RENDERER_PLUGINS_POWER_SAVER_INFO_H_ | 5 #ifndef CHROME_RENDERER_PLUGINS_POWER_SAVER_INFO_H_ |
6 #define CHROME_RENDERER_PLUGINS_POWER_SAVER_INFO_H_ | 6 #define CHROME_RENDERER_PLUGINS_POWER_SAVER_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 struct WebPluginParams; | 14 struct WebPluginParams; |
15 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class RenderFrame; | 18 class RenderFrame; |
19 struct WebPluginInfo; | 19 struct WebPluginInfo; |
20 } | 20 } |
21 | 21 |
22 // This contains information specifying the plugin's Power Saver behavior. | 22 // This contains information specifying the plugin's Power Saver behavior. |
23 // The default constructor has Plugin Power Saver disabled. | 23 // The default constructor has Plugin Power Saver disabled. |
24 struct PowerSaverInfo { | 24 struct PowerSaverInfo { |
25 PowerSaverInfo(); | 25 PowerSaverInfo(); |
| 26 PowerSaverInfo(const PowerSaverInfo& other); |
26 | 27 |
27 // Determines the PowerSaverInfo using the peripheral content heuristic. | 28 // Determines the PowerSaverInfo using the peripheral content heuristic. |
28 static PowerSaverInfo Get(content::RenderFrame* render_frame, | 29 static PowerSaverInfo Get(content::RenderFrame* render_frame, |
29 bool power_saver_setting_on, | 30 bool power_saver_setting_on, |
30 const blink::WebPluginParams& params, | 31 const blink::WebPluginParams& params, |
31 const content::WebPluginInfo& plugin_info, | 32 const content::WebPluginInfo& plugin_info, |
32 const GURL& document_url); | 33 const GURL& document_url); |
33 | 34 |
34 // Whether power saver should be enabled. | 35 // Whether power saver should be enabled. |
35 bool power_saver_enabled; | 36 bool power_saver_enabled; |
36 | 37 |
37 // Whether the plugin should be deferred because it is in a background tab. | 38 // Whether the plugin should be deferred because it is in a background tab. |
38 bool blocked_for_background_tab; | 39 bool blocked_for_background_tab; |
39 | 40 |
40 // The poster image specified in image 'srcset' attribute format. | 41 // The poster image specified in image 'srcset' attribute format. |
41 std::string poster_attribute; | 42 std::string poster_attribute; |
42 | 43 |
43 // Used to resolve relative paths in |poster_attribute|. | 44 // Used to resolve relative paths in |poster_attribute|. |
44 GURL base_url; | 45 GURL base_url; |
45 | 46 |
46 // Specify this to provide partially obscured plugins a centered poster image. | 47 // Specify this to provide partially obscured plugins a centered poster image. |
47 gfx::Size custom_poster_size; | 48 gfx::Size custom_poster_size; |
48 }; | 49 }; |
49 | 50 |
50 #endif // CHROME_RENDERER_PLUGINS_POWER_SAVER_INFO_H_ | 51 #endif // CHROME_RENDERER_PLUGINS_POWER_SAVER_INFO_H_ |
OLD | NEW |