| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_PLUGINS_WEBVIEW_PLUGIN_H_ | 5 #ifndef WEBKIT_PLUGINS_WEBVIEW_PLUGIN_H_ |
| 6 #define WEBKIT_PLUGINS_WEBVIEW_PLUGIN_H_ | 6 #define WEBKIT_PLUGINS_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" |
| 11 #include "base/message_loop_helpers.h" | 11 #include "base/message_loop_helpers.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRespon
se.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" |
| 18 #include "webkit/plugins/webkit_plugins_export.h" | 18 #include "webkit/plugins/webkit_plugins_export.h" |
| 19 | 19 |
| 20 namespace WebKit { | 20 namespace WebKit { |
| 21 class WebMouseEvent; | 21 class WebMouseEvent; |
| 22 } | 22 } |
| 23 |
| 24 namespace webkit_glue { |
| 23 struct WebPreferences; | 25 struct WebPreferences; |
| 26 } |
| 24 | 27 |
| 25 namespace webkit { | 28 namespace webkit { |
| 26 | 29 |
| 27 // This class implements the WebPlugin interface by forwarding drawing and | 30 // This class implements the WebPlugin interface by forwarding drawing and |
| 28 // handling input events to a WebView. | 31 // handling input events to a WebView. |
| 29 // It can be used as a placeholder for an actual plugin, using HTML for the UI. | 32 // It can be used as a placeholder for an actual plugin, using HTML for the UI. |
| 30 // To show HTML data inside the WebViewPlugin, | 33 // To show HTML data inside the WebViewPlugin, |
| 31 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake | 34 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake |
| 32 // chrome:// URL as origin. | 35 // chrome:// URL as origin. |
| 33 | 36 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 49 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) = 0; | 52 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) = 0; |
| 50 }; | 53 }; |
| 51 | 54 |
| 52 explicit WebViewPlugin(Delegate* delegate); | 55 explicit WebViewPlugin(Delegate* delegate); |
| 53 | 56 |
| 54 // Convenience method to set up a new WebViewPlugin using |preferences| | 57 // Convenience method to set up a new WebViewPlugin using |preferences| |
| 55 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is | 58 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is |
| 56 // only used for navigation and never actually resolved. | 59 // only used for navigation and never actually resolved. |
| 57 WEBKIT_PLUGINS_EXPORT static WebViewPlugin* Create( | 60 WEBKIT_PLUGINS_EXPORT static WebViewPlugin* Create( |
| 58 Delegate* delegate, | 61 Delegate* delegate, |
| 59 const WebPreferences& preferences, | 62 const webkit_glue::WebPreferences& preferences, |
| 60 const std::string& html_data, | 63 const std::string& html_data, |
| 61 const GURL& url); | 64 const GURL& url); |
| 62 | 65 |
| 63 WebKit::WebView* web_view() { return web_view_; } | 66 WebKit::WebView* web_view() { return web_view_; } |
| 64 | 67 |
| 65 // When loading a plug-in document (i.e. a full page plug-in not embedded in | 68 // When loading a plug-in document (i.e. a full page plug-in not embedded in |
| 66 // another page), we save all data that has been received, and replay it with | 69 // another page), we save all data that has been received, and replay it with |
| 67 // this method on the actual plug-in. | 70 // this method on the actual plug-in. |
| 68 WEBKIT_PLUGINS_EXPORT void ReplayReceivedData(WebKit::WebPlugin* plugin); | 71 WEBKIT_PLUGINS_EXPORT void ReplayReceivedData(WebKit::WebPlugin* plugin); |
| 69 | 72 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 WebKit::WebURLResponse response_; | 154 WebKit::WebURLResponse response_; |
| 152 std::list<std::string> data_; | 155 std::list<std::string> data_; |
| 153 bool finished_loading_; | 156 bool finished_loading_; |
| 154 scoped_ptr<WebKit::WebURLError> error_; | 157 scoped_ptr<WebKit::WebURLError> error_; |
| 155 WebKit::WebString old_title_; | 158 WebKit::WebString old_title_; |
| 156 }; | 159 }; |
| 157 | 160 |
| 158 } // namespace webkit | 161 } // namespace webkit |
| 159 | 162 |
| 160 #endif // WEBKIT_PLUGINS_WEBVIEW_PLUGIN_H_ | 163 #endif // WEBKIT_PLUGINS_WEBVIEW_PLUGIN_H_ |
| OLD | NEW |