OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
9 | 10 |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
14 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
15 #include "base/sync_socket.h" | 16 #include "base/sync_socket.h" |
16 #include "base/time.h" | 17 #include "base/time.h" |
17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
18 #include "media/video/capture/video_capture.h" | 19 #include "media/video/capture/video_capture.h" |
19 #include "media/video/video_decode_accelerator.h" | 20 #include "media/video/video_decode_accelerator.h" |
20 #include "ppapi/c/dev/pp_video_dev.h" | 21 #include "ppapi/c/dev/pp_video_dev.h" |
| 22 #include "ppapi/c/dev/ppb_device_ref_dev.h" |
21 #include "ppapi/c/pp_completion_callback.h" | 23 #include "ppapi/c/pp_completion_callback.h" |
22 #include "ppapi/c/pp_errors.h" | 24 #include "ppapi/c/pp_errors.h" |
23 #include "ppapi/c/pp_instance.h" | 25 #include "ppapi/c/pp_instance.h" |
24 #include "ppapi/c/pp_stdint.h" | 26 #include "ppapi/c/pp_stdint.h" |
25 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
26 #include "webkit/fileapi/file_system_types.h" | 28 #include "webkit/fileapi/file_system_types.h" |
27 #include "webkit/plugins/ppapi/dir_contents.h" | 29 #include "webkit/plugins/ppapi/dir_contents.h" |
28 #include "webkit/quota/quota_types.h" | 30 #include "webkit/quota/quota_types.h" |
29 | 31 |
30 class GURL; | 32 class GURL; |
(...skipping 12 matching lines...) Expand all Loading... |
43 | 45 |
44 namespace gfx { | 46 namespace gfx { |
45 class Point; | 47 class Point; |
46 } | 48 } |
47 | 49 |
48 namespace gpu { | 50 namespace gpu { |
49 class CommandBuffer; | 51 class CommandBuffer; |
50 } | 52 } |
51 | 53 |
52 namespace ppapi { | 54 namespace ppapi { |
| 55 struct DeviceRefData; |
53 struct Preferences; | 56 struct Preferences; |
54 } | 57 } |
55 | 58 |
56 namespace skia { | 59 namespace skia { |
57 class PlatformCanvas; | 60 class PlatformCanvas; |
58 } | 61 } |
59 | 62 |
60 namespace WebKit { | 63 namespace WebKit { |
61 class WebFileChooserCompletion; | 64 class WebFileChooserCompletion; |
62 class WebGamepads; | 65 class WebGamepads; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 virtual ~PlatformAudioInput() {} | 235 virtual ~PlatformAudioInput() {} |
233 }; | 236 }; |
234 | 237 |
235 // Interface for PlatformVideoDecoder is directly inherited from general media | 238 // Interface for PlatformVideoDecoder is directly inherited from general media |
236 // VideoDecodeAccelerator interface. | 239 // VideoDecodeAccelerator interface. |
237 class PlatformVideoDecoder : public media::VideoDecodeAccelerator { | 240 class PlatformVideoDecoder : public media::VideoDecodeAccelerator { |
238 protected: | 241 protected: |
239 virtual ~PlatformVideoDecoder() {} | 242 virtual ~PlatformVideoDecoder() {} |
240 }; | 243 }; |
241 | 244 |
242 class PlatformVideoCapture : public media::VideoCapture { | 245 class PlatformVideoCaptureEventHandler |
| 246 : public media::VideoCapture::EventHandler { |
| 247 public: |
| 248 virtual ~PlatformVideoCaptureEventHandler() {} |
| 249 |
| 250 virtual void OnInitialized(media::VideoCapture* capture, |
| 251 bool succeeded) = 0; |
| 252 }; |
| 253 |
| 254 class PlatformVideoCapture : public media::VideoCapture, |
| 255 public base::RefCounted<PlatformVideoCapture> { |
243 public: | 256 public: |
244 virtual ~PlatformVideoCapture() {} | 257 virtual ~PlatformVideoCapture() {} |
| 258 |
| 259 // Detaches the event handler and stops sending notifications to it. |
| 260 virtual void DetachEventHandler() = 0; |
245 }; | 261 }; |
246 | 262 |
247 // Provides access to the ppapi broker. | 263 // Provides access to the ppapi broker. |
248 class PpapiBroker { | 264 class PpapiBroker { |
249 public: | 265 public: |
250 virtual void Connect(webkit::ppapi::PPB_Broker_Impl* client) = 0; | 266 virtual void Connect(webkit::ppapi::PPB_Broker_Impl* client) = 0; |
251 | 267 |
252 // Decrements the references to the broker. | 268 // Decrements the references to the broker. |
253 // When there are no more references, this renderer's dispatcher is | 269 // When there are no more references, this renderer's dispatcher is |
254 // destroyed, allowing the broker to shutdown if appropriate. | 270 // destroyed, allowing the broker to shutdown if appropriate. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // Returns a pointer (ownership not transferred) to the bitmap to paint the | 304 // Returns a pointer (ownership not transferred) to the bitmap to paint the |
289 // sad plugin screen with. Returns NULL on failure. | 305 // sad plugin screen with. Returns NULL on failure. |
290 virtual SkBitmap* GetSadPluginBitmap() = 0; | 306 virtual SkBitmap* GetSadPluginBitmap() = 0; |
291 | 307 |
292 // The caller will own the pointer returned from this. | 308 // The caller will own the pointer returned from this. |
293 virtual PlatformImage2D* CreateImage2D(int width, int height) = 0; | 309 virtual PlatformImage2D* CreateImage2D(int width, int height) = 0; |
294 | 310 |
295 // The caller will own the pointer returned from this. | 311 // The caller will own the pointer returned from this. |
296 virtual PlatformContext3D* CreateContext3D() = 0; | 312 virtual PlatformContext3D* CreateContext3D() = 0; |
297 | 313 |
298 // The caller will own the pointer returned from this. | 314 // If |device_id| is empty, the default video capture device will be used. The |
| 315 // user can start using the returned object to capture video right away. |
| 316 // Otherwise, the specified device will be used. The user needs to wait till |
| 317 // |handler| gets an OnInitialized() notification to start using the returned |
| 318 // object. |
299 virtual PlatformVideoCapture* CreateVideoCapture( | 319 virtual PlatformVideoCapture* CreateVideoCapture( |
300 media::VideoCapture::EventHandler* handler) = 0; | 320 const std::string& device_id, |
| 321 PlatformVideoCaptureEventHandler* handler) = 0; |
301 | 322 |
302 // The caller will own the pointer returned from this. | 323 // The caller will own the pointer returned from this. |
303 virtual PlatformVideoDecoder* CreateVideoDecoder( | 324 virtual PlatformVideoDecoder* CreateVideoDecoder( |
304 media::VideoDecodeAccelerator::Client* client, | 325 media::VideoDecodeAccelerator::Client* client, |
305 int32 command_buffer_route_id) = 0; | 326 int32 command_buffer_route_id) = 0; |
306 | 327 |
307 // The caller is responsible for calling Shutdown() on the returned pointer | 328 // The caller is responsible for calling Shutdown() on the returned pointer |
308 // to clean up the corresponding resources allocated during this call. | 329 // to clean up the corresponding resources allocated during this call. |
309 virtual PlatformAudio* CreateAudio(uint32_t sample_rate, | 330 virtual PlatformAudio* CreateAudio(uint32_t sample_rate, |
310 uint32_t sample_count, | 331 uint32_t sample_count, |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0; | 538 virtual void DidReceiveMouseEvent(PluginInstance* instance) = 0; |
518 | 539 |
519 // Determines if the browser entered fullscreen mode. | 540 // Determines if the browser entered fullscreen mode. |
520 virtual bool IsInFullscreenMode() = 0; | 541 virtual bool IsInFullscreenMode() = 0; |
521 | 542 |
522 // Retrieve current gamepad data. | 543 // Retrieve current gamepad data. |
523 virtual void SampleGamepads(WebKit::WebGamepads* data) = 0; | 544 virtual void SampleGamepads(WebKit::WebGamepads* data) = 0; |
524 | 545 |
525 // Returns true if the containing page is visible. | 546 // Returns true if the containing page is visible. |
526 virtual bool IsPageVisible() const = 0; | 547 virtual bool IsPageVisible() const = 0; |
| 548 |
| 549 typedef base::Callback< |
| 550 void (int /* request_id */, |
| 551 bool /* succeeded */, |
| 552 const std::vector< ::ppapi::DeviceRefData>& /* devices */)> |
| 553 EnumerateDevicesCallback; |
| 554 |
| 555 // Enumerates devices of the specified type. The request ID passed into the |
| 556 // callback will be the same as the return value. |
| 557 virtual int EnumerateDevices(PP_DeviceType_Dev type, |
| 558 const EnumerateDevicesCallback& callback) = 0; |
527 }; | 559 }; |
528 | 560 |
529 } // namespace ppapi | 561 } // namespace ppapi |
530 } // namespace webkit | 562 } // namespace webkit |
531 | 563 |
532 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ | 564 #endif // WEBKIT_PLUGINS_PPAPI_PLUGIN_DELEGATE_H_ |
OLD | NEW |