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

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

Issue 5828003: Move the Pepper implementation from webkit/glue/plugins/pepper_* to... (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/pepper_image_data.cc ('k') | webkit/glue/plugins/pepper_plugin_instance.h » ('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) 2010 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_PLUGINS_PEPPER_PLUGIN_DELEGATE_H_
6 #define WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_DELEGATE_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/platform_file.h"
12 #include "base/ref_counted.h"
13 #include "base/shared_memory.h"
14 #include "base/sync_socket.h"
15 #include "gfx/size.h"
16 #include "googleurl/src/gurl.h"
17 #include "ppapi/c/pp_completion_callback.h"
18 #include "ppapi/c/pp_errors.h"
19 #include "ppapi/c/pp_instance.h"
20 #include "ppapi/c/pp_stdint.h"
21 #include "webkit/fileapi/file_system_types.h"
22 #include "webkit/glue/plugins/pepper_dir_contents.h"
23
24 class AudioMessageFilter;
25 class GURL;
26
27 namespace base {
28 class MessageLoopProxy;
29 class Time;
30 }
31
32 namespace fileapi {
33 class FileSystemCallbackDispatcher;
34 }
35
36 namespace gfx {
37 class Rect;
38 }
39
40 namespace gpu {
41 namespace gles2 {
42 class GLES2Implementation;
43 }
44 }
45
46 namespace skia {
47 class PlatformCanvas;
48 }
49
50 namespace WebKit {
51 class WebFileChooserCompletion;
52 struct WebFileChooserParams;
53 }
54
55 struct PP_VideoCompressedDataBuffer_Dev;
56 struct PP_VideoDecoderConfig_Dev;
57 struct PP_VideoUncompressedDataBuffer_Dev;
58
59 class TransportDIB;
60
61 namespace pepper {
62
63 class FileIO;
64 class PluginInstance;
65 class FullscreenContainer;
66
67 // Virtual interface that the browser implements to implement features for
68 // Pepper plugins.
69 class PluginDelegate {
70 public:
71 // This class is implemented by the PluginDelegate implementation and is
72 // designed to manage the lifetime and communicatin with the proxy's
73 // HostDispatcher for out-of-process pepper plugins.
74 //
75 // The point of this is to avoid having a relationship from the pepper plugin
76 // implementation to the ppapi proxy code. Otherwise, things like the IPC
77 // system will be dependencies of the webkit directory, which we don't want.
78 //
79 // The PluginModule will scope the lifetime of this object to its own
80 // lifetime, so the implementation can use this to manage the HostDispatcher
81 // lifetime without introducing the dependency.
82 class OutOfProcessProxy {
83 public:
84 virtual ~OutOfProcessProxy() {}
85
86 // Implements GetInterface for the proxied plugin.
87 virtual const void* GetProxiedInterface(const char* name) = 0;
88
89 // Notification to the out-of-process layer that the given plugin instance
90 // has been created. This will happen before the normal PPB_Instance method
91 // calls so the out-of-process code can set up the tracking information for
92 // the new instance.
93 virtual void AddInstance(PP_Instance instance) = 0;
94
95 // Like AddInstance but removes the given instance. This is called after
96 // regular instance shutdown so the out-of-process code can clean up its
97 // tracking information.
98 virtual void RemoveInstance(PP_Instance instance) = 0;
99 };
100
101 // Represents an image. This is to allow the browser layer to supply a correct
102 // image representation. In Chrome, this will be a TransportDIB.
103 class PlatformImage2D {
104 public:
105 virtual ~PlatformImage2D() {}
106
107 // Caller will own the returned pointer, returns NULL on failure.
108 virtual skia::PlatformCanvas* Map() = 0;
109
110 // Returns the platform-specific shared memory handle of the data backing
111 // this image. This is used by PPAPI proxying to send the image to the
112 // out-of-process plugin. On success, the size in bytes will be placed into
113 // |*bytes_count|. Returns 0 on failure.
114 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const = 0;
115
116 virtual TransportDIB* GetTransportDIB() const = 0;
117 };
118
119 class PlatformContext3D {
120 public:
121 virtual ~PlatformContext3D() {}
122
123 // Initialize the context.
124 virtual bool Init() = 0;
125
126 // Present the rendered frame to the compositor.
127 virtual bool SwapBuffers() = 0;
128
129 // Get the last EGL error.
130 virtual unsigned GetError() = 0;
131
132 // Resize the backing texture used as a back buffer by OpenGL.
133 virtual void ResizeBackingTexture(const gfx::Size& size) = 0;
134
135 // Set an optional callback that will be invoked when the side effects of
136 // a SwapBuffers call become visible to the compositor. Takes ownership
137 // of the callback.
138 virtual void SetSwapBuffersCallback(Callback0::Type* callback) = 0;
139
140 // If the plugin instance is backed by an OpenGL, return its ID in the
141 // compositors namespace. Otherwise return 0. Returns 0 by default.
142 virtual unsigned GetBackingTextureId() = 0;
143
144 // This call will return the address of the GLES2 implementation for this
145 // context that is constructed in Initialize() and is valid until this
146 // context is destroyed.
147 virtual gpu::gles2::GLES2Implementation* GetGLES2Implementation() = 0;
148 };
149
150 class PlatformAudio {
151 public:
152 class Client {
153 protected:
154 virtual ~Client() {}
155
156 public:
157 // Called when the stream is created.
158 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle,
159 size_t shared_memory_size,
160 base::SyncSocket::Handle socket) = 0;
161 };
162
163 // Starts the playback. Returns false on error or if called before the
164 // stream is created or after the stream is closed.
165 virtual bool StartPlayback() = 0;
166
167 // Stops the playback. Returns false on error or if called before the stream
168 // is created or after the stream is closed.
169 virtual bool StopPlayback() = 0;
170
171 // Closes the stream. Make sure to call this before the object is
172 // destructed.
173 virtual void ShutDown() = 0;
174
175 protected:
176 virtual ~PlatformAudio() {}
177 };
178
179 class PlatformVideoDecoder {
180 public:
181 virtual ~PlatformVideoDecoder() {}
182
183 // Returns false on failure.
184 virtual bool Decode(PP_VideoCompressedDataBuffer_Dev& input_buffer) = 0;
185 virtual int32_t Flush(PP_CompletionCallback& callback) = 0;
186 virtual bool ReturnUncompressedDataBuffer(
187 PP_VideoUncompressedDataBuffer_Dev& buffer) = 0;
188 };
189
190 // Indicates that the given instance has been created.
191 virtual void InstanceCreated(pepper::PluginInstance* instance) = 0;
192
193 // Indicates that the given instance is being destroyed. This is called from
194 // the destructor, so it's important that the instance is not dereferenced
195 // from this call.
196 virtual void InstanceDeleted(pepper::PluginInstance* instance) = 0;
197
198 // The caller will own the pointer returned from this.
199 virtual PlatformImage2D* CreateImage2D(int width, int height) = 0;
200
201 // The caller will own the pointer returned from this.
202 virtual PlatformContext3D* CreateContext3D() = 0;
203
204 // The caller will own the pointer returned from this.
205 virtual PlatformVideoDecoder* CreateVideoDecoder(
206 const PP_VideoDecoderConfig_Dev& decoder_config) = 0;
207
208 // The caller will own the pointer returned from this.
209 virtual PlatformAudio* CreateAudio(uint32_t sample_rate,
210 uint32_t sample_count,
211 PlatformAudio::Client* client) = 0;
212
213 // Notifies that the number of find results has changed.
214 virtual void NumberOfFindResultsChanged(int identifier,
215 int total,
216 bool final_result) = 0;
217
218 // Notifies that the index of the currently selected item has been updated.
219 virtual void SelectedFindResultChanged(int identifier, int index) = 0;
220
221 // Runs a file chooser.
222 virtual bool RunFileChooser(
223 const WebKit::WebFileChooserParams& params,
224 WebKit::WebFileChooserCompletion* chooser_completion) = 0;
225
226 // Sends an async IPC to open a file.
227 typedef Callback2<base::PlatformFileError, base::PlatformFile
228 >::Type AsyncOpenFileCallback;
229 virtual bool AsyncOpenFile(const FilePath& path,
230 int flags,
231 AsyncOpenFileCallback* callback) = 0;
232 virtual bool OpenFileSystem(
233 const GURL& url,
234 fileapi::FileSystemType type,
235 long long size,
236 fileapi::FileSystemCallbackDispatcher* dispatcher) = 0;
237 virtual bool MakeDirectory(
238 const FilePath& path,
239 bool recursive,
240 fileapi::FileSystemCallbackDispatcher* dispatcher) = 0;
241 virtual bool Query(const FilePath& path,
242 fileapi::FileSystemCallbackDispatcher* dispatcher) = 0;
243 virtual bool Touch(const FilePath& path,
244 const base::Time& last_access_time,
245 const base::Time& last_modified_time,
246 fileapi::FileSystemCallbackDispatcher* dispatcher) = 0;
247 virtual bool Delete(const FilePath& path,
248 fileapi::FileSystemCallbackDispatcher* dispatcher) = 0;
249 virtual bool Rename(const FilePath& file_path,
250 const FilePath& new_file_path,
251 fileapi::FileSystemCallbackDispatcher* dispatcher) = 0;
252 virtual bool ReadDirectory(
253 const FilePath& directory_path,
254 fileapi::FileSystemCallbackDispatcher* dispatcher) = 0;
255
256 virtual base::PlatformFileError OpenModuleLocalFile(
257 const std::string& module_name,
258 const FilePath& path,
259 int flags,
260 base::PlatformFile* file) = 0;
261 virtual base::PlatformFileError RenameModuleLocalFile(
262 const std::string& module_name,
263 const FilePath& path_from,
264 const FilePath& path_to) = 0;
265 virtual base::PlatformFileError DeleteModuleLocalFileOrDir(
266 const std::string& module_name,
267 const FilePath& path,
268 bool recursive) = 0;
269 virtual base::PlatformFileError CreateModuleLocalDir(
270 const std::string& module_name,
271 const FilePath& path) = 0;
272 virtual base::PlatformFileError QueryModuleLocalFile(
273 const std::string& module_name,
274 const FilePath& path,
275 base::PlatformFileInfo* info) = 0;
276 virtual base::PlatformFileError GetModuleLocalDirContents(
277 const std::string& module_name,
278 const FilePath& path,
279 PepperDirContents* contents) = 0;
280
281 // Returns a MessageLoopProxy instance associated with the message loop
282 // of the file thread in this renderer.
283 virtual scoped_refptr<base::MessageLoopProxy>
284 GetFileThreadMessageLoopProxy() = 0;
285
286 // Create a fullscreen container for a plugin instance. This effectively
287 // switches the plugin to fullscreen.
288 virtual FullscreenContainer* CreateFullscreenContainer(
289 PluginInstance* instance) = 0;
290
291 // Returns a string with the name of the default 8-bit char encoding.
292 virtual std::string GetDefaultEncoding() = 0;
293
294 // Sets the mininum and maximium zoom factors.
295 virtual void ZoomLimitsChanged(double minimum_factor,
296 double maximum_factor) = 0;
297
298 // Retrieves the proxy information for the given URL in PAC format. On error,
299 // this will return an empty string.
300 virtual std::string ResolveProxy(const GURL& url) = 0;
301
302 // Tell the browser when resource loading starts/ends.
303 virtual void DidStartLoading() = 0;
304 virtual void DidStopLoading() = 0;
305
306 // Sets restrictions on how the content can be used (i.e. no print/copy).
307 virtual void SetContentRestriction(int restrictions) = 0;
308 };
309
310 } // namespace pepper
311
312 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_DELEGATE_H_
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_image_data.cc ('k') | webkit/glue/plugins/pepper_plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698