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

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

Issue 19761007: Move NPAPI implementation out of webkit/plugins/npapi and into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 7 years, 5 months 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_H_
6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/gfx/rect.h"
14 #include "ui/gl/gpu_preference.h"
15 #include "webkit/plugins/webkit_plugins_export.h"
16
17 // TODO(port): this typedef is obviously incorrect on non-Windows
18 // platforms, but now a lot of code now accidentally depends on them
19 // existing. #ifdef out these declarations and fix all the users.
20 typedef void* HANDLE;
21
22 class GURL;
23 struct NPObject;
24
25 namespace webkit {
26 namespace npapi {
27
28 class WebPluginResourceClient;
29 #if defined(OS_MACOSX)
30 class WebPluginAcceleratedSurface;
31 #endif
32
33 // Describes the new location for a plugin window.
34 struct WEBKIT_PLUGINS_EXPORT WebPluginGeometry {
35 WebPluginGeometry();
36 ~WebPluginGeometry();
37
38 bool Equals(const WebPluginGeometry& rhs) const;
39
40 // On Windows, this is the plugin window in the plugin process.
41 // On X11, this is the XID of the plugin-side GtkPlug containing the
42 // GtkSocket hosting the actual plugin window.
43 //
44 // On Mac OS X, all of the plugin types are currently "windowless"
45 // (window == 0) except for the special case of the GPU plugin,
46 // which currently performs rendering on behalf of the Pepper 3D API
47 // and WebGL. The GPU plugin uses a simple integer for the
48 // PluginWindowHandle which is used to map to a side data structure
49 // containing information about the plugin. Soon this plugin will be
50 // generalized, at which point this mechanism will be rethought or
51 // removed.
52 gfx::PluginWindowHandle window;
53 gfx::Rect window_rect;
54 // Clip rect (include) and cutouts (excludes), relative to
55 // window_rect origin.
56 gfx::Rect clip_rect;
57 std::vector<gfx::Rect> cutout_rects;
58 bool rects_valid;
59 bool visible;
60 };
61
62 // The WebKit side of a plugin implementation. It provides wrappers around
63 // operations that need to interact with the frame and other WebCore objects.
64 class WebPlugin {
65 public:
66 virtual ~WebPlugin() {}
67
68 // Called by the plugin delegate to let the WebPlugin know if the plugin is
69 // windowed (i.e. handle is not NULL) or windowless (handle is NULL). This
70 // tells the WebPlugin to send mouse/keyboard events to the plugin delegate,
71 // as well as the information about the HDC for paint operations.
72 virtual void SetWindow(gfx::PluginWindowHandle window) = 0;
73
74 // Whether input events should be sent to the delegate.
75 virtual void SetAcceptsInputEvents(bool accepts) = 0;
76
77 // Called by the plugin delegate to let it know that the window is being
78 // destroyed.
79 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) = 0;
80 #if defined(OS_WIN)
81 // |pump_messages_event| is a event handle which is used in NPP_HandleEvent
82 // calls to pump messages if the plugin enters a modal loop.
83 // |dummy_activation_window} is used to ensure correct keyboard activation.
84 // It needs to be a child of the parent window.
85 virtual void SetWindowlessData(HANDLE pump_messages_event,
86 gfx::NativeViewId dummy_activation_window) = 0;
87 #endif
88 // Cancels a pending request.
89 virtual void CancelResource(unsigned long id) = 0;
90 virtual void Invalidate() = 0;
91 virtual void InvalidateRect(const gfx::Rect& rect) = 0;
92
93 // Returns the NPObject for the browser's window object. Does not
94 // take a reference.
95 virtual NPObject* GetWindowScriptNPObject() = 0;
96
97 // Returns the DOM element that loaded the plugin. Does not take a
98 // reference.
99 virtual NPObject* GetPluginElement() = 0;
100
101 // Resolves the proxies for the url, returns true on success.
102 virtual bool FindProxyForUrl(const GURL& url, std::string* proxy_list) = 0;
103
104 // Cookies
105 virtual void SetCookie(const GURL& url,
106 const GURL& first_party_for_cookies,
107 const std::string& cookie) = 0;
108 virtual std::string GetCookies(const GURL& url,
109 const GURL& first_party_for_cookies) = 0;
110
111 // Handles GetURL/GetURLNotify/PostURL/PostURLNotify requests initiated
112 // by plugins. If the plugin wants notification of the result, notify_id will
113 // be non-zero.
114 virtual void HandleURLRequest(const char* url,
115 const char* method,
116 const char* target,
117 const char* buf,
118 unsigned int len,
119 int notify_id,
120 bool popups_allowed,
121 bool notify_redirects) = 0;
122
123 // Cancels document load.
124 virtual void CancelDocumentLoad() = 0;
125
126 // Initiates a HTTP range request for an existing stream.
127 virtual void InitiateHTTPRangeRequest(const char* url,
128 const char* range_info,
129 int range_request_id) = 0;
130
131 // Returns true iff in incognito mode.
132 virtual bool IsOffTheRecord() = 0;
133
134 // Called when the WebPluginResourceClient instance is deleted.
135 virtual void ResourceClientDeleted(
136 WebPluginResourceClient* resource_client) {}
137
138 // Defers the loading of the resource identified by resource_id. This is
139 // controlled by the defer parameter.
140 virtual void SetDeferResourceLoading(unsigned long resource_id,
141 bool defer) = 0;
142
143 #if defined(OS_MACOSX)
144 // Called to inform the WebPlugin that the plugin has gained or lost focus.
145 virtual void FocusChanged(bool focused) {}
146
147 // Starts plugin IME.
148 virtual void StartIme() {}
149
150 // Returns the accelerated surface abstraction for accelerated plugins.
151 virtual WebPluginAcceleratedSurface* GetAcceleratedSurface(
152 gfx::GpuPreference gpu_preference) = 0;
153
154 // Core Animation plugin support. CA plugins always render through
155 // the compositor.
156 virtual void AcceleratedPluginEnabledRendering() = 0;
157 virtual void AcceleratedPluginAllocatedIOSurface(int32 width,
158 int32 height,
159 uint32 surface_id) = 0;
160 virtual void AcceleratedPluginSwappedIOSurface() = 0;
161 #endif
162
163 // Handles NPN_URLRedirectResponse calls issued by plugins in response to
164 // HTTP URL redirect notifications.
165 virtual void URLRedirectResponse(bool allow, int resource_id) = 0;
166 };
167
168 // Simpler version of ResourceHandleClient that lends itself to proxying.
169 class WebPluginResourceClient {
170 public:
171 virtual ~WebPluginResourceClient() {}
172
173 virtual void WillSendRequest(const GURL& url, int http_status_code) = 0;
174 // The request_is_seekable parameter indicates whether byte range requests
175 // can be issued for the underlying stream.
176 virtual void DidReceiveResponse(const std::string& mime_type,
177 const std::string& headers,
178 uint32 expected_length,
179 uint32 last_modified,
180 bool request_is_seekable) = 0;
181 virtual void DidReceiveData(const char* buffer, int length,
182 int data_offset) = 0;
183 // The resource ids passed here ensures that data for range requests
184 // is cleared. This applies for seekable streams.
185 virtual void DidFinishLoading(unsigned long resource_id) = 0;
186 virtual void DidFail(unsigned long resource_id) = 0;
187 virtual bool IsMultiByteResponseExpected() = 0;
188 virtual int ResourceId() = 0;
189 // Tells this object that it will get responses from multiple resources.
190 // This is necessary since the plugin process uses a single instance of
191 // PluginStreamUrl object for multiple range requests.
192 virtual void AddRangeRequestResourceId(unsigned long resource_id) { }
193 };
194
195 } // namespace npapi
196 } // namespace webkit
197
198 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698