| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROME_PLUGIN_PLACEHOLDER_H_ | 5 #ifndef CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_ |
| 6 #define CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_ | 6 #define CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_ |
| 7 | 7 |
| 8 #include "components/plugins/renderer/loadable_plugin_placeholder.h" | 8 #include "components/plugins/renderer/loadable_plugin_placeholder.h" |
| 9 #include "content/public/renderer/context_menu_client.h" | 9 #include "content/public/renderer/context_menu_client.h" |
| 10 #include "content/public/renderer/render_process_observer.h" | 10 #include "content/public/renderer/render_process_observer.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 class Size; | 13 class Size; |
| 14 } | 14 } |
| 15 | 15 |
| 16 enum class ChromeViewHostMsg_GetPluginInfo_Status; | 16 enum class ChromeViewHostMsg_GetPluginInfo_Status; |
| 17 | 17 |
| 18 // This contains information specifying the poster image of plugin placeholders. | 18 // This contains information specifying the plugin's Power Saver behavior. |
| 19 // The default constructor specifies no poster image. | 19 // The default constructor has Plugin Power Saver disabled. |
| 20 struct PlaceholderPosterInfo { | 20 struct PowerSaverInfo { |
| 21 PowerSaverInfo(); |
| 22 |
| 23 // Whether power saver should be enabled. |
| 24 bool power_saver_enabled; |
| 25 |
| 26 // Whether the plugin should be deferred because it is in a background tab. |
| 27 bool blocked_for_background_tab; |
| 28 |
| 21 // The poster image specified in image 'srcset' attribute format. | 29 // The poster image specified in image 'srcset' attribute format. |
| 22 std::string poster_attribute; | 30 std::string poster_attribute; |
| 23 | 31 |
| 24 // Used to resolve relative paths in |poster_attribute|. | 32 // Used to resolve relative paths in |poster_attribute|. |
| 25 GURL base_url; | 33 GURL base_url; |
| 26 | 34 |
| 27 // Specify this to provide partially obscured plugins a centered poster image. | 35 // Specify this to provide partially obscured plugins a centered poster image. |
| 28 gfx::Size custom_poster_size; | 36 gfx::Size custom_poster_size; |
| 29 }; | 37 }; |
| 30 | 38 |
| 31 class ChromePluginPlaceholder final | 39 class ChromePluginPlaceholder final |
| 32 : public plugins::LoadablePluginPlaceholder, | 40 : public plugins::LoadablePluginPlaceholder, |
| 33 public content::RenderProcessObserver, | 41 public content::RenderProcessObserver, |
| 34 public content::ContextMenuClient, | 42 public content::ContextMenuClient, |
| 35 public gin::Wrappable<ChromePluginPlaceholder> { | 43 public gin::Wrappable<ChromePluginPlaceholder> { |
| 36 public: | 44 public: |
| 37 static gin::WrapperInfo kWrapperInfo; | 45 static gin::WrapperInfo kWrapperInfo; |
| 38 | 46 |
| 39 static ChromePluginPlaceholder* CreateBlockedPlugin( | 47 static ChromePluginPlaceholder* CreateBlockedPlugin( |
| 40 content::RenderFrame* render_frame, | 48 content::RenderFrame* render_frame, |
| 41 blink::WebLocalFrame* frame, | 49 blink::WebLocalFrame* frame, |
| 42 const blink::WebPluginParams& params, | 50 const blink::WebPluginParams& params, |
| 43 const content::WebPluginInfo& info, | 51 const content::WebPluginInfo& info, |
| 44 const std::string& identifier, | 52 const std::string& identifier, |
| 45 const base::string16& name, | 53 const base::string16& name, |
| 46 int resource_id, | 54 int resource_id, |
| 47 const base::string16& message, | 55 const base::string16& message, |
| 48 const PlaceholderPosterInfo& poster_info); | 56 const PowerSaverInfo& power_saver_info); |
| 49 | 57 |
| 50 // Creates a new WebViewPlugin with a MissingPlugin as a delegate. | 58 // Creates a new WebViewPlugin with a MissingPlugin as a delegate. |
| 51 static ChromePluginPlaceholder* CreateLoadableMissingPlugin( | 59 static ChromePluginPlaceholder* CreateLoadableMissingPlugin( |
| 52 content::RenderFrame* render_frame, | 60 content::RenderFrame* render_frame, |
| 53 blink::WebLocalFrame* frame, | 61 blink::WebLocalFrame* frame, |
| 54 const blink::WebPluginParams& params); | 62 const blink::WebPluginParams& params); |
| 55 | 63 |
| 56 void SetStatus(ChromeViewHostMsg_GetPluginInfo_Status status); | 64 void SetStatus(ChromeViewHostMsg_GetPluginInfo_Status status); |
| 57 | 65 |
| 58 #if defined(ENABLE_PLUGIN_INSTALLATION) | 66 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 #endif | 121 #endif |
| 114 | 122 |
| 115 bool has_host_; | 123 bool has_host_; |
| 116 int context_menu_request_id_; // Nonzero when request pending. | 124 int context_menu_request_id_; // Nonzero when request pending. |
| 117 base::string16 plugin_name_; | 125 base::string16 plugin_name_; |
| 118 | 126 |
| 119 DISALLOW_COPY_AND_ASSIGN(ChromePluginPlaceholder); | 127 DISALLOW_COPY_AND_ASSIGN(ChromePluginPlaceholder); |
| 120 }; | 128 }; |
| 121 | 129 |
| 122 #endif // CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_ | 130 #endif // CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_ |
| OLD | NEW |