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