| 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 COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ | 5 #ifndef COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ |
| 6 #define COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ | 6 #define COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ |
| 7 | 7 |
| 8 #include "components/plugins/renderer/webview_plugin.h" | 8 #include "components/plugins/renderer/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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 void set_blocked_for_prerendering(bool blocked_for_prerendering) { | 30 void set_blocked_for_prerendering(bool blocked_for_prerendering) { |
| 31 is_blocked_for_prerendering_ = blocked_for_prerendering; | 31 is_blocked_for_prerendering_ = blocked_for_prerendering; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void set_allow_loading(bool allow_loading) { allow_loading_ = allow_loading; } | 34 void set_allow_loading(bool allow_loading) { allow_loading_ = allow_loading; } |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 // |render_view| and |frame| are weak pointers. If either one is going away, | 37 // |render_view| and |frame| are weak pointers. If either one is going away, |
| 38 // our |plugin_| will be destroyed as well and will notify us. | 38 // our |plugin_| will be destroyed as well and will notify us. |
| 39 PluginPlaceholder(content::RenderView* render_view, | 39 PluginPlaceholder(content::RenderView* render_view, |
| 40 WebKit::WebFrame* frame, | 40 blink::WebFrame* frame, |
| 41 const WebKit::WebPluginParams& params, | 41 const blink::WebPluginParams& params, |
| 42 const std::string& html_data, | 42 const std::string& html_data, |
| 43 GURL placeholderDataUrl); | 43 GURL placeholderDataUrl); |
| 44 | 44 |
| 45 virtual ~PluginPlaceholder(); | 45 virtual ~PluginPlaceholder(); |
| 46 | 46 |
| 47 void OnLoadBlockedPlugins(const std::string& identifier); | 47 void OnLoadBlockedPlugins(const std::string& identifier); |
| 48 void OnSetIsPrerendering(bool is_prerendering); | 48 void OnSetIsPrerendering(bool is_prerendering); |
| 49 | 49 |
| 50 void SetMessage(const string16& message); | 50 void SetMessage(const string16& message); |
| 51 void SetPluginInfo(const content::WebPluginInfo& plugin_info); | 51 void SetPluginInfo(const content::WebPluginInfo& plugin_info); |
| 52 const content::WebPluginInfo& GetPluginInfo() const; | 52 const content::WebPluginInfo& GetPluginInfo() const; |
| 53 void SetIdentifier(const std::string& identifier); | 53 void SetIdentifier(const std::string& identifier); |
| 54 WebKit::WebFrame* GetFrame(); | 54 blink::WebFrame* GetFrame(); |
| 55 const WebKit::WebPluginParams& GetPluginParams() const; | 55 const blink::WebPluginParams& GetPluginParams() const; |
| 56 bool LoadingAllowed() const { return allow_loading_; } | 56 bool LoadingAllowed() const { return allow_loading_; } |
| 57 | 57 |
| 58 // Replace this placeholder with a different plugin (which could be | 58 // Replace this placeholder with a different plugin (which could be |
| 59 // a placeholder again). | 59 // a placeholder again). |
| 60 void ReplacePlugin(WebKit::WebPlugin* new_plugin); | 60 void ReplacePlugin(blink::WebPlugin* new_plugin); |
| 61 | 61 |
| 62 // Hide this placeholder. | 62 // Hide this placeholder. |
| 63 void HidePlugin(); | 63 void HidePlugin(); |
| 64 | 64 |
| 65 // Load the blocked plugin. | 65 // Load the blocked plugin. |
| 66 void LoadPlugin(); | 66 void LoadPlugin(); |
| 67 | 67 |
| 68 // WebViewPlugin::Delegate method: | 68 // WebViewPlugin::Delegate method: |
| 69 virtual void BindWebFrame(WebKit::WebFrame* frame) OVERRIDE; | 69 virtual void BindWebFrame(blink::WebFrame* frame) OVERRIDE; |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 // WebViewPlugin::Delegate methods: | 72 // WebViewPlugin::Delegate methods: |
| 73 virtual void WillDestroyPlugin() OVERRIDE; | 73 virtual void WillDestroyPlugin() OVERRIDE; |
| 74 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) OVERRIDE; | 74 virtual void ShowContextMenu(const blink::WebMouseEvent&) OVERRIDE; |
| 75 | 75 |
| 76 // Javascript callbacks: | 76 // Javascript callbacks: |
| 77 // All ignore arguments (which are, however, required by caller) and return | 77 // All ignore arguments (which are, however, required by caller) and return |
| 78 // nothing. | 78 // nothing. |
| 79 | 79 |
| 80 // Load the blocked plugin by calling LoadPlugin(). | 80 // Load the blocked plugin by calling LoadPlugin(). |
| 81 void LoadCallback(const webkit_glue::CppArgumentList& args, | 81 void LoadCallback(const webkit_glue::CppArgumentList& args, |
| 82 webkit_glue::CppVariant* result); | 82 webkit_glue::CppVariant* result); |
| 83 | 83 |
| 84 // Hide the blocked plugin by calling HidePlugin(). | 84 // Hide the blocked plugin by calling HidePlugin(). |
| 85 void HideCallback(const webkit_glue::CppArgumentList& args, | 85 void HideCallback(const webkit_glue::CppArgumentList& args, |
| 86 webkit_glue::CppVariant* result); | 86 webkit_glue::CppVariant* result); |
| 87 | 87 |
| 88 void DidFinishLoadingCallback(const webkit_glue::CppArgumentList& args, | 88 void DidFinishLoadingCallback(const webkit_glue::CppArgumentList& args, |
| 89 webkit_glue::CppVariant* result); | 89 webkit_glue::CppVariant* result); |
| 90 | 90 |
| 91 void UpdateMessage(); | 91 void UpdateMessage(); |
| 92 | 92 |
| 93 WebKit::WebFrame* frame_; | 93 blink::WebFrame* frame_; |
| 94 WebKit::WebPluginParams plugin_params_; | 94 blink::WebPluginParams plugin_params_; |
| 95 WebViewPlugin* plugin_; | 95 WebViewPlugin* plugin_; |
| 96 | 96 |
| 97 content::WebPluginInfo plugin_info_; | 97 content::WebPluginInfo plugin_info_; |
| 98 | 98 |
| 99 string16 message_; | 99 string16 message_; |
| 100 | 100 |
| 101 // True iff the plugin was blocked because the page was being prerendered. | 101 // True iff the plugin was blocked because the page was being prerendered. |
| 102 // Plugin will automatically be loaded when the page is displayed. | 102 // Plugin will automatically be loaded when the page is displayed. |
| 103 bool is_blocked_for_prerendering_; | 103 bool is_blocked_for_prerendering_; |
| 104 bool allow_loading_; | 104 bool allow_loading_; |
| 105 | 105 |
| 106 bool hidden_; | 106 bool hidden_; |
| 107 bool finished_loading_; | 107 bool finished_loading_; |
| 108 std::string identifier_; | 108 std::string identifier_; |
| 109 | 109 |
| 110 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder); | 110 DISALLOW_COPY_AND_ASSIGN(PluginPlaceholder); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } // namespace plugins | 113 } // namespace plugins |
| 114 | 114 |
| 115 #endif // COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ | 115 #endif // COMPONENTS_PLUGINS_RENDERER_PLUGIN_PLACEHOLDER_H_ |
| OLD | NEW |