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 CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/id_map.h" | 14 #include "base/id_map.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
18 #include "content/public/renderer/render_view_observer.h" | 19 #include "content/public/renderer/render_view_observer.h" |
19 #include "content/renderer/mouse_lock_dispatcher.h" | 20 #include "content/renderer/mouse_lock_dispatcher.h" |
20 #include "content/renderer/pepper_parent_context_provider.h" | 21 #include "content/renderer/pepper_parent_context_provider.h" |
21 #include "ppapi/proxy/broker_dispatcher.h" | 22 #include "ppapi/proxy/broker_dispatcher.h" |
22 #include "ppapi/proxy/proxy_channel.h" | 23 #include "ppapi/proxy/proxy_channel.h" |
23 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" | 24 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" |
24 #include "ppapi/shared_impl/private/udp_socket_private_impl.h" | 25 #include "ppapi/shared_impl/private/udp_socket_private_impl.h" |
25 #include "ui/base/ime/text_input_type.h" | 26 #include "ui/base/ime/text_input_type.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 uint32_t sample_rate, | 220 uint32_t sample_rate, |
220 uint32_t sample_count, | 221 uint32_t sample_count, |
221 PlatformAudioCommonClient* client) OVERRIDE; | 222 PlatformAudioCommonClient* client) OVERRIDE; |
222 virtual PlatformAudioInput* CreateAudioInput( | 223 virtual PlatformAudioInput* CreateAudioInput( |
223 uint32_t sample_rate, | 224 uint32_t sample_rate, |
224 uint32_t sample_count, | 225 uint32_t sample_count, |
225 PlatformAudioCommonClient* client) OVERRIDE; | 226 PlatformAudioCommonClient* client) OVERRIDE; |
226 virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE; | 227 virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE; |
227 virtual PlatformContext3D* CreateContext3D() OVERRIDE; | 228 virtual PlatformContext3D* CreateContext3D() OVERRIDE; |
228 virtual PlatformVideoCapture* CreateVideoCapture( | 229 virtual PlatformVideoCapture* CreateVideoCapture( |
229 media::VideoCapture::EventHandler* handler) OVERRIDE; | 230 const std::string& device_id, |
| 231 PlatformVideoCaptureEventHandler* handler) OVERRIDE; |
230 virtual PlatformVideoDecoder* CreateVideoDecoder( | 232 virtual PlatformVideoDecoder* CreateVideoDecoder( |
231 media::VideoDecodeAccelerator::Client* client, | 233 media::VideoDecodeAccelerator::Client* client, |
232 int32 command_buffer_route_id) OVERRIDE; | 234 int32 command_buffer_route_id) OVERRIDE; |
233 virtual PpapiBroker* ConnectToPpapiBroker( | 235 virtual PpapiBroker* ConnectToPpapiBroker( |
234 webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; | 236 webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; |
235 virtual void NumberOfFindResultsChanged(int identifier, | 237 virtual void NumberOfFindResultsChanged(int identifier, |
236 int total, | 238 int total, |
237 bool final_result) OVERRIDE; | 239 bool final_result) OVERRIDE; |
238 virtual void SelectedFindResultChanged(int identifier, int index) OVERRIDE; | 240 virtual void SelectedFindResultChanged(int identifier, int index) OVERRIDE; |
239 virtual bool RunFileChooser( | 241 virtual bool RunFileChooser( |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 virtual bool LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; | 381 virtual bool LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
380 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; | 382 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
381 virtual bool IsMouseLocked(webkit::ppapi::PluginInstance* instance) OVERRIDE; | 383 virtual bool IsMouseLocked(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
382 virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance, | 384 virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance, |
383 const WebKit::WebCursorInfo& cursor) OVERRIDE; | 385 const WebKit::WebCursorInfo& cursor) OVERRIDE; |
384 virtual void DidReceiveMouseEvent( | 386 virtual void DidReceiveMouseEvent( |
385 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 387 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
386 virtual bool IsInFullscreenMode() OVERRIDE; | 388 virtual bool IsInFullscreenMode() OVERRIDE; |
387 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; | 389 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; |
388 virtual bool IsPageVisible() const OVERRIDE; | 390 virtual bool IsPageVisible() const OVERRIDE; |
| 391 virtual int EnumerateDevices( |
| 392 PP_DeviceType_Dev type, |
| 393 const EnumerateDevicesCallback& callback) OVERRIDE; |
389 | 394 |
390 // RenderViewObserver implementation. | 395 // RenderViewObserver implementation. |
391 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 396 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
392 virtual void OnDestruct() OVERRIDE; | 397 virtual void OnDestruct() OVERRIDE; |
393 | 398 |
394 void OnTCPSocketConnectACK(uint32 plugin_dispatcher_id, | 399 void OnTCPSocketConnectACK(uint32 plugin_dispatcher_id, |
395 uint32 socket_id, | 400 uint32 socket_id, |
396 bool succeeded, | 401 bool succeeded, |
397 const PP_NetAddress_Private& local_addr, | 402 const PP_NetAddress_Private& local_addr, |
398 const PP_NetAddress_Private& remote_addr); | 403 const PP_NetAddress_Private& remote_addr); |
(...skipping 16 matching lines...) Expand all Loading... |
415 bool succeeded, | 420 bool succeeded, |
416 int32_t bytes_written); | 421 int32_t bytes_written); |
417 void OnUDPSocketRecvFromACK(uint32 plugin_dispatcher_id, | 422 void OnUDPSocketRecvFromACK(uint32 plugin_dispatcher_id, |
418 uint32 socket_id, | 423 uint32 socket_id, |
419 bool succeeded, | 424 bool succeeded, |
420 const std::string& data, | 425 const std::string& data, |
421 const PP_NetAddress_Private& addr); | 426 const PP_NetAddress_Private& addr); |
422 | 427 |
423 CONTENT_EXPORT int GetRoutingId() const; | 428 CONTENT_EXPORT int GetRoutingId() const; |
424 | 429 |
| 430 typedef base::Callback<void (int /* request_id */, |
| 431 bool /* succeeded */, |
| 432 const std::string& /* label */)> |
| 433 OpenDeviceCallback; |
| 434 |
| 435 // Opens the specified device. The request ID passed into the callback will be |
| 436 // the same as the return value. If successful, the label passed into the |
| 437 // callback identifies a audio/video steam, which can be used to call |
| 438 // CloseDevice() and GetSesssionID(). |
| 439 int OpenDevice(PP_DeviceType_Dev type, |
| 440 const std::string& device_id, |
| 441 const OpenDeviceCallback& callback); |
| 442 void CloseDevice(const std::string& label); |
| 443 // Gets audio/video session ID given a label. |
| 444 int GetSessionID(PP_DeviceType_Dev type, const std::string& label); |
| 445 |
425 private: | 446 private: |
| 447 class DeviceEnumerationEventHandler; |
| 448 |
426 // Asynchronously attempts to create a PPAPI broker for the given plugin. | 449 // Asynchronously attempts to create a PPAPI broker for the given plugin. |
427 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( | 450 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( |
428 webkit::ppapi::PluginModule* plugin_module); | 451 webkit::ppapi::PluginModule* plugin_module); |
429 | 452 |
430 // Implementation of PepperParentContextProvider. | 453 // Implementation of PepperParentContextProvider. |
431 virtual ContentGLContext* GetParentContextForPlatformContext3D() OVERRIDE; | 454 virtual ContentGLContext* GetParentContextForPlatformContext3D() OVERRIDE; |
432 | 455 |
433 // Helper function to check that TCP/UDP private APIs are allowed for current | 456 // Helper function to check that TCP/UDP private APIs are allowed for current |
434 // page. This check actually allows socket usage for NativeClient code only. | 457 // page. This check actually allows socket usage for NativeClient code only. |
435 // It is better to move this check to browser process but Pepper message | 458 // It is better to move this check to browser process but Pepper message |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 string16 composition_text_; | 502 string16 composition_text_; |
480 | 503 |
481 // The plugin instance that received the last mouse event. It is set to NULL | 504 // The plugin instance that received the last mouse event. It is set to NULL |
482 // if the last mouse event went to elements other than Pepper plugins. | 505 // if the last mouse event went to elements other than Pepper plugins. |
483 // |last_mouse_event_target_| is not owned by this class. We can know about | 506 // |last_mouse_event_target_| is not owned by this class. We can know about |
484 // when it is destroyed via InstanceDeleted(). | 507 // when it is destroyed via InstanceDeleted(). |
485 webkit::ppapi::PluginInstance* last_mouse_event_target_; | 508 webkit::ppapi::PluginInstance* last_mouse_event_target_; |
486 | 509 |
487 scoped_ptr<content::GamepadSharedMemoryReader> gamepad_shared_memory_reader_; | 510 scoped_ptr<content::GamepadSharedMemoryReader> gamepad_shared_memory_reader_; |
488 | 511 |
| 512 scoped_ptr<DeviceEnumerationEventHandler> device_enumeration_event_handler_; |
| 513 |
489 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 514 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
490 }; | 515 }; |
491 | 516 |
492 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 517 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |