OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GLUE_PLUGINS_WEBVIEW_PLUGIN_H_ |
6 #define WEBKIT_PLUGINS_NPAPI_WEBVIEW_PLUGIN_H_ | 6 #define WEBKIT_GLUE_PLUGINS_WEBVIEW_PLUGIN_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "base/task.h" | 11 #include "base/task.h" |
12 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
13 #include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h" |
14 #include "third_party/WebKit/WebKit/chromium/public/WebPlugin.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebPlugin.h" |
15 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
16 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" |
17 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" |
18 #include "third_party/WebKit/WebKit/chromium/public/WebViewClient.h" | 18 #include "third_party/WebKit/WebKit/chromium/public/WebViewClient.h" |
19 | 19 |
20 namespace WebKit { | 20 namespace WebKit { |
21 class WebMouseEvent; | 21 class WebMouseEvent; |
22 } | 22 } |
23 struct WebPreferences; | 23 struct WebPreferences; |
24 | 24 |
25 namespace webkit { | |
26 namespace npapi { | |
27 | |
28 // This class implements the WebPlugin interface by forwarding drawing and | 25 // This class implements the WebPlugin interface by forwarding drawing and |
29 // handling input events to a WebView. | 26 // handling input events to a WebView. |
30 // It can be used as a placeholder for an actual plugin, using HTML for the UI. | 27 // It can be used as a placeholder for an actual plugin, using HTML for the UI. |
31 // To show HTML data inside the WebViewPlugin, | 28 // To show HTML data inside the WebViewPlugin, |
32 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake | 29 // call web_view->mainFrame()->loadHTMLString() with the HTML data and a fake |
33 // chrome:// URL as origin. | 30 // chrome:// URL as origin. |
34 | 31 |
35 class WebViewPlugin: public WebKit::WebPlugin, public WebKit::WebViewClient, | 32 class WebViewPlugin: public WebKit::WebPlugin, public WebKit::WebViewClient, |
36 public WebKit::WebFrameClient { | 33 public WebKit::WebFrameClient { |
37 public: | 34 public: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 72 |
76 virtual NPObject* scriptableObject(); | 73 virtual NPObject* scriptableObject(); |
77 | 74 |
78 virtual void paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect); | 75 virtual void paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect); |
79 | 76 |
80 // Coordinates are relative to the containing window. | 77 // Coordinates are relative to the containing window. |
81 virtual void updateGeometry( | 78 virtual void updateGeometry( |
82 const WebKit::WebRect& frame_rect, const WebKit::WebRect& clip_rect, | 79 const WebKit::WebRect& frame_rect, const WebKit::WebRect& clip_rect, |
83 const WebKit::WebVector<WebKit::WebRect>& cut_out_rects, bool is_visible); | 80 const WebKit::WebVector<WebKit::WebRect>& cut_out_rects, bool is_visible); |
84 | 81 |
85 virtual void updateFocus(bool) {} | 82 virtual void updateFocus(bool) { } |
86 virtual void updateVisibility(bool) {} | 83 virtual void updateVisibility(bool) { } |
87 | 84 |
88 virtual bool acceptsInputEvents(); | 85 virtual bool acceptsInputEvents(); |
89 virtual bool handleInputEvent(const WebKit::WebInputEvent& event, | 86 virtual bool handleInputEvent(const WebKit::WebInputEvent& event, |
90 WebKit::WebCursorInfo& cursor_info); | 87 WebKit::WebCursorInfo& cursor_info); |
91 | 88 |
92 virtual void didReceiveResponse(const WebKit::WebURLResponse& response); | 89 virtual void didReceiveResponse(const WebKit::WebURLResponse& response); |
93 virtual void didReceiveData(const char* data, int data_length); | 90 virtual void didReceiveData(const char* data, int data_length); |
94 virtual void didFinishLoading(); | 91 virtual void didFinishLoading(); |
95 virtual void didFailLoading(const WebKit::WebURLError& error); | 92 virtual void didFailLoading(const WebKit::WebURLError& error); |
96 | 93 |
97 // Called in response to WebPluginContainer::loadFrameRequest | 94 // Called in response to WebPluginContainer::loadFrameRequest |
98 virtual void didFinishLoadingFrameRequest( | 95 virtual void didFinishLoadingFrameRequest( |
99 const WebKit::WebURL& url, void* notifyData) {} | 96 const WebKit::WebURL& url, void* notifyData) { } |
100 virtual void didFailLoadingFrameRequest(const WebKit::WebURL& url, | 97 virtual void didFailLoadingFrameRequest(const WebKit::WebURL& url, |
101 void* notify_data, | 98 void* notify_data, |
102 const WebKit::WebURLError& error) {} | 99 const WebKit::WebURLError& error) { } |
103 | 100 |
104 // WebViewClient methods: | 101 // WebViewClient methods: |
105 virtual bool acceptsLoadDrops(); | 102 virtual bool acceptsLoadDrops(); |
106 | 103 |
107 virtual void setToolTipText(const WebKit::WebString&, | 104 virtual void setToolTipText(const WebKit::WebString&, |
108 WebKit::WebTextDirection); | 105 WebKit::WebTextDirection); |
109 | 106 |
110 virtual void startDragging(const WebKit::WebDragData& drag_data, | 107 virtual void startDragging(const WebKit::WebDragData& drag_data, |
111 WebKit::WebDragOperationsMask mask, | 108 WebKit::WebDragOperationsMask mask, |
112 const WebKit::WebImage& image, | 109 const WebKit::WebImage& image, |
(...skipping 22 matching lines...) Expand all Loading... |
135 WebKit::WebView* web_view_; | 132 WebKit::WebView* web_view_; |
136 gfx::Rect rect_; | 133 gfx::Rect rect_; |
137 | 134 |
138 WebKit::WebURLResponse response_; | 135 WebKit::WebURLResponse response_; |
139 std::list<std::string> data_; | 136 std::list<std::string> data_; |
140 bool finished_loading_; | 137 bool finished_loading_; |
141 scoped_ptr<WebKit::WebURLError> error_; | 138 scoped_ptr<WebKit::WebURLError> error_; |
142 WebKit::WebString old_title_; | 139 WebKit::WebString old_title_; |
143 }; | 140 }; |
144 | 141 |
145 } // namespace npapi | 142 #endif // WEBKIT_GLUE_PLUGINS_WEBVIEW_PLUGIN_H_ |
146 } // namespace webkit | |
147 | |
148 #endif // WEBKIT_PLUGINS_NPAPI_WEBVIEW_PLUGIN_H_ | |
OLD | NEW |