Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1052)

Side by Side Diff: webkit/glue/plugins/webplugin.h

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/plugins/test/resource.h ('k') | webkit/glue/plugins/webplugin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_GLUE_WEBPLUGIN_H_
6 #define WEBKIT_GLUE_WEBPLUGIN_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "gfx/native_widget_types.h"
13 #include "gfx/rect.h"
14
15 // TODO(port): this typedef is obviously incorrect on non-Windows
16 // platforms, but now a lot of code now accidentally depends on them
17 // existing. #ifdef out these declarations and fix all the users.
18 typedef void* HANDLE;
19
20 class GURL;
21 struct NPObject;
22
23 namespace WebKit {
24 class WebFrame;
25 }
26
27 namespace webkit_glue {
28
29 class WebPluginDelegate;
30 class WebPluginParentView;
31 class WebPluginResourceClient;
32 #if defined(OS_MACOSX)
33 class WebPluginAcceleratedSurface;
34 #endif
35
36 // Describes the new location for a plugin window.
37 struct WebPluginGeometry {
38 WebPluginGeometry();
39 ~WebPluginGeometry();
40
41 bool Equals(const WebPluginGeometry& rhs) const;
42
43 // On Windows, this is the plugin window in the plugin process.
44 // On X11, this is the XID of the plugin-side GtkPlug containing the
45 // GtkSocket hosting the actual plugin window.
46 //
47 // On Mac OS X, all of the plugin types are currently "windowless"
48 // (window == 0) except for the special case of the GPU plugin,
49 // which currently performs rendering on behalf of the Pepper 3D API
50 // and WebGL. The GPU plugin uses a simple integer for the
51 // PluginWindowHandle which is used to map to a side data structure
52 // containing information about the plugin. Soon this plugin will be
53 // generalized, at which point this mechanism will be rethought or
54 // removed.
55 gfx::PluginWindowHandle window;
56 gfx::Rect window_rect;
57 // Clip rect (include) and cutouts (excludes), relative to
58 // window_rect origin.
59 gfx::Rect clip_rect;
60 std::vector<gfx::Rect> cutout_rects;
61 bool rects_valid;
62 bool visible;
63 };
64
65 // The WebKit side of a plugin implementation. It provides wrappers around
66 // operations that need to interact with the frame and other WebCore objects.
67 class WebPlugin {
68 public:
69 virtual ~WebPlugin() {}
70
71 // Called by the plugin delegate to let the WebPlugin know if the plugin is
72 // windowed (i.e. handle is not NULL) or windowless (handle is NULL). This
73 // tells the WebPlugin to send mouse/keyboard events to the plugin delegate,
74 // as well as the information about the HDC for paint operations.
75 virtual void SetWindow(gfx::PluginWindowHandle window) = 0;
76
77 // Whether input events should be sent to the delegate.
78 virtual void SetAcceptsInputEvents(bool accepts) = 0;
79
80 // Called by the plugin delegate to let it know that the window is being
81 // destroyed.
82 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) = 0;
83 #if defined(OS_WIN)
84 // The pump_messages_event is a event handle which is valid only for
85 // windowless plugins and is used in NPP_HandleEvent calls to pump messages
86 // if the plugin enters a modal loop.
87 // Cancels a pending request.
88 virtual void SetWindowlessPumpEvent(HANDLE pump_messages_event) = 0;
89 #endif
90 virtual void CancelResource(unsigned long id) = 0;
91 virtual void Invalidate() = 0;
92 virtual void InvalidateRect(const gfx::Rect& rect) = 0;
93
94 // Returns the NPObject for the browser's window object.
95 virtual NPObject* GetWindowScriptNPObject() = 0;
96
97 // Returns the DOM element that loaded the plugin.
98 virtual NPObject* GetPluginElement() = 0;
99
100 // Cookies
101 virtual void SetCookie(const GURL& url,
102 const GURL& first_party_for_cookies,
103 const std::string& cookie) = 0;
104 virtual std::string GetCookies(const GURL& url,
105 const GURL& first_party_for_cookies) = 0;
106
107 // Shows a modal HTML dialog containing the given URL. json_arguments are
108 // passed to the dialog via the DOM 'window.chrome.dialogArguments', and the
109 // retval is the string returned by 'window.chrome.send("DialogClose",
110 // retval)'.
111 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height,
112 const std::string& json_arguments,
113 std::string* json_retval) = 0;
114
115 // When a default plugin has downloaded the plugin list and finds it is
116 // available, it calls this method to notify the renderer. Also it will update
117 // the status when user clicks on the plugin to install.
118 virtual void OnMissingPluginStatus(int status) = 0;
119
120 // Handles GetURL/GetURLNotify/PostURL/PostURLNotify requests initiated
121 // by plugins. If the plugin wants notification of the result, notify_id will
122 // be non-zero.
123 virtual void HandleURLRequest(const char* url,
124 const char* method,
125 const char* target,
126 const char* buf,
127 unsigned int len,
128 int notify_id,
129 bool popups_allowed,
130 bool notify_redirects) = 0;
131
132 // Cancels document load.
133 virtual void CancelDocumentLoad() = 0;
134
135 // Initiates a HTTP range request for an existing stream.
136 virtual void InitiateHTTPRangeRequest(const char* url,
137 const char* range_info,
138 int range_request_id) = 0;
139
140 // Returns true iff in off the record (Incognito) mode.
141 virtual bool IsOffTheRecord() = 0;
142
143 // Called when the WebPluginResourceClient instance is deleted.
144 virtual void ResourceClientDeleted(
145 WebPluginResourceClient* resource_client) {}
146
147 // Defers the loading of the resource identified by resource_id. This is
148 // controlled by the defer parameter.
149 virtual void SetDeferResourceLoading(unsigned long resource_id,
150 bool defer) = 0;
151
152 #if defined(OS_MACOSX)
153 // Enables/disables plugin IME.
154 virtual void SetImeEnabled(bool enabled) {};
155
156 // Synthesize a fake window handle for the plug-in to identify the instance
157 // to the browser, allowing mapping to a surface for hardware accelleration
158 // of plug-in content. The browser generates the handle which is then set on
159 // the plug-in. |opaque| indicates whether the content should be treated as
160 // opaque or translucent.
161 // TODO(stuartmorgan): Move this into WebPluginProxy.
162 virtual void BindFakePluginWindowHandle(bool opaque) {}
163
164 // Returns the accelerated surface abstraction for accelerated plugins.
165 virtual WebPluginAcceleratedSurface* GetAcceleratedSurface() { return NULL; }
166 #endif
167
168 // Gets the WebPluginDelegate that implements the interface.
169 // This API is only for use with Pepper, and is only overridden
170 // by in-renderer implementations.
171 virtual WebPluginDelegate* delegate();
172
173 // Handles NPN_URLRedirectResponse calls issued by plugins in response to
174 // HTTP URL redirect notifications.
175 virtual void URLRedirectResponse(bool allow, int resource_id) = 0;
176 };
177
178 // Simpler version of ResourceHandleClient that lends itself to proxying.
179 class WebPluginResourceClient {
180 public:
181 virtual ~WebPluginResourceClient() {}
182 virtual void WillSendRequest(const GURL& url, int http_status_code) = 0;
183 // The request_is_seekable parameter indicates whether byte range requests
184 // can be issued for the underlying stream.
185 virtual void DidReceiveResponse(const std::string& mime_type,
186 const std::string& headers,
187 uint32 expected_length,
188 uint32 last_modified,
189 bool request_is_seekable) = 0;
190 virtual void DidReceiveData(const char* buffer, int length,
191 int data_offset) = 0;
192 virtual void DidFinishLoading() = 0;
193 virtual void DidFail() = 0;
194 virtual bool IsMultiByteResponseExpected() = 0;
195 virtual int ResourceId() = 0;
196 };
197
198 } // namespace webkit_glue
199
200 #endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_H_
OLDNEW
« no previous file with comments | « webkit/glue/plugins/test/resource.h ('k') | webkit/glue/plugins/webplugin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698