| 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_WEBVIEW_PLUGIN_H_ | 5 #ifndef COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| 6 #define COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 6 #define COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 public blink::WebViewClient, | 33 public blink::WebViewClient, |
| 34 public blink::WebFrameClient { | 34 public blink::WebFrameClient { |
| 35 public: | 35 public: |
| 36 class Delegate { | 36 class Delegate { |
| 37 public: | 37 public: |
| 38 // Bind |frame| to a Javascript object, enabling the delegate to receive | 38 // Bind |frame| to a Javascript object, enabling the delegate to receive |
| 39 // callback methods from Javascript inside the WebFrame. | 39 // callback methods from Javascript inside the WebFrame. |
| 40 // This method is called from WebFrameClient::didClearWindowObject. | 40 // This method is called from WebFrameClient::didClearWindowObject. |
| 41 virtual void BindWebFrame(blink::WebFrame* frame) = 0; | 41 virtual void BindWebFrame(blink::WebFrame* frame) = 0; |
| 42 | 42 |
| 43 // Called before the WebViewPlugin is destroyed. The delegate should delete | |
| 44 // itself here. | |
| 45 virtual void WillDestroyPlugin() = 0; | |
| 46 | |
| 47 // Called upon a context menu event. | 43 // Called upon a context menu event. |
| 48 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; | 44 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; |
| 49 }; | 45 }; |
| 50 | 46 |
| 51 explicit WebViewPlugin(Delegate* delegate); | 47 explicit WebViewPlugin(Delegate* delegate); |
| 52 | 48 |
| 53 // Convenience method to set up a new WebViewPlugin using |preferences| | 49 // Convenience method to set up a new WebViewPlugin using |preferences| |
| 54 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is | 50 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is |
| 55 // only used for navigation and never actually resolved. | 51 // only used for navigation and never actually resolved. |
| 56 static WebViewPlugin* Create(Delegate* delegate, | 52 static WebViewPlugin* Create(Delegate* delegate, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // version, so we implement this method and call the default in WebFrameClient | 125 // version, so we implement this method and call the default in WebFrameClient |
| 130 // (which does nothing) to correctly overload it. | 126 // (which does nothing) to correctly overload it. |
| 131 virtual void didReceiveResponse(blink::WebFrame* frame, | 127 virtual void didReceiveResponse(blink::WebFrame* frame, |
| 132 unsigned identifier, | 128 unsigned identifier, |
| 133 const blink::WebURLResponse& response); | 129 const blink::WebURLResponse& response); |
| 134 | 130 |
| 135 private: | 131 private: |
| 136 friend class base::DeleteHelper<WebViewPlugin>; | 132 friend class base::DeleteHelper<WebViewPlugin>; |
| 137 virtual ~WebViewPlugin(); | 133 virtual ~WebViewPlugin(); |
| 138 | 134 |
| 135 // Manages its own lifetime. |
| 139 Delegate* delegate_; | 136 Delegate* delegate_; |
| 140 // Destroys itself. | 137 |
| 141 blink::WebCursorInfo current_cursor_; | 138 blink::WebCursorInfo current_cursor_; |
| 139 |
| 142 // Owns us. | 140 // Owns us. |
| 143 blink::WebPluginContainer* container_; | 141 blink::WebPluginContainer* container_; |
| 142 |
| 144 // Owned by us, deleted via |close()|. | 143 // Owned by us, deleted via |close()|. |
| 145 blink::WebView* web_view_; | 144 blink::WebView* web_view_; |
| 145 |
| 146 // Owned by us, deleted via |close()|. | 146 // Owned by us, deleted via |close()|. |
| 147 blink::WebFrame* web_frame_; | 147 blink::WebFrame* web_frame_; |
| 148 gfx::Rect rect_; | 148 gfx::Rect rect_; |
| 149 | 149 |
| 150 blink::WebURLResponse response_; | 150 blink::WebURLResponse response_; |
| 151 std::list<std::string> data_; | 151 std::list<std::string> data_; |
| 152 bool finished_loading_; | 152 bool finished_loading_; |
| 153 scoped_ptr<blink::WebURLError> error_; | 153 scoped_ptr<blink::WebURLError> error_; |
| 154 blink::WebString old_title_; | 154 blink::WebString old_title_; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 157 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| OLD | NEW |