OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_GLUE_WEBPLUGIN_H__ | 5 #ifndef WEBKIT_GLUE_WEBPLUGIN_H_ |
6 #define WEBKIT_GLUE_WEBPLUGIN_H__ | 6 #define WEBKIT_GLUE_WEBPLUGIN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/gfx/rect.h" | 12 #include "base/gfx/rect.h" |
13 #include "base/gfx/native_widget_types.h" | 13 #include "base/gfx/native_widget_types.h" |
14 | 14 |
15 // TODO(port): this typedef is obviously incorrect on non-Windows | 15 // TODO(port): this typedef is obviously incorrect on non-Windows |
16 // platforms, but now a lot of code now accidentally depends on them | 16 // platforms, but now a lot of code now accidentally depends on them |
17 // existing. #ifdef out these declarations and fix all the users. | 17 // existing. #ifdef out these declarations and fix all the users. |
18 typedef void* HANDLE; | 18 typedef void* HANDLE; |
19 | 19 |
20 class GURL; | 20 class GURL; |
| 21 struct NPObject; |
| 22 |
| 23 namespace WebKit { |
| 24 class WebFrame; |
| 25 } |
| 26 |
| 27 namespace webkit_glue { |
| 28 |
| 29 class WebPluginParentView; |
21 class WebPluginResourceClient; | 30 class WebPluginResourceClient; |
22 | 31 |
23 struct NPObject; | |
24 | |
25 // Describes the new location for a plugin window. | 32 // Describes the new location for a plugin window. |
26 struct WebPluginGeometry { | 33 struct WebPluginGeometry { |
27 // On Windows, this is the plugin window in the plugin process. | 34 // On Windows, this is the plugin window in the plugin process. |
28 // On X11, this is the XID of the plugin-side GtkPlug containing the | 35 // On X11, this is the XID of the plugin-side GtkPlug containing the |
29 // GtkSocket hosting the actual plugin window. | 36 // GtkSocket hosting the actual plugin window. |
30 gfx::PluginWindowHandle window; | 37 gfx::PluginWindowHandle window; |
31 gfx::Rect window_rect; | 38 gfx::Rect window_rect; |
32 // Clip rect (include) and cutouts (excludes), relative to | 39 // Clip rect (include) and cutouts (excludes), relative to |
33 // window_rect origin. | 40 // window_rect origin. |
34 gfx::Rect clip_rect; | 41 gfx::Rect clip_rect; |
35 std::vector<gfx::Rect> cutout_rects; | 42 std::vector<gfx::Rect> cutout_rects; |
36 bool rects_valid; | 43 bool rects_valid; |
37 bool visible; | 44 bool visible; |
38 }; | 45 }; |
39 | 46 |
40 | |
41 enum RoutingStatus { | |
42 ROUTED, | |
43 NOT_ROUTED, | |
44 INVALID_URL, | |
45 GENERAL_FAILURE | |
46 }; | |
47 | |
48 // The WebKit side of a plugin implementation. It provides wrappers around | 47 // The WebKit side of a plugin implementation. It provides wrappers around |
49 // operations that need to interact with the frame and other WebCore objects. | 48 // operations that need to interact with the frame and other WebCore objects. |
50 class WebPlugin { | 49 class WebPlugin { |
51 public: | 50 public: |
52 WebPlugin() { } | 51 virtual ~WebPlugin() {} |
53 virtual ~WebPlugin() { } | |
54 | 52 |
55 // Called by the plugin delegate to let the WebPlugin know if the plugin is | 53 // Called by the plugin delegate to let the WebPlugin know if the plugin is |
56 // windowed (i.e. handle is not NULL) or windowless (handle is NULL). This | 54 // windowed (i.e. handle is not NULL) or windowless (handle is NULL). This |
57 // tells the WebPlugin to send mouse/keyboard events to the plugin delegate, | 55 // tells the WebPlugin to send mouse/keyboard events to the plugin delegate, |
58 // as well as the information about the HDC for paint operations. | 56 // as well as the information about the HDC for paint operations. |
59 virtual void SetWindow(gfx::PluginWindowHandle window) = 0; | 57 virtual void SetWindow(gfx::PluginWindowHandle window) = 0; |
60 | 58 |
61 // Called by the plugin delegate to let it know that the window is being | 59 // Called by the plugin delegate to let it know that the window is being |
62 // destroyed. | 60 // destroyed. |
63 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) = 0; | 61 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) = 0; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Returns true iff in off the record (Incognito) mode. | 118 // Returns true iff in off the record (Incognito) mode. |
121 virtual bool IsOffTheRecord() = 0; | 119 virtual bool IsOffTheRecord() = 0; |
122 | 120 |
123 // Called when the WebPluginResourceClient instance is deleted. | 121 // Called when the WebPluginResourceClient instance is deleted. |
124 virtual void ResourceClientDeleted( | 122 virtual void ResourceClientDeleted( |
125 WebPluginResourceClient* resource_client) {} | 123 WebPluginResourceClient* resource_client) {} |
126 | 124 |
127 // Defers the loading of the resource identified by resource_id. This is | 125 // Defers the loading of the resource identified by resource_id. This is |
128 // controlled by the defer parameter. | 126 // controlled by the defer parameter. |
129 virtual void SetDeferResourceLoading(int resource_id, bool defer) = 0; | 127 virtual void SetDeferResourceLoading(int resource_id, bool defer) = 0; |
130 | |
131 private: | |
132 DISALLOW_EVIL_CONSTRUCTORS(WebPlugin); | |
133 }; | 128 }; |
134 | 129 |
135 // Simpler version of ResourceHandleClient that lends itself to proxying. | 130 // Simpler version of ResourceHandleClient that lends itself to proxying. |
136 class WebPluginResourceClient { | 131 class WebPluginResourceClient { |
137 public: | 132 public: |
138 virtual ~WebPluginResourceClient() {} | 133 virtual ~WebPluginResourceClient() {} |
139 virtual void WillSendRequest(const GURL& url) = 0; | 134 virtual void WillSendRequest(const GURL& url) = 0; |
140 // The request_is_seekable parameter indicates whether byte range requests | 135 // The request_is_seekable parameter indicates whether byte range requests |
141 // can be issued for the underlying stream. | 136 // can be issued for the underlying stream. |
142 virtual void DidReceiveResponse(const std::string& mime_type, | 137 virtual void DidReceiveResponse(const std::string& mime_type, |
143 const std::string& headers, | 138 const std::string& headers, |
144 uint32 expected_length, | 139 uint32 expected_length, |
145 uint32 last_modified, | 140 uint32 last_modified, |
146 bool request_is_seekable) = 0; | 141 bool request_is_seekable) = 0; |
147 virtual void DidReceiveData(const char* buffer, int length, | 142 virtual void DidReceiveData(const char* buffer, int length, |
148 int data_offset) = 0; | 143 int data_offset) = 0; |
149 virtual void DidFinishLoading() = 0; | 144 virtual void DidFinishLoading() = 0; |
150 virtual void DidFail() = 0; | 145 virtual void DidFail() = 0; |
151 virtual bool IsMultiByteResponseExpected() = 0; | 146 virtual bool IsMultiByteResponseExpected() = 0; |
152 }; | 147 }; |
153 | 148 |
| 149 } // namespace webkit_glue |
154 | 150 |
155 #endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_H__ | 151 #endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_H_ |
OLD | NEW |