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/pepper_parent_context_provider.h" | 20 #include "content/renderer/pepper_parent_context_provider.h" |
20 #include "ppapi/proxy/broker_dispatcher.h" | 21 #include "ppapi/proxy/broker_dispatcher.h" |
21 #include "ppapi/proxy/proxy_channel.h" | 22 #include "ppapi/proxy/proxy_channel.h" |
22 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" | 23 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" |
23 #include "ppapi/shared_impl/private/udp_socket_private_impl.h" | 24 #include "ppapi/shared_impl/private/udp_socket_private_impl.h" |
24 #include "ui/base/ime/text_input_type.h" | 25 #include "ui/base/ime/text_input_type.h" |
25 #include "webkit/plugins/ppapi/plugin_delegate.h" | 26 #include "webkit/plugins/ppapi/plugin_delegate.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 PlatformAudioInput* CreateAudioInput( | 230 virtual PlatformAudioInput* CreateAudioInput( |
230 uint32_t sample_rate, | 231 uint32_t sample_rate, |
231 uint32_t sample_count, | 232 uint32_t sample_count, |
232 PlatformAudioCommonClient* client) OVERRIDE; | 233 PlatformAudioCommonClient* client) OVERRIDE; |
233 virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE; | 234 virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE; |
234 virtual PlatformContext3D* CreateContext3D() OVERRIDE; | 235 virtual PlatformContext3D* CreateContext3D() OVERRIDE; |
235 virtual PlatformVideoCapture* CreateVideoCapture( | 236 virtual PlatformVideoCapture* CreateVideoCapture( |
236 media::VideoCapture::EventHandler* handler) OVERRIDE; | 237 const std::string& device_id, |
238 PlatformVideoCaptureEventHandler* handler) OVERRIDE; | |
237 virtual PlatformVideoDecoder* CreateVideoDecoder( | 239 virtual PlatformVideoDecoder* CreateVideoDecoder( |
238 media::VideoDecodeAccelerator::Client* client, | 240 media::VideoDecodeAccelerator::Client* client, |
239 int32 command_buffer_route_id) OVERRIDE; | 241 int32 command_buffer_route_id) OVERRIDE; |
240 virtual PpapiBroker* ConnectToPpapiBroker( | 242 virtual PpapiBroker* ConnectToPpapiBroker( |
241 webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; | 243 webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; |
242 virtual void NumberOfFindResultsChanged(int identifier, | 244 virtual void NumberOfFindResultsChanged(int identifier, |
243 int total, | 245 int total, |
244 bool final_result) OVERRIDE; | 246 bool final_result) OVERRIDE; |
245 virtual void SelectedFindResultChanged(int identifier, int index) OVERRIDE; | 247 virtual void SelectedFindResultChanged(int identifier, int index) OVERRIDE; |
246 virtual bool RunFileChooser( | 248 virtual bool RunFileChooser( |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 virtual ::ppapi::Preferences GetPreferences() OVERRIDE; | 387 virtual ::ppapi::Preferences GetPreferences() OVERRIDE; |
386 virtual void LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; | 388 virtual void LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
387 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; | 389 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
388 virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance, | 390 virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance, |
389 const WebKit::WebCursorInfo& cursor) OVERRIDE; | 391 const WebKit::WebCursorInfo& cursor) OVERRIDE; |
390 virtual void DidReceiveMouseEvent( | 392 virtual void DidReceiveMouseEvent( |
391 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 393 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
392 virtual bool IsInFullscreenMode() OVERRIDE; | 394 virtual bool IsInFullscreenMode() OVERRIDE; |
393 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; | 395 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; |
394 virtual bool IsPageVisible() const OVERRIDE; | 396 virtual bool IsPageVisible() const OVERRIDE; |
397 virtual int EnumerateDevices( | |
398 PP_DeviceType_Dev type, | |
399 const EnumerateDevicesCallback& callback) OVERRIDE; | |
395 | 400 |
396 // RenderViewObserver implementation. | 401 // RenderViewObserver implementation. |
397 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 402 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
398 virtual void OnDestruct() OVERRIDE; | 403 virtual void OnDestruct() OVERRIDE; |
399 | 404 |
400 void OnTCPSocketConnectACK(uint32 plugin_dispatcher_id, | 405 void OnTCPSocketConnectACK(uint32 plugin_dispatcher_id, |
401 uint32 socket_id, | 406 uint32 socket_id, |
402 bool succeeded, | 407 bool succeeded, |
403 const PP_NetAddress_Private& local_addr, | 408 const PP_NetAddress_Private& local_addr, |
404 const PP_NetAddress_Private& remote_addr); | 409 const PP_NetAddress_Private& remote_addr); |
(...skipping 16 matching lines...) Expand all Loading... | |
421 bool succeeded, | 426 bool succeeded, |
422 int32_t bytes_written); | 427 int32_t bytes_written); |
423 void OnUDPSocketRecvFromACK(uint32 plugin_dispatcher_id, | 428 void OnUDPSocketRecvFromACK(uint32 plugin_dispatcher_id, |
424 uint32 socket_id, | 429 uint32 socket_id, |
425 bool succeeded, | 430 bool succeeded, |
426 const std::string& data, | 431 const std::string& data, |
427 const PP_NetAddress_Private& addr); | 432 const PP_NetAddress_Private& addr); |
428 | 433 |
429 CONTENT_EXPORT int GetRoutingId() const; | 434 CONTENT_EXPORT int GetRoutingId() const; |
430 | 435 |
436 typedef base::Callback<void (int /* request_id */, | |
437 bool /* succeeded */, | |
438 const std::string& /* label */)> | |
439 OpenDeviceCallback; | |
440 | |
441 // Opens the specified device. The request ID passed into the callback will be | |
442 // the same as the return value. | |
443 int OpenDevice(PP_DeviceType_Dev type, | |
444 const std::string& device_id, | |
445 const OpenDeviceCallback& callback); | |
446 void CloseDevice(const std::string& label); | |
447 int GetSessionID(PP_DeviceType_Dev type, const std::string& label); | |
brettw
2012/02/10 23:46:23
I don't understand this function, can it have docu
yzshen1
2012/02/13 20:55:41
Done.
| |
448 | |
431 private: | 449 private: |
450 class DeviceEnumerationEventHandler; | |
451 | |
432 // Asynchronously attempts to create a PPAPI broker for the given plugin. | 452 // Asynchronously attempts to create a PPAPI broker for the given plugin. |
433 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( | 453 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( |
434 webkit::ppapi::PluginModule* plugin_module); | 454 webkit::ppapi::PluginModule* plugin_module); |
435 | 455 |
436 bool MouseLockedOrPending() const { | 456 bool MouseLockedOrPending() const { |
437 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; | 457 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; |
438 } | 458 } |
439 | 459 |
440 // Implementation of PepperParentContextProvider. | 460 // Implementation of PepperParentContextProvider. |
441 virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE; | 461 virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 bool pending_unlock_request_; | 517 bool pending_unlock_request_; |
498 | 518 |
499 // The plugin instance that received the last mouse event. It is set to NULL | 519 // The plugin instance that received the last mouse event. It is set to NULL |
500 // if the last mouse event went to elements other than Pepper plugins. | 520 // if the last mouse event went to elements other than Pepper plugins. |
501 // |last_mouse_event_target_| is not owned by this class. We can know about | 521 // |last_mouse_event_target_| is not owned by this class. We can know about |
502 // when it is destroyed via InstanceDeleted(). | 522 // when it is destroyed via InstanceDeleted(). |
503 webkit::ppapi::PluginInstance* last_mouse_event_target_; | 523 webkit::ppapi::PluginInstance* last_mouse_event_target_; |
504 | 524 |
505 scoped_ptr<content::GamepadSharedMemoryReader> gamepad_shared_memory_reader_; | 525 scoped_ptr<content::GamepadSharedMemoryReader> gamepad_shared_memory_reader_; |
506 | 526 |
527 scoped_ptr<DeviceEnumerationEventHandler> device_enumeration_event_handler_; | |
528 | |
507 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 529 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
508 }; | 530 }; |
509 | 531 |
510 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 532 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |