OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_ |
| 6 #define CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_ |
| 7 |
| 8 #include "components/plugins/renderer/plugin_placeholder.h" |
| 9 |
| 10 struct ChromeViewHostMsg_GetPluginInfo_Status; |
| 11 |
| 12 class ChromePluginPlaceholder : public PluginPlaceholder, |
| 13 public content::RenderProcessObserver, |
| 14 public content::ContextMenuClient { |
| 15 public: |
| 16 ChromePluginPlaceholder(content::RenderView* render_view, |
| 17 WebKit::WebFrame* frame, |
| 18 const WebKit::WebPluginParams& params, |
| 19 const std::string& html_data, |
| 20 const string16& title); |
| 21 virtual ~ChromePluginPlaceholder(); |
| 22 |
| 23 static ChromePluginPlaceholder* CreateBlockedPlugin( |
| 24 content::RenderView* render_view, |
| 25 WebKit::WebFrame* frame, |
| 26 const WebKit::WebPluginParams& params, |
| 27 const content::WebPluginInfo& info, |
| 28 const std::string& identifier, |
| 29 const string16& name, |
| 30 int resource_id, |
| 31 const string16& message); |
| 32 |
| 33 #if defined(ENABLE_MOBILE_YOUTUBE_PLUGIN) |
| 34 // Placeholder for old style embedded youtube video on mobile device. For old |
| 35 // style embedded youtube video, it has a url in the form of |
| 36 // http://www.youtube.com/v/VIDEO_ID. This placeholder replaces the url with a |
| 37 // simple html page and clicking the play image redirects the user to the |
| 38 // mobile youtube app. |
| 39 static ChromePluginPlaceholder* CreateMobileYoutubePlugin( |
| 40 content::RenderView* render_view, |
| 41 WebKit::WebFrame* frame, |
| 42 const WebKit::WebPluginParams& params); |
| 43 #endif |
| 44 |
| 45 // Creates a new WebViewPlugin with a MissingPlugin as a delegate. |
| 46 static ChromePluginPlaceholder* CreateMissingPlugin( |
| 47 content::RenderView* render_view, |
| 48 WebKit::WebFrame* frame, |
| 49 const WebKit::WebPluginParams& params); |
| 50 |
| 51 static ChromePluginPlaceholder* CreateErrorPlugin( |
| 52 content::RenderView* render_view, |
| 53 const base::FilePath& plugin_path); |
| 54 |
| 55 void SetStatus(const ChromeViewHostMsg_GetPluginInfo_Status& status); |
| 56 |
| 57 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 58 int32 CreateRoutingId(); |
| 59 #endif |
| 60 |
| 61 private: |
| 62 // content::RenderViewObserver (via PluginPlaceholder) override: |
| 63 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 64 |
| 65 // WebViewPlugin::Delegate (via PluginPlaceholder) methods: |
| 66 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE; |
| 67 |
| 68 // content::RenderProcessObserver methods: |
| 69 virtual void PluginListChanged() OVERRIDE; |
| 70 |
| 71 // content::ContextMenuClient methods: |
| 72 virtual void OnMenuAction(int request_id, unsigned action) OVERRIDE; |
| 73 virtual void OnMenuClosed(int request_id) OVERRIDE; |
| 74 virtual void OpenAboutPlugins() OVERRIDE; |
| 75 |
| 76 // Local methods: |
| 77 void OnLoadBlockedPlugins(const std::string& identifier); |
| 78 void OnSetIsPrerendering(bool is_prerendering); |
| 79 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 80 void OnDidNotFindMissingPlugin(); |
| 81 void OnFoundMissingPlugin(const string16& plugin_name); |
| 82 void OnStartedDownloadingPlugin(); |
| 83 void OnFinishedDownloadingPlugin(); |
| 84 void OnErrorDownloadingPlugin(const std::string& error); |
| 85 void OnCancelledDownloadingPlugin(); |
| 86 #endif |
| 87 |
| 88 // We use a scoped_ptr so we can forward-declare the struct; it's defined in |
| 89 // an IPC message file which can't be easily included in other header files. |
| 90 scoped_ptr<ChromeViewHostMsg_GetPluginInfo_Status> status_; |
| 91 |
| 92 string16 title_; |
| 93 |
| 94 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 95 // |routing_id()| is the routing ID of our associated RenderView, but we have |
| 96 // a separate routing ID for messages specific to this placeholder. |
| 97 int32 placeholder_routing_id_; |
| 98 #endif |
| 99 |
| 100 bool has_host_; |
| 101 int context_menu_request_id_; // Nonzero when request pending. |
| 102 string16 plugin_name_; |
| 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(ChromePluginPlaceholder); |
| 105 }; |
| 106 |
| 107 #endif // CHROME_RENDERER_PLUGINS_CHROME_PLUGIN_PLACEHOLDER_H_ |
OLD | NEW |