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/common/webplugininfo.h" |
10 #include "content/public/renderer/context_menu_client.h" | 10 #include "content/public/renderer/context_menu_client.h" |
11 #include "content/public/renderer/render_process_observer.h" | 11 #include "content/public/renderer/render_process_observer.h" |
12 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_view_observer.h" |
| 13 #include "content/renderer/cpp_bound_class.h" |
13 #include "third_party/WebKit/public/web/WebPluginParams.h" | 14 #include "third_party/WebKit/public/web/WebPluginParams.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 content { | 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 content::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( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 // Hide this placeholder. | 111 // Hide this placeholder. |
112 void HidePlugin(); | 112 void HidePlugin(); |
113 | 113 |
114 // Load the blocked plugin. | 114 // Load the blocked plugin. |
115 void LoadPlugin(); | 115 void LoadPlugin(); |
116 | 116 |
117 // Javascript callbacks: | 117 // Javascript callbacks: |
118 // Load the blocked plugin by calling LoadPlugin(). | 118 // Load the blocked plugin by calling LoadPlugin(). |
119 // Takes no arguments, and returns nothing. | 119 // Takes no arguments, and returns nothing. |
120 void LoadCallback(const webkit_glue::CppArgumentList& args, | 120 void LoadCallback(const content::CppArgumentList& args, |
121 webkit_glue::CppVariant* result); | 121 content::CppVariant* result); |
122 | 122 |
123 // Hide the blocked plugin by calling HidePlugin(). | 123 // Hide the blocked plugin by calling HidePlugin(). |
124 // Takes no arguments, and returns nothing. | 124 // Takes no arguments, and returns nothing. |
125 void HideCallback(const webkit_glue::CppArgumentList& args, | 125 void HideCallback(const content::CppArgumentList& args, |
126 webkit_glue::CppVariant* result); | 126 content::CppVariant* result); |
127 | 127 |
128 // Opens chrome://plugins in a new tab. | 128 // Opens chrome://plugins in a new tab. |
129 // Takes no arguments, and returns nothing. | 129 // Takes no arguments, and returns nothing. |
130 void OpenAboutPluginsCallback(const webkit_glue::CppArgumentList& args, | 130 void OpenAboutPluginsCallback(const content::CppArgumentList& args, |
131 webkit_glue::CppVariant* result); | 131 content::CppVariant* result); |
132 | 132 |
133 void DidFinishLoadingCallback(const webkit_glue::CppArgumentList& args, | 133 void DidFinishLoadingCallback(const content::CppArgumentList& args, |
134 webkit_glue::CppVariant* result); | 134 content::CppVariant* result); |
135 | 135 |
136 void OnLoadBlockedPlugins(const std::string& identifier); | 136 void OnLoadBlockedPlugins(const std::string& identifier); |
137 void OnSetIsPrerendering(bool is_prerendering); | 137 void OnSetIsPrerendering(bool is_prerendering); |
138 #if defined(ENABLE_PLUGIN_INSTALLATION) | 138 #if defined(ENABLE_PLUGIN_INSTALLATION) |
139 void OnDidNotFindMissingPlugin(); | 139 void OnDidNotFindMissingPlugin(); |
140 void OnFoundMissingPlugin(const string16& plugin_name); | 140 void OnFoundMissingPlugin(const string16& plugin_name); |
141 void OnStartedDownloadingPlugin(); | 141 void OnStartedDownloadingPlugin(); |
142 void OnFinishedDownloadingPlugin(); | 142 void OnFinishedDownloadingPlugin(); |
143 void OnErrorDownloadingPlugin(const std::string& error); | 143 void OnErrorDownloadingPlugin(const std::string& error); |
144 void OnCancelledDownloadingPlugin(); | 144 void OnCancelledDownloadingPlugin(); |
145 #endif | 145 #endif |
146 | 146 |
147 #if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) | 147 #if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) |
148 // Check whether the url is valid. | 148 // Check whether the url is valid. |
149 static bool IsValidYouTubeVideo(const std::string& path); | 149 static bool IsValidYouTubeVideo(const std::string& path); |
150 | 150 |
151 // Opens a youtube app in the current tab. | 151 // Opens a youtube app in the current tab. |
152 void OpenYoutubeUrlCallback(const webkit_glue::CppArgumentList& args, | 152 void OpenYoutubeUrlCallback(const content::CppArgumentList& args, |
153 webkit_glue::CppVariant* result); | 153 content::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 content::WebPluginInfo plugin_info_; | 163 content::WebPluginInfo plugin_info_; |
(...skipping 20 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 |