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 29 matching lines...) Expand all Loading... |
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 upon a context menu event. | 43 // Called upon a context menu event. |
44 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; | 44 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; |
45 | 45 |
46 // Called when the WebViewPlugin is destroyed. | 46 // Called when the WebViewPlugin is destroyed. |
47 virtual void PluginDestroyed() = 0; | 47 virtual void PluginDestroyed() = 0; |
48 }; | 48 }; |
49 | 49 |
50 explicit WebViewPlugin(Delegate* delegate); | |
51 | |
52 // Convenience method to set up a new WebViewPlugin using |preferences| | 50 // Convenience method to set up a new WebViewPlugin using |preferences| |
53 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is | 51 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is |
54 // only used for navigation and never actually resolved. | 52 // only used for navigation and never actually resolved. |
55 static WebViewPlugin* Create(Delegate* delegate, | 53 static WebViewPlugin* Create(Delegate* delegate, |
56 const WebPreferences& preferences, | 54 const WebPreferences& preferences, |
57 const std::string& html_data, | 55 const std::string& html_data, |
58 const GURL& url); | 56 const GURL& url); |
59 | 57 |
60 blink::WebView* web_view() { return web_view_; } | 58 blink::WebView* web_view() { return web_view_; } |
61 | 59 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // This method is defined in WebPlugin as well as in WebFrameClient, but with | 128 // This method is defined in WebPlugin as well as in WebFrameClient, but with |
131 // different parameters. We only care about implementing the WebPlugin | 129 // different parameters. We only care about implementing the WebPlugin |
132 // version, so we implement this method and call the default in WebFrameClient | 130 // version, so we implement this method and call the default in WebFrameClient |
133 // (which does nothing) to correctly overload it. | 131 // (which does nothing) to correctly overload it. |
134 virtual void didReceiveResponse(blink::WebLocalFrame* frame, | 132 virtual void didReceiveResponse(blink::WebLocalFrame* frame, |
135 unsigned identifier, | 133 unsigned identifier, |
136 const blink::WebURLResponse& response); | 134 const blink::WebURLResponse& response); |
137 | 135 |
138 private: | 136 private: |
139 friend class base::DeleteHelper<WebViewPlugin>; | 137 friend class base::DeleteHelper<WebViewPlugin>; |
| 138 WebViewPlugin(Delegate* delegate, const WebPreferences& preferences); |
140 virtual ~WebViewPlugin(); | 139 virtual ~WebViewPlugin(); |
141 | 140 |
142 // Manages its own lifetime. | 141 // Manages its own lifetime. |
143 Delegate* delegate_; | 142 Delegate* delegate_; |
144 | 143 |
145 blink::WebCursorInfo current_cursor_; | 144 blink::WebCursorInfo current_cursor_; |
146 | 145 |
147 // Owns us. | 146 // Owns us. |
148 blink::WebPluginContainer* container_; | 147 blink::WebPluginContainer* container_; |
149 | 148 |
150 // Owned by us, deleted via |close()|. | 149 // Owned by us, deleted via |close()|. |
151 blink::WebView* web_view_; | 150 blink::WebView* web_view_; |
152 | 151 |
153 // Owned by us, deleted via |close()|. | 152 // Owned by us, deleted via |close()|. |
154 blink::WebFrame* web_frame_; | 153 blink::WebFrame* web_frame_; |
155 gfx::Rect rect_; | 154 gfx::Rect rect_; |
156 | 155 |
157 blink::WebURLResponse response_; | 156 blink::WebURLResponse response_; |
158 std::list<std::string> data_; | 157 std::list<std::string> data_; |
159 bool finished_loading_; | 158 bool finished_loading_; |
160 scoped_ptr<blink::WebURLError> error_; | 159 scoped_ptr<blink::WebURLError> error_; |
161 blink::WebString old_title_; | 160 blink::WebString old_title_; |
162 bool focused_; | 161 bool focused_; |
163 }; | 162 }; |
164 | 163 |
165 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 164 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
OLD | NEW |