OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PLUGIN_PLACEHOLDER_H_ | 5 #ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
6 #define CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ | 6 #define CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
7 | 7 |
8 #include "chrome/renderer/plugins/webview_plugin.h" | 8 #include "chrome/renderer/plugins/webview_plugin.h" |
| 9 #include "content/public/common/webplugininfo.h" |
9 #include "content/public/renderer/context_menu_client.h" | 10 #include "content/public/renderer/context_menu_client.h" |
10 #include "content/public/renderer/render_process_observer.h" | 11 #include "content/public/renderer/render_process_observer.h" |
11 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_view_observer.h" |
12 #include "third_party/WebKit/public/web/WebPluginParams.h" | 13 #include "third_party/WebKit/public/web/WebPluginParams.h" |
13 #include "webkit/plugins/webplugininfo.h" | |
14 #include "webkit/renderer/cpp_bound_class.h" | 14 #include "webkit/renderer/cpp_bound_class.h" |
15 | 15 |
16 struct ChromeViewHostMsg_GetPluginInfo_Status; | 16 struct ChromeViewHostMsg_GetPluginInfo_Status; |
17 | 17 |
18 namespace webkit { | 18 namespace content { |
19 struct WebPluginInfo; | 19 struct WebPluginInfo; |
20 } | 20 } |
21 | 21 |
22 // Placeholders can be used if a plug-in is missing or not available | 22 // Placeholders can be used if a plug-in is missing or not available |
23 // (blocked or disabled). | 23 // (blocked or disabled). |
24 class PluginPlaceholder : public content::RenderViewObserver, | 24 class PluginPlaceholder : public content::RenderViewObserver, |
25 public content::RenderProcessObserver, | 25 public content::RenderProcessObserver, |
26 public webkit_glue::CppBoundClass, | 26 public webkit_glue::CppBoundClass, |
27 public WebViewPlugin::Delegate, | 27 public WebViewPlugin::Delegate, |
28 public content::ContextMenuClient { | 28 public content::ContextMenuClient { |
29 public: | 29 public: |
30 // Creates a new WebViewPlugin with a MissingPlugin as a delegate. | 30 // Creates a new WebViewPlugin with a MissingPlugin as a delegate. |
31 static PluginPlaceholder* CreateMissingPlugin( | 31 static PluginPlaceholder* CreateMissingPlugin( |
32 content::RenderView* render_view, | 32 content::RenderView* render_view, |
33 WebKit::WebFrame* frame, | 33 WebKit::WebFrame* frame, |
34 const WebKit::WebPluginParams& params); | 34 const WebKit::WebPluginParams& params); |
35 | 35 |
36 static PluginPlaceholder* CreateErrorPlugin( | 36 static PluginPlaceholder* CreateErrorPlugin( |
37 content::RenderView* render_view, | 37 content::RenderView* render_view, |
38 const base::FilePath& plugin_path); | 38 const base::FilePath& plugin_path); |
39 | 39 |
40 static PluginPlaceholder* CreateBlockedPlugin( | 40 static PluginPlaceholder* CreateBlockedPlugin( |
41 content::RenderView* render_view, | 41 content::RenderView* render_view, |
42 WebKit::WebFrame* frame, | 42 WebKit::WebFrame* frame, |
43 const WebKit::WebPluginParams& params, | 43 const WebKit::WebPluginParams& params, |
44 const webkit::WebPluginInfo& info, | 44 const content::WebPluginInfo& info, |
45 const std::string& identifier, | 45 const std::string& identifier, |
46 const string16& name, | 46 const string16& name, |
47 int resource_id, | 47 int resource_id, |
48 const string16& message); | 48 const string16& message); |
49 | 49 |
50 #if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) | 50 #if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) |
51 // Placeholder for old style embedded youtube video on mobile device. For old | 51 // Placeholder for old style embedded youtube video on mobile device. For old |
52 // style embedded youtube video, it has a url in the form of | 52 // style embedded youtube video, it has a url in the form of |
53 // http://www.youtube.com/v/VIDEO_ID. This placeholder replaces the url with a | 53 // http://www.youtube.com/v/VIDEO_ID. This placeholder replaces the url with a |
54 // simple html page and clicking the play image redirects the user to the | 54 // simple html page and clicking the play image redirects the user to the |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 webkit_glue::CppVariant* result); | 153 webkit_glue::CppVariant* result); |
154 #endif | 154 #endif |
155 | 155 |
156 void SetMessage(const string16& message); | 156 void SetMessage(const string16& message); |
157 void UpdateMessage(); | 157 void UpdateMessage(); |
158 | 158 |
159 WebKit::WebFrame* frame_; | 159 WebKit::WebFrame* frame_; |
160 WebKit::WebPluginParams plugin_params_; | 160 WebKit::WebPluginParams plugin_params_; |
161 WebViewPlugin* plugin_; | 161 WebViewPlugin* plugin_; |
162 | 162 |
163 webkit::WebPluginInfo plugin_info_; | 163 content::WebPluginInfo plugin_info_; |
164 | 164 |
165 string16 title_; | 165 string16 title_; |
166 string16 message_; | 166 string16 message_; |
167 | 167 |
168 // We use a scoped_ptr so we can forward-declare the struct; it's defined in | 168 // We use a scoped_ptr so we can forward-declare the struct; it's defined in |
169 // an IPC message file which can't be easily included in other header files. | 169 // an IPC message file which can't be easily included in other header files. |
170 scoped_ptr<ChromeViewHostMsg_GetPluginInfo_Status> status_; | 170 scoped_ptr<ChromeViewHostMsg_GetPluginInfo_Status> status_; |
171 | 171 |
172 // True iff the plugin was blocked because the page was being prerendered. | 172 // True iff the plugin was blocked because the page was being prerendered. |
173 // Plugin will automatically be loaded when the page is displayed. | 173 // Plugin will automatically be loaded when the page is displayed. |
(...skipping 10 matching lines...) Expand all Loading... |
184 bool has_host_; | 184 bool has_host_; |
185 bool finished_loading_; | 185 bool finished_loading_; |
186 string16 plugin_name_; | 186 string16 plugin_name_; |
187 std::string identifier_; | 187 std::string identifier_; |
188 int context_menu_request_id_; // Nonzero when request pending. | 188 int context_menu_request_id_; // Nonzero when request pending. |
189 | 189 |
190 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder); | 190 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder); |
191 }; | 191 }; |
192 | 192 |
193 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ | 193 #endif // CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
OLD | NEW |