| 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" |
| 11 #include "base/sequenced_task_runner_helpers.h" | 11 #include "base/sequenced_task_runner_helpers.h" |
| 12 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 12 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
| 13 #include "third_party/WebKit/public/platform/WebString.h" | 13 #include "third_party/WebKit/public/platform/WebString.h" |
| 14 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 14 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 15 #include "third_party/WebKit/public/web/WebFrameClient.h" | 15 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 16 #include "third_party/WebKit/public/web/WebKit.h" |
| 16 #include "third_party/WebKit/public/web/WebPlugin.h" | 17 #include "third_party/WebKit/public/web/WebPlugin.h" |
| 17 #include "third_party/WebKit/public/web/WebViewClient.h" | 18 #include "third_party/WebKit/public/web/WebViewClient.h" |
| 18 | 19 |
| 19 namespace blink { | 20 namespace blink { |
| 20 class WebMouseEvent; | 21 class WebMouseEvent; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 class RenderView; | 25 class RenderView; |
| 25 struct WebPreferences; | 26 struct WebPreferences; |
| 26 } | 27 } |
| 27 | 28 |
| 28 // This class implements the WebPlugin interface by forwarding drawing and | 29 // This class implements the WebPlugin interface by forwarding drawing and |
| 29 // handling input events to a WebView. | 30 // handling input events to a WebView. |
| 30 // It can be used as a placeholder for an actual plugin, using HTML for the UI. | 31 // It can be used as a placeholder for an actual plugin, using HTML for the UI. |
| 31 // To show HTML data inside the WebViewPlugin, | 32 // To show HTML data inside the WebViewPlugin, |
| 32 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake | 33 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake |
| 33 // chrome:// URL as origin. | 34 // chrome:// URL as origin. |
| 34 | 35 |
| 35 class WebViewPlugin : public blink::WebPlugin, | 36 class WebViewPlugin : public blink::WebPlugin, |
| 36 public blink::WebViewClient, | 37 public blink::WebViewClient, |
| 37 public blink::WebFrameClient { | 38 public blink::WebFrameClient { |
| 38 public: | 39 public: |
| 39 class Delegate { | 40 class Delegate { |
| 40 public: | 41 public: |
| 41 // Bind |frame| to a Javascript object, enabling the delegate to receive | 42 // Called to get the V8 handle used to bind the lifetime to the frame. |
| 42 // callback methods from Javascript inside the WebFrame. | 43 virtual v8::Local<v8::Value> GetV8Handle(v8::Isolate*) = 0; |
| 43 // This method is called from WebFrameClient::didClearWindowObject. | |
| 44 virtual void BindWebFrame(blink::WebFrame* frame) = 0; | |
| 45 | 44 |
| 46 // Called upon a context menu event. | 45 // Called upon a context menu event. |
| 47 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; | 46 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; |
| 48 | 47 |
| 49 // Called when the WebViewPlugin is destroyed. | 48 // Called when the WebViewPlugin is destroyed. |
| 50 virtual void PluginDestroyed() = 0; | 49 virtual void PluginDestroyed() = 0; |
| 51 | 50 |
| 52 // Called to enable JavaScript pass-through to a throttled plugin, which is | 51 // Called to enable JavaScript pass-through to a throttled plugin, which is |
| 53 // loaded but idle. Doesn't work for blocked plugins, which is not loaded. | 52 // loaded but idle. Doesn't work for blocked plugins, which is not loaded. |
| 54 virtual v8::Local<v8::Object> GetV8ScriptableObject(v8::Isolate*) const = 0; | 53 virtual v8::Local<v8::Object> GetV8ScriptableObject(v8::Isolate*) const = 0; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 162 |
| 164 blink::WebURLResponse response_; | 163 blink::WebURLResponse response_; |
| 165 std::list<std::string> data_; | 164 std::list<std::string> data_; |
| 166 bool finished_loading_; | 165 bool finished_loading_; |
| 167 scoped_ptr<blink::WebURLError> error_; | 166 scoped_ptr<blink::WebURLError> error_; |
| 168 blink::WebString old_title_; | 167 blink::WebString old_title_; |
| 169 bool focused_; | 168 bool focused_; |
| 170 }; | 169 }; |
| 171 | 170 |
| 172 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 171 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| OLD | NEW |