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

Side by Side Diff: webkit/plugins/ppapi/plugin_delegate.h

Issue 20165002: Move webkit/plugins/ppapi to content/renderer/pepper. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: more more clang fun 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
« no previous file with comments | « webkit/plugins/ppapi/npobject_var.cc ('k') | webkit/plugins/ppapi/plugin_module.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) 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_PPAPI_PLUGIN_DELEGATE_H_
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/shared_memory.h"
14 #include "base/message_loop/message_loop_proxy.h"
15 #include "base/platform_file.h"
16 #include "base/process.h"
17 #include "base/sync_socket.h"
18 #include "base/time/time.h"
19 #include "ipc/ipc_platform_file.h"
20 #include "media/video/capture/video_capture.h"
21 #include "media/video/video_decode_accelerator.h"
22 #include "ppapi/c/dev/pp_video_dev.h"
23 #include "ppapi/c/dev/ppb_device_ref_dev.h"
24 #include "ppapi/c/pp_completion_callback.h"
25 #include "ppapi/c/pp_errors.h"
26 #include "ppapi/c/pp_file_info.h"
27 #include "ppapi/c/pp_instance.h"
28 #include "ppapi/c/pp_resource.h"
29 #include "ppapi/c/pp_stdint.h"
30 #include "ppapi/c/ppb_tcp_socket.h"
31 #include "ppapi/c/private/ppb_flash.h"
32 #include "ppapi/c/private/ppb_tcp_socket_private.h"
33 #include "ppapi/c/private/ppb_udp_socket_private.h"
34 #include "ppapi/shared_impl/dir_contents.h"
35 #include "ui/gfx/size.h"
36 #include "url/gurl.h"
37 #include "webkit/common/fileapi/file_system_types.h"
38 #include "webkit/common/quota/quota_types.h"
39 #include "webkit/plugins/webkit_plugins_export.h"
40
41 class GURL;
42 class SkBitmap;
43 class SkCanvas;
44 class TransportDIB;
45 struct PP_NetAddress_Private;
46
47 namespace IPC {
48 struct ChannelHandle;
49 }
50
51 namespace WebKit {
52 class WebGraphicsContext3D;
53 }
54
55 namespace base {
56 class MessageLoopProxy;
57 class Time;
58 }
59
60 namespace content {
61 class RendererPpapiHost;
62 }
63
64 namespace fileapi {
65 struct DirectoryEntry;
66 }
67
68 namespace gfx {
69 class Point;
70 }
71
72 namespace gpu {
73 class CommandBuffer;
74 struct Mailbox;
75 }
76
77 namespace ppapi {
78 class PepperFilePath;
79 class PpapiPermissions;
80 class PPB_X509Certificate_Fields;
81 class SocketOptionData;
82 struct DeviceRefData;
83 struct HostPortPair;
84 struct Preferences;
85
86 namespace thunk {
87 class ResourceCreationAPI;
88 }
89
90 } // namespace ppapi
91
92 namespace WebKit {
93 typedef SkCanvas WebCanvas;
94 class WebGamepads;
95 class WebPlugin;
96 struct WebCompositionUnderline;
97 struct WebCursorInfo;
98 struct WebURLError;
99 class WebURLLoaderClient;
100 class WebURLResponse;
101 }
102
103 namespace webkit_glue {
104 class P2PTransport;
105 class NetworkListObserver;
106 } // namespace webkit_glue
107
108 namespace webkit {
109
110 namespace ppapi {
111
112 class FileIO;
113 class FullscreenContainer;
114 class PluginInstanceImpl;
115 class PluginModule;
116 class PPB_Broker_Impl;
117 class PPB_Flash_Menu_Impl;
118 class PPB_ImageData_Impl;
119 class PPB_TCPSocket_Private_Impl;
120
121 // Virtual interface that the browser implements to implement features for
122 // PPAPI plugins.
123 class PluginDelegate {
124 public:
125 // This interface is used for the PluginModule to tell the code in charge of
126 // re-using modules which modules currently exist.
127 //
128 // It is different than the other interfaces, which are scoped to the
129 // lifetime of the plugin instance. The implementor of this interface must
130 // outlive all plugin modules, and is in practice a singleton
131 // (PepperPluginRegistry). This requirement means we can't do the obvious
132 // thing and just have a PluginDelegate call for this purpose (when the
133 // module is being deleted, we know there are no more PluginInstances that
134 // have PluginDelegates).
135 class ModuleLifetime {
136 public:
137 // Notification that the given plugin object is no longer usable. It either
138 // indicates the module was deleted, or that it has crashed.
139 //
140 // This can be called from the module's destructor, so you should not
141 // dereference the given pointer.
142 virtual void PluginModuleDead(PluginModule* dead_module) = 0;
143 };
144
145 // This class is implemented by the PluginDelegate implementation and is
146 // designed to manage the lifetime and communication with the proxy's
147 // HostDispatcher for out-of-process PPAPI plugins.
148 //
149 // The point of this is to avoid having a relationship from the PPAPI plugin
150 // implementation to the ppapi proxy code. Otherwise, things like the IPC
151 // system will be dependencies of the webkit directory, which we don't want.
152 //
153 // The PluginModule will scope the lifetime of this object to its own
154 // lifetime, so the implementation can use this to manage the HostDispatcher
155 // lifetime without introducing the dependency.
156 class OutOfProcessProxy {
157 public:
158 virtual ~OutOfProcessProxy() {}
159
160 // Implements GetInterface for the proxied plugin.
161 virtual const void* GetProxiedInterface(const char* name) = 0;
162
163 // Notification to the out-of-process layer that the given plugin instance
164 // has been created. This will happen before the normal PPB_Instance method
165 // calls so the out-of-process code can set up the tracking information for
166 // the new instance.
167 virtual void AddInstance(PP_Instance instance) = 0;
168
169 // Like AddInstance but removes the given instance. This is called after
170 // regular instance shutdown so the out-of-process code can clean up its
171 // tracking information.
172 virtual void RemoveInstance(PP_Instance instance) = 0;
173
174 virtual base::ProcessId GetPeerProcessId() = 0;
175 virtual int GetPluginChildId() = 0;
176 };
177
178 // Represents an image. This is to allow the browser layer to supply a correct
179 // image representation. In Chrome, this will be a TransportDIB.
180 class PlatformImage2D {
181 public:
182 virtual ~PlatformImage2D() {}
183
184 // Caller will own the returned pointer, returns NULL on failure.
185 virtual SkCanvas* Map() = 0;
186
187 // Returns the platform-specific shared memory handle of the data backing
188 // this image. This is used by PPAPI proxying to send the image to the
189 // out-of-process plugin. On success, the size in bytes will be placed into
190 // |*bytes_count|. Returns 0 on failure.
191 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const = 0;
192
193 virtual TransportDIB* GetTransportDIB() const = 0;
194 };
195
196 class WEBKIT_PLUGINS_EXPORT PlatformGraphics2D {
197 public:
198 virtual ~PlatformGraphics2D() {}
199
200 virtual bool ReadImageData(PP_Resource image, const PP_Point* top_left) = 0;
201
202 // Assciates this device with the given plugin instance. You can pass NULL
203 // to clear the existing device. Returns true on success. In this case, a
204 // repaint of the page will also be scheduled. Failure means that the device
205 // is already bound to a different instance, and nothing will happen.
206 virtual bool BindToInstance(PluginInstanceImpl* new_instance) = 0;
207
208 // Paints the current backing store to the web page.
209 virtual void Paint(WebKit::WebCanvas* canvas,
210 const gfx::Rect& plugin_rect,
211 const gfx::Rect& paint_rect) = 0;
212
213 // Notifications about the view's progress painting. See PluginInstance.
214 // These messages are used to send Flush callbacks to the plugin.
215 virtual void ViewWillInitiatePaint() = 0;
216 virtual void ViewInitiatedPaint() = 0;
217 virtual void ViewFlushedPaint() = 0;
218
219 virtual bool IsAlwaysOpaque() const = 0;
220 virtual void SetScale(float scale) = 0;
221 virtual float GetScale() const = 0;
222 virtual PPB_ImageData_Impl* ImageData() = 0;
223 };
224
225 class PlatformContext3D {
226 public:
227 virtual ~PlatformContext3D() {}
228
229 // Initialize the context.
230 virtual bool Init(const int32* attrib_list,
231 PlatformContext3D* share_context) = 0;
232
233 // Retrieves the mailbox name for the front buffer backing the context.
234 virtual void GetBackingMailbox(::gpu::Mailbox* mailbox) = 0;
235
236 // Returns true if the backing texture is always opaque.
237 virtual bool IsOpaque() = 0;
238
239 // This call will return the address of the command buffer for this context
240 // that is constructed in Initialize() and is valid until this context is
241 // destroyed.
242 virtual ::gpu::CommandBuffer* GetCommandBuffer() = 0;
243
244 // If the command buffer is routed in the GPU channel, return the route id.
245 // Otherwise return 0.
246 virtual int GetCommandBufferRouteId() = 0;
247
248 // Set an optional callback that will be invoked when the context is lost
249 // (e.g. gpu process crash). Takes ownership of the callback.
250 virtual void SetContextLostCallback(
251 const base::Callback<void()>& callback) = 0;
252
253 // Set an optional callback that will be invoked when the GPU process
254 // sends a console message.
255 typedef base::Callback<void(const std::string&, int)>
256 ConsoleMessageCallback;
257 virtual void SetOnConsoleMessageCallback(
258 const ConsoleMessageCallback& callback) = 0;
259
260 // Run the callback once the channel has been flushed.
261 virtual bool Echo(const base::Callback<void()>& callback) = 0;
262 };
263
264 // The base class of clients used by |PlatformAudioOutput| and
265 // |PlatformAudioInput|.
266 class PlatformAudioClientBase {
267 protected:
268 virtual ~PlatformAudioClientBase() {}
269
270 public:
271 // Called when the stream is created.
272 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle,
273 size_t shared_memory_size,
274 base::SyncSocket::Handle socket) = 0;
275 };
276
277 class PlatformAudioOutputClient : public PlatformAudioClientBase {
278 protected:
279 virtual ~PlatformAudioOutputClient() {}
280 };
281
282 class PlatformAudioOutput {
283 public:
284 // Starts the playback. Returns false on error or if called before the
285 // stream is created or after the stream is closed.
286 virtual bool StartPlayback() = 0;
287
288 // Stops the playback. Returns false on error or if called before the stream
289 // is created or after the stream is closed.
290 virtual bool StopPlayback() = 0;
291
292 // Closes the stream. Make sure to call this before the object is
293 // destructed.
294 virtual void ShutDown() = 0;
295
296 protected:
297 virtual ~PlatformAudioOutput() {}
298 };
299
300 class PlatformAudioInputClient : public PlatformAudioClientBase {
301 public:
302 virtual void StreamCreationFailed() = 0;
303
304 protected:
305 virtual ~PlatformAudioInputClient() {}
306 };
307
308 class PlatformAudioInput {
309 public:
310 virtual void StartCapture() = 0;
311 virtual void StopCapture() = 0;
312
313 // Closes the stream. Make sure to call this before the object is
314 // destructed.
315 virtual void ShutDown() = 0;
316
317 protected:
318 virtual ~PlatformAudioInput() {}
319 };
320
321 // Interface for PlatformVideoDecoder is directly inherited from general media
322 // VideoDecodeAccelerator interface.
323 class PlatformVideoDecoder : public media::VideoDecodeAccelerator {
324 public:
325 virtual ~PlatformVideoDecoder() {}
326 };
327
328 class PlatformVideoCaptureEventHandler
329 : public media::VideoCapture::EventHandler {
330 public:
331 virtual ~PlatformVideoCaptureEventHandler() {}
332
333 virtual void OnInitialized(media::VideoCapture* capture,
334 bool succeeded) = 0;
335 };
336
337 class PlatformVideoCapture : public media::VideoCapture,
338 public base::RefCounted<PlatformVideoCapture> {
339 public:
340 // Detaches the event handler and stops sending notifications to it.
341 virtual void DetachEventHandler() = 0;
342
343 protected:
344 virtual ~PlatformVideoCapture() {}
345
346 private:
347 friend class base::RefCounted<PlatformVideoCapture>;
348 };
349
350 // Provides access to the ppapi broker.
351 class Broker {
352 public:
353 // Decrements the references to the broker.
354 // When there are no more references, this renderer's dispatcher is
355 // destroyed, allowing the broker to shutdown if appropriate.
356 // Callers should not reference this object after calling Disconnect().
357 virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) = 0;
358
359 protected:
360 virtual ~Broker() {}
361 };
362
363 // Notification that the given plugin is focused or unfocused.
364 virtual void PluginFocusChanged(webkit::ppapi::PluginInstanceImpl* instance,
365 bool focused) = 0;
366 // Notification that the text input status of the given plugin is changed.
367 virtual void PluginTextInputTypeChanged(
368 webkit::ppapi::PluginInstanceImpl* instance) = 0;
369 // Notification that the caret position in the given plugin is changed.
370 virtual void PluginCaretPositionChanged(
371 webkit::ppapi::PluginInstanceImpl* instance) = 0;
372 // Notification that the plugin requested to cancel the current composition.
373 virtual void PluginRequestedCancelComposition(
374 webkit::ppapi::PluginInstanceImpl* instance) = 0;
375 // Notification that the text selection in the given plugin is changed.
376 virtual void PluginSelectionChanged(
377 webkit::ppapi::PluginInstanceImpl* instance) = 0;
378 // Requests simulating IME events for testing purpose.
379 virtual void SimulateImeSetComposition(
380 const base::string16& text,
381 const std::vector<WebKit::WebCompositionUnderline>& underlines,
382 int selection_start,
383 int selection_end) = 0;
384 virtual void SimulateImeConfirmComposition(const base::string16& text) = 0;
385
386 // Notification that the given plugin has crashed. When a plugin crashes, all
387 // instances associated with that plugin will notify that they've crashed via
388 // this function.
389 virtual void PluginCrashed(PluginInstanceImpl* instance) = 0;
390
391 // Indicates that the given instance has been created.
392 virtual void InstanceCreated(PluginInstanceImpl* instance) = 0;
393
394 // Indicates that the given instance is being destroyed. This is called from
395 // the destructor, so it's important that the instance is not dereferenced
396 // from this call.
397 virtual void InstanceDeleted(PluginInstanceImpl* instance) = 0;
398
399 // Creates the resource creation API for the given instance.
400 virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
401 CreateResourceCreationAPI(PluginInstanceImpl* instance) = 0;
402
403 // Returns a pointer (ownership not transferred) to the bitmap to paint the
404 // sad plugin screen with. Returns NULL on failure.
405 virtual SkBitmap* GetSadPluginBitmap() = 0;
406
407 // Creates a replacement plug-in that is shown when the plug-in at |file_path|
408 // couldn't be loaded.
409 virtual WebKit::WebPlugin* CreatePluginReplacement(
410 const base::FilePath& file_path) = 0;
411
412 // The caller will own the pointer returned from this.
413 virtual PlatformImage2D* CreateImage2D(int width, int height) = 0;
414
415 // Returns the internal PlatformGraphics2D implementation.
416 virtual PlatformGraphics2D* GetGraphics2D(PluginInstanceImpl* instance,
417 PP_Resource graphics_2d) = 0;
418
419 // The caller will own the pointer returned from this.
420 virtual PlatformContext3D* CreateContext3D() = 0;
421
422 // If |device_id| is empty, the default video capture device will be used. The
423 // user can start using the returned object to capture video right away.
424 // Otherwise, the specified device will be used. The user needs to wait till
425 // |handler| gets an OnInitialized() notification to start using the returned
426 // object.
427 virtual PlatformVideoCapture* CreateVideoCapture(
428 const std::string& device_id,
429 const GURL& document_url,
430 PlatformVideoCaptureEventHandler* handler) = 0;
431
432 // The caller will own the pointer returned from this.
433 virtual PlatformVideoDecoder* CreateVideoDecoder(
434 media::VideoDecodeAccelerator::Client* client,
435 int32 command_buffer_route_id) = 0;
436
437 // Get audio hardware output sample rate.
438 virtual uint32_t GetAudioHardwareOutputSampleRate() = 0;
439
440 // Get audio hardware output buffer size.
441 virtual uint32_t GetAudioHardwareOutputBufferSize() = 0;
442
443 // The caller is responsible for calling Shutdown() on the returned pointer
444 // to clean up the corresponding resources allocated during this call.
445 virtual PlatformAudioOutput* CreateAudioOutput(
446 uint32_t sample_rate,
447 uint32_t sample_count,
448 PlatformAudioOutputClient* client) = 0;
449
450 // If |device_id| is empty, the default audio input device will be used.
451 // The caller is responsible for calling Shutdown() on the returned pointer
452 // to clean up the corresponding resources allocated during this call.
453 virtual PlatformAudioInput* CreateAudioInput(
454 const std::string& device_id,
455 const GURL& document_url,
456 uint32_t sample_rate,
457 uint32_t sample_count,
458 PlatformAudioInputClient* client) = 0;
459
460 // A pointer is returned immediately, but it is not ready to be used until
461 // BrokerConnected has been called.
462 // The caller is responsible for calling Disconnect() on the returned pointer
463 // to clean up the corresponding resources allocated during this call.
464 virtual Broker* ConnectToBroker(webkit::ppapi::PPB_Broker_Impl* client) = 0;
465
466 // Notifies that the number of find results has changed.
467 virtual void NumberOfFindResultsChanged(int identifier,
468 int total,
469 bool final_result) = 0;
470
471 // Notifies that the index of the currently selected item has been updated.
472 virtual void SelectedFindResultChanged(int identifier, int index) = 0;
473
474 // Sends an async IPC to open a local file.
475 typedef base::Callback<void (base::PlatformFileError, base::PassPlatformFile)>
476 AsyncOpenFileCallback;
477 virtual bool AsyncOpenFile(const base::FilePath& path,
478 int flags,
479 const AsyncOpenFileCallback& callback) = 0;
480
481 // These functions expose some of PepperFileSystemHost methods for
482 // PPB_FileRef_Impl (which is in webkit) to access. Once we migrate FileRef
483 // to the new design in content/, we won't need this delegation.
484 // TODO(victorhsieh): remove these delegation.
485 virtual bool IsFileSystemOpened(PP_Instance instance,
486 PP_Resource resource) const = 0;
487 virtual PP_FileSystemType GetFileSystemType(PP_Instance instance,
488 PP_Resource resource) const = 0;
489 virtual GURL GetFileSystemRootUrl(PP_Instance instance,
490 PP_Resource resource) const = 0;
491
492 // Sends an async IPC to open a file through filesystem API.
493 // When a file is successfully opened, |callback| is invoked with
494 // PLATFORM_FILE_OK, the opened file handle, and a callback function for
495 // notifying that the file is closed. When the users of this function
496 // finished using the file, they must close the file handle and then must call
497 // the supplied callback function.
498 typedef base::Callback<void (base::PlatformFileError)>
499 NotifyCloseFileCallback;
500 typedef base::Callback<
501 void (base::PlatformFileError error,
502 base::PassPlatformFile file,
503 quota::QuotaLimitType quota_policy,
504 const NotifyCloseFileCallback& close_file_callback)>
505 AsyncOpenFileSystemURLCallback;
506 virtual void AsyncOpenFileSystemURL(
507 const GURL& path,
508 int flags,
509 const AsyncOpenFileSystemURLCallback& callback) = 0;
510
511 // Callback typedefs for FileSystem related methods.
512 typedef base::Callback<void (base::PlatformFileError)> StatusCallback;
513 typedef base::Callback<void(
514 const std::vector<fileapi::DirectoryEntry>& entries,
515 bool has_more)> ReadDirectoryCallback;
516 typedef base::Callback<void(
517 const base::PlatformFileInfo& file_info)> MetadataCallback;
518
519 virtual void MakeDirectory(
520 const GURL& path,
521 bool recursive,
522 const StatusCallback& callback) = 0;
523 virtual void Query(const GURL& path,
524 const MetadataCallback& success_callback,
525 const StatusCallback& error_callback) = 0;
526 virtual void ReadDirectoryEntries(
527 const GURL& path,
528 const ReadDirectoryCallback& success_callback,
529 const StatusCallback& error_callback) = 0;
530 virtual void Touch(const GURL& path,
531 const base::Time& last_access_time,
532 const base::Time& last_modified_time,
533 const StatusCallback& callback) = 0;
534 virtual void SetLength(const GURL& path,
535 int64_t length,
536 const StatusCallback& callback) = 0;
537 virtual void Delete(const GURL& path,
538 const StatusCallback& callback) = 0;
539 virtual void Rename(const GURL& file_path,
540 const GURL& new_file_path,
541 const StatusCallback& callback) = 0;
542 virtual void ReadDirectory(
543 const GURL& directory_path,
544 const ReadDirectoryCallback& success_callback,
545 const StatusCallback& error_callback) = 0;
546
547 // For quota handlings for FileIO API.
548 typedef base::Callback<void (int64)> AvailableSpaceCallback;
549 virtual void QueryAvailableSpace(const GURL& origin,
550 quota::StorageType type,
551 const AvailableSpaceCallback& callback) = 0;
552 virtual void WillUpdateFile(const GURL& file_path) = 0;
553 virtual void DidUpdateFile(const GURL& file_path, int64_t delta) = 0;
554
555 // Synchronously returns the platform file path for a filesystem URL.
556 virtual void SyncGetFileSystemPlatformPath(const GURL& url,
557 base::FilePath* platform_path) = 0;
558
559 // Returns a MessageLoopProxy instance associated with the message loop
560 // of the file thread in this renderer.
561 virtual scoped_refptr<base::MessageLoopProxy>
562 GetFileThreadMessageLoopProxy() = 0;
563
564 // For PPB_TCPSocket_Private.
565 virtual uint32 TCPSocketCreate() = 0;
566 virtual void TCPSocketConnect(PPB_TCPSocket_Private_Impl* socket,
567 uint32 socket_id,
568 const std::string& host,
569 uint16_t port) = 0;
570 virtual void TCPSocketConnectWithNetAddress(
571 PPB_TCPSocket_Private_Impl* socket,
572 uint32 socket_id,
573 const PP_NetAddress_Private& addr) = 0;
574 virtual void TCPSocketSSLHandshake(
575 uint32 socket_id,
576 const std::string& server_name,
577 uint16_t server_port,
578 const std::vector<std::vector<char> >& trusted_certs,
579 const std::vector<std::vector<char> >& untrusted_certs) = 0;
580 virtual void TCPSocketRead(uint32 socket_id, int32_t bytes_to_read) = 0;
581 virtual void TCPSocketWrite(uint32 socket_id, const std::string& buffer) = 0;
582 virtual void TCPSocketDisconnect(uint32 socket_id) = 0;
583 virtual void TCPSocketSetOption(uint32 socket_id,
584 PP_TCPSocket_Option name,
585 const ::ppapi::SocketOptionData& value) = 0;
586 virtual void RegisterTCPSocket(PPB_TCPSocket_Private_Impl* socket,
587 uint32 socket_id) = 0;
588
589 // For PPB_TCPServerSocket_Private.
590 virtual void TCPServerSocketListen(PP_Resource socket_resource,
591 const PP_NetAddress_Private& addr,
592 int32_t backlog) = 0;
593 virtual void TCPServerSocketAccept(uint32 server_socket_id) = 0;
594 virtual void TCPServerSocketStopListening(
595 PP_Resource socket_resource,
596 uint32 socket_id) = 0;
597
598 // Add/remove a network list observer.
599 virtual bool AddNetworkListObserver(
600 webkit_glue::NetworkListObserver* observer) = 0;
601 virtual void RemoveNetworkListObserver(
602 webkit_glue::NetworkListObserver* observer) = 0;
603
604 // For PPB_X509Certificate_Private.
605 virtual bool X509CertificateParseDER(
606 const std::vector<char>& der,
607 ::ppapi::PPB_X509Certificate_Fields* fields) = 0;
608
609 // Create a fullscreen container for a plugin instance. This effectively
610 // switches the plugin to fullscreen.
611 virtual FullscreenContainer* CreateFullscreenContainer(
612 PluginInstanceImpl* instance) = 0;
613
614 // Gets the size of the screen. The fullscreen window will be created at that
615 // size.
616 virtual gfx::Size GetScreenSize() = 0;
617
618 // Returns a string with the name of the default 8-bit char encoding.
619 virtual std::string GetDefaultEncoding() = 0;
620
621 // Sets the minimum and maximum zoom factors.
622 virtual void ZoomLimitsChanged(double minimum_factor,
623 double maximum_factor) = 0;
624
625 // Create an anonymous shared memory segment of size |size| bytes, and return
626 // a pointer to it, or NULL on error. Caller owns the returned pointer.
627 virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size) = 0;
628
629 // Returns the current preferences.
630 virtual ::ppapi::Preferences GetPreferences() = 0;
631
632 // Locks the mouse for |instance|. If false is returned, the lock is not
633 // possible. If true is returned then the lock is pending. Success or
634 // failure will be delivered asynchronously via
635 // PluginInstance::OnLockMouseACK().
636 virtual bool LockMouse(PluginInstanceImpl* instance) = 0;
637
638 // Unlocks the mouse if |instance| currently owns the mouse lock. Whenever an
639 // plugin instance has lost the mouse lock, it will be notified by
640 // PluginInstance::OnMouseLockLost(). Please note that UnlockMouse() is not
641 // the only cause of losing mouse lock. For example, a user may press the Esc
642 // key to quit the mouse lock mode, which also results in an OnMouseLockLost()
643 // call to the current mouse lock owner.
644 virtual void UnlockMouse(PluginInstanceImpl* instance) = 0;
645
646 // Returns true iff |instance| currently owns the mouse lock.
647 virtual bool IsMouseLocked(PluginInstanceImpl* instance) = 0;
648
649 // Notifies that |instance| has changed the cursor.
650 // This will update the cursor appearance if it is currently over the plugin
651 // instance.
652 virtual void DidChangeCursor(PluginInstanceImpl* instance,
653 const WebKit::WebCursorInfo& cursor) = 0;
654
655 // Notifies that |instance| has received a mouse event.
656 virtual void DidReceiveMouseEvent(PluginInstanceImpl* instance) = 0;
657
658 // Determines if the browser entered fullscreen mode.
659 virtual bool IsInFullscreenMode() = 0;
660
661 // Retrieve current gamepad data.
662 virtual void SampleGamepads(WebKit::WebGamepads* data) = 0;
663
664 // Returns true if the containing page is visible.
665 virtual bool IsPageVisible() const = 0;
666
667 typedef base::Callback<
668 void (int /* request_id */,
669 bool /* succeeded */,
670 const std::vector< ::ppapi::DeviceRefData>& /* devices */)>
671 EnumerateDevicesCallback;
672
673 // Enumerates devices of the specified type. The request ID passed into the
674 // callback will be the same as the return value.
675 virtual int EnumerateDevices(PP_DeviceType_Dev type,
676 const EnumerateDevicesCallback& callback) = 0;
677 // Stop enumerating devices of the specified |request_id|. The |request_id|
678 // is the return value of EnumerateDevicesCallback.
679 virtual void StopEnumerateDevices(int request_id) = 0;
680
681 // Share a given handle with the target process.
682 virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
683 base::PlatformFile handle,
684 base::ProcessId target_process_id,
685 bool should_close_source) const = 0;
686
687 // Returns true if running in process.
688 virtual bool IsRunningInProcess(PP_Instance instance) const = 0;
689
690 // Notifies the plugin of the document load. This should initiate the call to
691 // PPP_Instance.HandleDocumentLoad.
692 //
693 // The loader object should set itself on the PluginInstance as the document
694 // loader using set_document_loader.
695 virtual void HandleDocumentLoad(PluginInstanceImpl* instance,
696 const WebKit::WebURLResponse& response) = 0;
697
698 // Sets up the renderer host and out-of-process proxy for an external plugin
699 // module. Returns the renderer host, or NULL if it couldn't be created.
700 virtual content::RendererPpapiHost* CreateExternalPluginModule(
701 scoped_refptr<PluginModule> module,
702 const base::FilePath& path,
703 ::ppapi::PpapiPermissions permissions,
704 const IPC::ChannelHandle& channel_handle,
705 base::ProcessId plugin_pid,
706 int plugin_child_id) = 0;
707 };
708
709 } // namespace ppapi
710 } // namespace webkit
711
712 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/npobject_var.cc ('k') | webkit/plugins/ppapi/plugin_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698