Index: components/plugins/renderer/plugin_placeholder.h |
diff --git a/chrome/renderer/plugins/plugin_placeholder.h b/components/plugins/renderer/plugin_placeholder.h |
similarity index 43% |
rename from chrome/renderer/plugins/plugin_placeholder.h |
rename to components/plugins/renderer/plugin_placeholder.h |
index 7ec95bae6b1786330404ae10af3c32a93196e731..a62cbe6fbd483edd2574f56889c9e20013df4532 100644 |
--- a/chrome/renderer/plugins/plugin_placeholder.h |
+++ b/components/plugins/renderer/plugin_placeholder.h |
@@ -2,10 +2,10 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
-#define CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
+#ifndef COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ |
+#define COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ |
-#include "chrome/renderer/plugins/webview_plugin.h" |
+#include "components/plugins/renderer/webview_plugin.h" |
#include "content/public/common/webplugininfo.h" |
#include "content/public/renderer/context_menu_client.h" |
#include "content/public/renderer/render_process_observer.h" |
@@ -13,8 +13,6 @@ |
#include "third_party/WebKit/public/web/WebPluginParams.h" |
#include "webkit/renderer/cpp_bound_class.h" |
-struct ChromeViewHostMsg_GetPluginInfo_Status; |
- |
namespace content { |
struct WebPluginInfo; |
} |
@@ -22,42 +20,9 @@ struct WebPluginInfo; |
// Placeholders can be used if a plug-in is missing or not available |
// (blocked or disabled). |
class PluginPlaceholder : public content::RenderViewObserver, |
- public content::RenderProcessObserver, |
public webkit_glue::CppBoundClass, |
- public WebViewPlugin::Delegate, |
- public content::ContextMenuClient { |
+ public WebViewPlugin::Delegate { |
public: |
- // Creates a new WebViewPlugin with a MissingPlugin as a delegate. |
- static PluginPlaceholder* CreateMissingPlugin( |
- content::RenderView* render_view, |
- WebKit::WebFrame* frame, |
- const WebKit::WebPluginParams& params); |
- |
- static PluginPlaceholder* CreateErrorPlugin( |
- content::RenderView* render_view, |
- const base::FilePath& plugin_path); |
- |
- static PluginPlaceholder* CreateBlockedPlugin( |
- content::RenderView* render_view, |
- WebKit::WebFrame* frame, |
- const WebKit::WebPluginParams& params, |
- const content::WebPluginInfo& info, |
- const std::string& identifier, |
- const string16& name, |
- int resource_id, |
- const string16& message); |
- |
-#if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) |
- // Placeholder for old style embedded youtube video on mobile device. For old |
- // style embedded youtube video, it has a url in the form of |
- // http://www.youtube.com/v/VIDEO_ID. This placeholder replaces the url with a |
- // simple html page and clicking the play image redirects the user to the |
- // mobile youtube app. |
- static PluginPlaceholder* CreateMobileYoutubePlugin( |
- content::RenderView* render_view, |
- WebKit::WebFrame* frame, |
- const WebKit::WebPluginParams& params); |
-#endif |
WebViewPlugin* plugin() { return plugin_; } |
@@ -67,42 +32,26 @@ class PluginPlaceholder : public content::RenderViewObserver, |
void set_allow_loading(bool allow_loading) { allow_loading_ = allow_loading; } |
- void SetStatus(const ChromeViewHostMsg_GetPluginInfo_Status& status); |
- |
-#if defined(ENABLE_PLUGIN_INSTALLATION) |
- int32 CreateRoutingId(); |
-#endif |
- |
-#if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) |
- // Whether this is a youtube url. |
- static bool IsYouTubeURL(const GURL& url, const std::string& mime_type); |
-#endif |
- |
- private: |
+ protected: |
// |render_view| and |frame| are weak pointers. If either one is going away, |
// our |plugin_| will be destroyed as well and will notify us. |
PluginPlaceholder(content::RenderView* render_view, |
WebKit::WebFrame* frame, |
const WebKit::WebPluginParams& params, |
- const std::string& html_data, |
- const string16& title); |
+ const std::string& html_data); |
virtual ~PluginPlaceholder(); |
- // WebViewPlugin::Delegate methods: |
- virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE; |
- virtual void WillDestroyPlugin() OVERRIDE; |
- virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE; |
- |
- // content::RenderViewObserver methods: |
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
- |
- // content::RenderProcessObserver methods: |
- virtual void PluginListChanged() OVERRIDE; |
+ void OnLoadBlockedPlugins(const std::string& identifier); |
+ void OnSetIsPrerendering(bool is_prerendering); |
- // content::ContextMenuClient methods: |
- virtual void OnMenuAction(int request_id, unsigned action) OVERRIDE; |
- virtual void OnMenuClosed(int request_id) OVERRIDE; |
+ void SetMessage(const string16& message); |
+ void SetPluginInfo(const content::WebPluginInfo& plugin_info); |
+ const content::WebPluginInfo& GetPluginInfo() const; |
+ void SetIdentifier(const std::string& identifier); |
+ WebKit::WebFrame* GetFrame(); |
+ const WebKit::WebPluginParams& GetPluginParams() const; |
+ bool LoadingAllowed() const { return allow_loading_; } |
// Replace this placeholder with a different plugin (which could be |
// a placeholder again). |
@@ -114,46 +63,29 @@ class PluginPlaceholder : public content::RenderViewObserver, |
// Load the blocked plugin. |
void LoadPlugin(); |
+ // WebViewPlugin::Delegate method: |
+ virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE; |
+ |
+ private: |
+ // WebViewPlugin::Delegate methods: |
+ virtual void WillDestroyPlugin() OVERRIDE; |
+ virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE; |
+ |
// Javascript callbacks: |
+ // All ignore arguments (which are, however, required by caller) and return |
+ // nothing. |
+ |
// Load the blocked plugin by calling LoadPlugin(). |
- // Takes no arguments, and returns nothing. |
void LoadCallback(const webkit_glue::CppArgumentList& args, |
webkit_glue::CppVariant* result); |
// Hide the blocked plugin by calling HidePlugin(). |
- // Takes no arguments, and returns nothing. |
void HideCallback(const webkit_glue::CppArgumentList& args, |
webkit_glue::CppVariant* result); |
- // Opens chrome://plugins in a new tab. |
- // Takes no arguments, and returns nothing. |
- void OpenAboutPluginsCallback(const webkit_glue::CppArgumentList& args, |
- webkit_glue::CppVariant* result); |
- |
void DidFinishLoadingCallback(const webkit_glue::CppArgumentList& args, |
webkit_glue::CppVariant* result); |
- void OnLoadBlockedPlugins(const std::string& identifier); |
- void OnSetIsPrerendering(bool is_prerendering); |
-#if defined(ENABLE_PLUGIN_INSTALLATION) |
- void OnDidNotFindMissingPlugin(); |
- void OnFoundMissingPlugin(const string16& plugin_name); |
- void OnStartedDownloadingPlugin(); |
- void OnFinishedDownloadingPlugin(); |
- void OnErrorDownloadingPlugin(const std::string& error); |
- void OnCancelledDownloadingPlugin(); |
-#endif |
- |
-#if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) |
- // Check whether the url is valid. |
- static bool IsValidYouTubeVideo(const std::string& path); |
- |
- // Opens a youtube app in the current tab. |
- void OpenYoutubeUrlCallback(const webkit_glue::CppArgumentList& args, |
- webkit_glue::CppVariant* result); |
-#endif |
- |
- void SetMessage(const string16& message); |
void UpdateMessage(); |
WebKit::WebFrame* frame_; |
@@ -162,32 +94,18 @@ class PluginPlaceholder : public content::RenderViewObserver, |
content::WebPluginInfo plugin_info_; |
- string16 title_; |
string16 message_; |
- // We use a scoped_ptr so we can forward-declare the struct; it's defined in |
- // an IPC message file which can't be easily included in other header files. |
- scoped_ptr<ChromeViewHostMsg_GetPluginInfo_Status> status_; |
- |
// True iff the plugin was blocked because the page was being prerendered. |
// Plugin will automatically be loaded when the page is displayed. |
bool is_blocked_for_prerendering_; |
bool allow_loading_; |
-#if defined(ENABLE_PLUGIN_INSTALLATION) |
- // |routing_id()| is the routing ID of our associated RenderView, but we have |
- // a separate routing ID for messages specific to this placeholder. |
- int32 placeholder_routing_id_; |
-#endif |
- |
bool hidden_; |
- bool has_host_; |
bool finished_loading_; |
- string16 plugin_name_; |
std::string identifier_; |
- int context_menu_request_id_; // Nonzero when request pending. |
DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder); |
}; |
-#endif // CHROME_RENDERER_PLUGINS_PLUGIN_PLACEHOLDER_H_ |
+#endif // COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ |