| 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 namespace gfx { | 29 namespace gfx { |
| 29 class Size; | 30 class Size; |
| 30 } | 31 } |
| 31 | 32 |
| 32 // This class implements the WebPlugin interface by forwarding drawing and | 33 // This class implements the WebPlugin interface by forwarding drawing and |
| 33 // handling input events to a WebView. | 34 // handling input events to a WebView. |
| 34 // It can be used as a placeholder for an actual plugin, using HTML for the UI. | 35 // It can be used as a placeholder for an actual plugin, using HTML for the UI. |
| 35 // To show HTML data inside the WebViewPlugin, | 36 // To show HTML data inside the WebViewPlugin, |
| 36 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake | 37 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake |
| 37 // chrome:// URL as origin. | 38 // chrome:// URL as origin. |
| 38 | 39 |
| 39 class WebViewPlugin : public blink::WebPlugin, | 40 class WebViewPlugin : public blink::WebPlugin, |
| 40 public blink::WebViewClient, | 41 public blink::WebViewClient, |
| 41 public blink::WebFrameClient { | 42 public blink::WebFrameClient { |
| 42 public: | 43 public: |
| 43 class Delegate { | 44 class Delegate { |
| 44 public: | 45 public: |
| 45 // Bind |frame| to a Javascript object, enabling the delegate to receive | 46 // Called to get the V8 handle used to bind the lifetime to the frame. |
| 46 // callback methods from Javascript inside the WebFrame. | 47 virtual v8::Local<v8::Value> GetV8Handle(v8::Isolate*) = 0; |
| 47 // This method is called from WebFrameClient::didClearWindowObject. | |
| 48 virtual void BindWebFrame(blink::WebFrame* frame) = 0; | |
| 49 | 48 |
| 50 // Called upon a context menu event. | 49 // Called upon a context menu event. |
| 51 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; | 50 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; |
| 52 | 51 |
| 53 // Called when the WebViewPlugin is destroyed. | 52 // Called when the WebViewPlugin is destroyed. |
| 54 virtual void PluginDestroyed() = 0; | 53 virtual void PluginDestroyed() = 0; |
| 55 | 54 |
| 56 // Called to enable JavaScript pass-through to a throttled plugin, which is | 55 // Called to enable JavaScript pass-through to a throttled plugin, which is |
| 57 // loaded but idle. Doesn't work for blocked plugins, which is not loaded. | 56 // loaded but idle. Doesn't work for blocked plugins, which is not loaded. |
| 58 virtual v8::Local<v8::Object> GetV8ScriptableObject(v8::Isolate*) const = 0; | 57 virtual v8::Local<v8::Object> GetV8ScriptableObject(v8::Isolate*) const = 0; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 169 |
| 171 blink::WebURLResponse response_; | 170 blink::WebURLResponse response_; |
| 172 std::list<std::string> data_; | 171 std::list<std::string> data_; |
| 173 bool finished_loading_; | 172 bool finished_loading_; |
| 174 scoped_ptr<blink::WebURLError> error_; | 173 scoped_ptr<blink::WebURLError> error_; |
| 175 blink::WebString old_title_; | 174 blink::WebString old_title_; |
| 176 bool focused_; | 175 bool focused_; |
| 177 }; | 176 }; |
| 178 | 177 |
| 179 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 178 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| OLD | NEW |