Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 // Bind |frame| to a Javascript object, enabling the delegate to receive | 41 // Bind |frame| to a Javascript object, enabling the delegate to receive |
| 42 // callback methods from Javascript inside the WebFrame. | 42 // callback methods from Javascript inside the WebFrame. |
| 43 // This method is called from WebFrameClient::didClearWindowObject. | 43 // This method is called from WebFrameClient::didClearWindowObject. |
| 44 virtual void BindWebFrame(blink::WebFrame* frame) = 0; | 44 virtual void BindWebFrame(blink::WebFrame* frame) = 0; |
| 45 | 45 |
| 46 // Called upon a context menu event. | 46 // Called upon a context menu event. |
| 47 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; | 47 virtual void ShowContextMenu(const blink::WebMouseEvent&) = 0; |
| 48 | 48 |
| 49 // Called when the WebViewPlugin is destroyed. | 49 // Called when the WebViewPlugin is destroyed. |
| 50 virtual void PluginDestroyed() = 0; | 50 virtual void PluginDestroyed() = 0; |
| 51 | |
| 52 // Called to enable JavaScript pass-through to an underlying plugin object. | |
|
Bernhard Bauer
2015/05/07 10:07:13
Can you add a comment to state that this only work
tommycli
2015/05/07 17:22:59
Done.
| |
| 53 virtual v8::Local<v8::Object> GetV8ScriptableObject(v8::Isolate*) const = 0; | |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 // Convenience method to set up a new WebViewPlugin using |preferences| | 56 // Convenience method to set up a new WebViewPlugin using |preferences| |
| 54 // and displaying |html_data|. |url| should be a (fake) data:text/html URL; | 57 // and displaying |html_data|. |url| should be a (fake) data:text/html URL; |
| 55 // it is only used for navigation and never actually resolved. | 58 // it is only used for navigation and never actually resolved. |
| 56 static WebViewPlugin* Create(Delegate* delegate, | 59 static WebViewPlugin* Create(Delegate* delegate, |
| 57 const content::WebPreferences& preferences, | 60 const content::WebPreferences& preferences, |
| 58 const std::string& html_data, | 61 const std::string& html_data, |
| 59 const GURL& url); | 62 const GURL& url); |
| 60 | 63 |
| 61 blink::WebView* web_view() { return web_view_; } | 64 blink::WebView* web_view() { return web_view_; } |
| 62 | 65 |
| 63 // When loading a plugin document (i.e. a full page plugin not embedded in | 66 // When loading a plugin document (i.e. a full page plugin not embedded in |
| 64 // another page), we save all data that has been received, and replay it with | 67 // another page), we save all data that has been received, and replay it with |
| 65 // this method on the actual plugin. | 68 // this method on the actual plugin. |
| 66 void ReplayReceivedData(blink::WebPlugin* plugin); | 69 void ReplayReceivedData(blink::WebPlugin* plugin); |
| 67 | 70 |
| 68 void RestoreTitleText(); | 71 void RestoreTitleText(); |
| 69 | 72 |
| 70 // WebPlugin methods: | 73 // WebPlugin methods: |
| 71 virtual blink::WebPluginContainer* container() const; | 74 virtual blink::WebPluginContainer* container() const; |
| 72 virtual bool initialize(blink::WebPluginContainer*); | 75 virtual bool initialize(blink::WebPluginContainer*); |
| 73 virtual void destroy(); | 76 virtual void destroy(); |
| 74 | 77 |
| 75 virtual NPObject* scriptableObject(); | 78 virtual v8::Local<v8::Object> v8ScriptableObject(v8::Isolate* isolate); |
| 76 virtual struct _NPP* pluginNPP(); | |
| 77 | |
| 78 virtual bool getFormValue(blink::WebString& value); | |
| 79 | 79 |
| 80 virtual void layoutIfNeeded() override; | 80 virtual void layoutIfNeeded() override; |
| 81 virtual void paint(blink::WebCanvas* canvas, | 81 virtual void paint(blink::WebCanvas* canvas, |
| 82 const blink::WebRect& rect) override; | 82 const blink::WebRect& rect) override; |
| 83 | 83 |
| 84 // Coordinates are relative to the containing window. | 84 // Coordinates are relative to the containing window. |
| 85 virtual void updateGeometry( | 85 virtual void updateGeometry( |
| 86 const blink::WebRect& window_rect, | 86 const blink::WebRect& window_rect, |
| 87 const blink::WebRect& clip_rect, | 87 const blink::WebRect& clip_rect, |
| 88 const blink::WebRect& unobscured_rect, | 88 const blink::WebRect& unobscured_rect, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 | 162 |
| 163 blink::WebURLResponse response_; | 163 blink::WebURLResponse response_; |
| 164 std::list<std::string> data_; | 164 std::list<std::string> data_; |
| 165 bool finished_loading_; | 165 bool finished_loading_; |
| 166 scoped_ptr<blink::WebURLError> error_; | 166 scoped_ptr<blink::WebURLError> error_; |
| 167 blink::WebString old_title_; | 167 blink::WebString old_title_; |
| 168 bool focused_; | 168 bool focused_; |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ | 171 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
| OLD | NEW |