| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_NPAPI_WEBVIEW_PLUGIN_H_ | 5 #ifndef WEBKIT_PLUGINS_WEBVIEW_PLUGIN_H_ |
| 6 #define WEBKIT_PLUGINS_NPAPI_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/task.h" | 11 #include "base/task.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/WebString.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" | |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" |
| 19 | 18 |
| 20 namespace WebKit { | 19 namespace WebKit { |
| 21 class WebMouseEvent; | 20 class WebMouseEvent; |
| 22 } | 21 } |
| 23 struct WebPreferences; | 22 struct WebPreferences; |
| 24 | 23 |
| 25 namespace webkit { | 24 namespace webkit { |
| 26 namespace npapi { | |
| 27 | 25 |
| 28 // This class implements the WebPlugin interface by forwarding drawing and | 26 // This class implements the WebPlugin interface by forwarding drawing and |
| 29 // handling input events to a WebView. | 27 // handling input events to a WebView. |
| 30 // It can be used as a placeholder for an actual plugin, using HTML for the UI. | 28 // It can be used as a placeholder for an actual plugin, using HTML for the UI. |
| 31 // To show HTML data inside the WebViewPlugin, | 29 // To show HTML data inside the WebViewPlugin, |
| 32 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake | 30 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake |
| 33 // chrome:// URL as origin. | 31 // chrome:// URL as origin. |
| 34 | 32 |
| 35 class WebViewPlugin: public WebKit::WebPlugin, public WebKit::WebViewClient, | 33 class WebViewPlugin: public WebKit::WebPlugin, public WebKit::WebViewClient, |
| 36 public WebKit::WebFrameClient { | 34 public WebKit::WebFrameClient { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // (which does nothing) to correctly overload it. | 132 // (which does nothing) to correctly overload it. |
| 135 virtual void didReceiveResponse(WebKit::WebFrame* frame, | 133 virtual void didReceiveResponse(WebKit::WebFrame* frame, |
| 136 unsigned identifier, | 134 unsigned identifier, |
| 137 const WebKit::WebURLResponse& response); | 135 const WebKit::WebURLResponse& response); |
| 138 | 136 |
| 139 private: | 137 private: |
| 140 friend class DeleteTask<WebViewPlugin>; | 138 friend class DeleteTask<WebViewPlugin>; |
| 141 virtual ~WebViewPlugin(); | 139 virtual ~WebViewPlugin(); |
| 142 | 140 |
| 143 Delegate* delegate_; | 141 Delegate* delegate_; |
| 142 // Destroys itself. |
| 144 WebKit::WebCursorInfo current_cursor_; | 143 WebKit::WebCursorInfo current_cursor_; |
| 144 // Owns us. |
| 145 WebKit::WebPluginContainer* container_; | 145 WebKit::WebPluginContainer* container_; |
| 146 // Owned by us, deleted via |close()|. |
| 146 WebKit::WebView* web_view_; | 147 WebKit::WebView* web_view_; |
| 147 gfx::Rect rect_; | 148 gfx::Rect rect_; |
| 148 | 149 |
| 149 WebKit::WebURLResponse response_; | 150 WebKit::WebURLResponse response_; |
| 150 std::list<std::string> data_; | 151 std::list<std::string> data_; |
| 151 bool finished_loading_; | 152 bool finished_loading_; |
| 152 scoped_ptr<WebKit::WebURLError> error_; | 153 scoped_ptr<WebKit::WebURLError> error_; |
| 153 WebKit::WebString old_title_; | 154 WebKit::WebString old_title_; |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 } // namespace npapi | |
| 157 } // namespace webkit | 157 } // namespace webkit |
| 158 | 158 |
| 159 #endif // WEBKIT_PLUGINS_NPAPI_WEBVIEW_PLUGIN_H_ | 159 #endif // WEBKIT_PLUGINS_WEBVIEW_PLUGIN_H_ |
| OLD | NEW |