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 CHROME_RENDERER_PLUGINS_WEBVIEW_PLUGIN_H_ | 5 #ifndef COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
6 #define CHROME_RENDERER_PLUGINS_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/WebString.h" | 12 #include "third_party/WebKit/public/platform/WebString.h" |
13 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 13 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
14 #include "third_party/WebKit/public/web/WebCursorInfo.h" | 14 #include "third_party/WebKit/public/web/WebCursorInfo.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/WebPlugin.h" | 16 #include "third_party/WebKit/public/web/WebPlugin.h" |
(...skipping 29 matching lines...) Expand all Loading... |
46 | 46 |
47 // Called upon a context menu event. | 47 // Called upon a context menu event. |
48 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) = 0; | 48 virtual void ShowContextMenu(const WebKit::WebMouseEvent&) = 0; |
49 }; | 49 }; |
50 | 50 |
51 explicit WebViewPlugin(Delegate* delegate); | 51 explicit WebViewPlugin(Delegate* delegate); |
52 | 52 |
53 // Convenience method to set up a new WebViewPlugin using |preferences| | 53 // Convenience method to set up a new WebViewPlugin using |preferences| |
54 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is | 54 // and displaying |html_data|. |url| should be a (fake) chrome:// URL; it is |
55 // only used for navigation and never actually resolved. | 55 // only used for navigation and never actually resolved. |
56 static WebViewPlugin* Create( | 56 static WebViewPlugin* Create(Delegate* delegate, |
57 Delegate* delegate, | 57 const WebPreferences& preferences, |
58 const WebPreferences& preferences, | 58 const std::string& html_data, |
59 const std::string& html_data, | 59 const GURL& url); |
60 const GURL& url); | |
61 | 60 |
62 WebKit::WebView* web_view() { return web_view_; } | 61 WebKit::WebView* web_view() { return web_view_; } |
63 | 62 |
64 // When loading a plug-in document (i.e. a full page plug-in not embedded in | 63 // When loading a plug-in document (i.e. a full page plug-in not embedded in |
65 // another page), we save all data that has been received, and replay it with | 64 // another page), we save all data that has been received, and replay it with |
66 // this method on the actual plug-in. | 65 // this method on the actual plug-in. |
67 void ReplayReceivedData(WebKit::WebPlugin* plugin); | 66 void ReplayReceivedData(WebKit::WebPlugin* plugin); |
68 | 67 |
69 void RestoreTitleText(); | 68 void RestoreTitleText(); |
70 | 69 |
71 // WebPlugin methods: | 70 // WebPlugin methods: |
72 virtual WebKit::WebPluginContainer* container() const; | 71 virtual WebKit::WebPluginContainer* container() const; |
73 virtual bool initialize(WebKit::WebPluginContainer*); | 72 virtual bool initialize(WebKit::WebPluginContainer*); |
74 virtual void destroy(); | 73 virtual void destroy(); |
75 | 74 |
76 virtual NPObject* scriptableObject(); | 75 virtual NPObject* scriptableObject(); |
77 virtual struct _NPP* pluginNPP(); | 76 virtual struct _NPP* pluginNPP(); |
78 | 77 |
79 virtual bool getFormValue(WebKit::WebString& value); | 78 virtual bool getFormValue(WebKit::WebString& value); |
80 | 79 |
81 virtual void paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect); | 80 virtual void paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect); |
82 | 81 |
83 // Coordinates are relative to the containing window. | 82 // Coordinates are relative to the containing window. |
84 virtual void updateGeometry( | 83 virtual void updateGeometry( |
85 const WebKit::WebRect& frame_rect, const WebKit::WebRect& clip_rect, | 84 const WebKit::WebRect& frame_rect, |
86 const WebKit::WebVector<WebKit::WebRect>& cut_out_rects, bool is_visible); | 85 const WebKit::WebRect& clip_rect, |
| 86 const WebKit::WebVector<WebKit::WebRect>& cut_out_rects, |
| 87 bool is_visible); |
87 | 88 |
88 virtual void updateFocus(bool) {} | 89 virtual void updateFocus(bool) {} |
89 virtual void updateVisibility(bool) {} | 90 virtual void updateVisibility(bool) {} |
90 | 91 |
91 virtual bool acceptsInputEvents(); | 92 virtual bool acceptsInputEvents(); |
92 virtual bool handleInputEvent(const WebKit::WebInputEvent& event, | 93 virtual bool handleInputEvent(const WebKit::WebInputEvent& event, |
93 WebKit::WebCursorInfo& cursor_info); | 94 WebKit::WebCursorInfo& cursor_info); |
94 | 95 |
95 virtual void didReceiveResponse(const WebKit::WebURLResponse& response); | 96 virtual void didReceiveResponse(const WebKit::WebURLResponse& response); |
96 virtual void didReceiveData(const char* data, int data_length); | 97 virtual void didReceiveData(const char* data, int data_length); |
97 virtual void didFinishLoading(); | 98 virtual void didFinishLoading(); |
98 virtual void didFailLoading(const WebKit::WebURLError& error); | 99 virtual void didFailLoading(const WebKit::WebURLError& error); |
99 | 100 |
100 // Called in response to WebPluginContainer::loadFrameRequest | 101 // Called in response to WebPluginContainer::loadFrameRequest |
101 virtual void didFinishLoadingFrameRequest( | 102 virtual void didFinishLoadingFrameRequest(const WebKit::WebURL& url, |
102 const WebKit::WebURL& url, void* notifyData) {} | 103 void* notifyData) {} |
103 virtual void didFailLoadingFrameRequest(const WebKit::WebURL& url, | 104 virtual void didFailLoadingFrameRequest(const WebKit::WebURL& url, |
104 void* notify_data, | 105 void* notify_data, |
105 const WebKit::WebURLError& error) {} | 106 const WebKit::WebURLError& error) {} |
106 | 107 |
107 // WebViewClient methods: | 108 // WebViewClient methods: |
108 virtual bool acceptsLoadDrops(); | 109 virtual bool acceptsLoadDrops(); |
109 | 110 |
110 virtual void setToolTipText(const WebKit::WebString&, | 111 virtual void setToolTipText(const WebKit::WebString&, |
111 WebKit::WebTextDirection); | 112 WebKit::WebTextDirection); |
112 | 113 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 WebKit::WebView* web_view_; | 145 WebKit::WebView* web_view_; |
145 gfx::Rect rect_; | 146 gfx::Rect rect_; |
146 | 147 |
147 WebKit::WebURLResponse response_; | 148 WebKit::WebURLResponse response_; |
148 std::list<std::string> data_; | 149 std::list<std::string> data_; |
149 bool finished_loading_; | 150 bool finished_loading_; |
150 scoped_ptr<WebKit::WebURLError> error_; | 151 scoped_ptr<WebKit::WebURLError> error_; |
151 WebKit::WebString old_title_; | 152 WebKit::WebString old_title_; |
152 }; | 153 }; |
153 | 154 |
154 #endif // CHROME_RENDERER_PLUGINS_WEBVIEW_PLUGIN_H_ | 155 #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |
OLD | NEW |