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

Side by Side Diff: content/renderer/pepper_plugin_delegate_impl.cc

Issue 9234064: Implement device enumeration for PPB_VideoCapture_Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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 | « content/renderer/pepper_plugin_delegate_impl.h ('k') | ppapi/api/dev/ppb_video_capture_dev.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/renderer/pepper_plugin_delegate_impl.h" 5 #include "content/renderer/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <map>
8 #include <queue> 9 #include <queue>
9 10
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/file_path.h" 14 #include "base/file_path.h"
14 #include "base/file_util_proxy.h" 15 #include "base/file_util_proxy.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h"
18 #include "base/string_split.h" 17 #include "base/string_split.h"
19 #include "base/sync_socket.h" 18 #include "base/sync_socket.h"
20 #include "base/time.h" 19 #include "base/time.h"
21 #include "content/common/child_process.h" 20 #include "content/common/child_process.h"
22 #include "content/common/child_process_messages.h" 21 #include "content/common/child_process_messages.h"
23 #include "content/common/child_thread.h" 22 #include "content/common/child_thread.h"
24 #include "content/common/file_system/file_system_dispatcher.h" 23 #include "content/common/file_system/file_system_dispatcher.h"
25 #include "content/common/file_system_messages.h" 24 #include "content/common/file_system_messages.h"
26 #include "content/common/gpu/client/content_gl_context.h" 25 #include "content/common/gpu/client/content_gl_context.h"
27 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 26 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
28 #include "content/common/media/audio_messages.h" 27 #include "content/common/media/audio_messages.h"
29 #include "content/common/pepper_file_messages.h" 28 #include "content/common/pepper_file_messages.h"
30 #include "content/common/pepper_plugin_registry.h" 29 #include "content/common/pepper_plugin_registry.h"
31 #include "content/common/pepper_messages.h" 30 #include "content/common/pepper_messages.h"
32 #include "content/common/quota_dispatcher.h" 31 #include "content/common/quota_dispatcher.h"
33 #include "content/common/view_messages.h" 32 #include "content/common/view_messages.h"
34 #include "content/public/common/content_switches.h" 33 #include "content/public/common/content_switches.h"
35 #include "content/public/common/context_menu_params.h" 34 #include "content/public/common/context_menu_params.h"
36 #include "content/public/renderer/content_renderer_client.h" 35 #include "content/public/renderer/content_renderer_client.h"
37 #include "content/renderer/gamepad_shared_memory_reader.h" 36 #include "content/renderer/gamepad_shared_memory_reader.h"
38 #include "content/renderer/media/audio_input_message_filter.h" 37 #include "content/renderer/media/audio_input_message_filter.h"
39 #include "content/renderer/media/audio_message_filter.h" 38 #include "content/renderer/media/audio_message_filter.h"
39 #include "content/renderer/media/media_stream_dispatcher.h"
40 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
40 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" 41 #include "content/renderer/media/pepper_platform_video_decoder_impl.h"
41 #include "content/renderer/media/video_capture_impl_manager.h"
42 #include "content/renderer/p2p/p2p_transport_impl.h" 42 #include "content/renderer/p2p/p2p_transport_impl.h"
43 #include "content/renderer/pepper_platform_context_3d_impl.h" 43 #include "content/renderer/pepper_platform_context_3d_impl.h"
44 #include "content/renderer/pepper_platform_video_capture_impl.h"
44 #include "content/renderer/render_thread_impl.h" 45 #include "content/renderer/render_thread_impl.h"
45 #include "content/renderer/render_view_impl.h" 46 #include "content/renderer/render_view_impl.h"
46 #include "content/renderer/render_widget_fullscreen_pepper.h" 47 #include "content/renderer/render_widget_fullscreen_pepper.h"
47 #include "content/renderer/webplugin_delegate_proxy.h" 48 #include "content/renderer/webplugin_delegate_proxy.h"
48 #include "ipc/ipc_channel_handle.h" 49 #include "ipc/ipc_channel_handle.h"
49 #include "media/audio/audio_manager_base.h" 50 #include "media/audio/audio_manager_base.h"
50 #include "media/video/capture/video_capture_proxy.h" 51 #include "media/video/capture/video_capture_proxy.h"
51 #include "ppapi/c/dev/pp_video_dev.h" 52 #include "ppapi/c/dev/pp_video_dev.h"
52 #include "ppapi/c/pp_errors.h" 53 #include "ppapi/c/pp_errors.h"
53 #include "ppapi/c/private/ppb_flash.h" 54 #include "ppapi/c/private/ppb_flash.h"
54 #include "ppapi/c/private/ppb_flash_net_connector.h" 55 #include "ppapi/c/private/ppb_flash_net_connector.h"
55 #include "ppapi/proxy/host_dispatcher.h" 56 #include "ppapi/proxy/host_dispatcher.h"
56 #include "ppapi/proxy/ppapi_messages.h" 57 #include "ppapi/proxy/ppapi_messages.h"
58 #include "ppapi/shared_impl/ppb_device_ref_shared.h"
57 #include "ppapi/shared_impl/platform_file.h" 59 #include "ppapi/shared_impl/platform_file.h"
58 #include "ppapi/shared_impl/ppapi_preferences.h" 60 #include "ppapi/shared_impl/ppapi_preferences.h"
59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" 61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
60 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
61 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet ion.h" 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserComplet ion.h"
62 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h" 64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams. h"
63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
64 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" 67 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
66 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 68 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 virtual void DidGrantStorageQuota(int64 granted_quota) OVERRIDE { 566 virtual void DidGrantStorageQuota(int64 granted_quota) OVERRIDE {
565 NOTREACHED(); 567 NOTREACHED();
566 } 568 }
567 virtual void DidFail(quota::QuotaStatusCode error) OVERRIDE { 569 virtual void DidFail(quota::QuotaStatusCode error) OVERRIDE {
568 callback_.Run(0); 570 callback_.Run(0);
569 } 571 }
570 private: 572 private:
571 PluginCallback callback_; 573 PluginCallback callback_;
572 }; 574 };
573 575
574 class PlatformVideoCaptureImpl 576 media_stream::MediaStreamType FromPepperDeviceType(PP_DeviceType_Dev type) {
575 : public webkit::ppapi::PluginDelegate::PlatformVideoCapture { 577 switch (type) {
576 public: 578 case PP_DEVICETYPE_DEV_INVALID:
577 PlatformVideoCaptureImpl(media::VideoCapture::EventHandler* handler) 579 return media_stream::kNoService;
578 : handler_proxy_(new media::VideoCaptureHandlerProxy( 580 case PP_DEVICETYPE_DEV_AUDIOCAPTURE:
579 handler, base::MessageLoopProxy::current())) { 581 return media_stream::kAudioCapture;
580 VideoCaptureImplManager* manager = 582 case PP_DEVICETYPE_DEV_VIDEOCAPTURE:
581 RenderThreadImpl::current()->video_capture_impl_manager(); 583 return media_stream::kVideoCapture;
582 // 1 means the "default" video capture device. 584 default:
583 // TODO(piman): Add a way to enumerate devices and pass them through the 585 NOTREACHED();
584 // API. 586 return media_stream::kNoService;
585 video_capture_ = manager->AddDevice(1, handler_proxy_.get());
586 } 587 }
588 }
587 589
588 // Overrides from media::VideoCapture::EventHandler 590 PP_DeviceType_Dev FromMediaStreamType(media_stream::MediaStreamType type) {
589 virtual ~PlatformVideoCaptureImpl() { 591 switch (type) {
590 VideoCaptureImplManager* manager = 592 case media_stream::kNoService:
591 RenderThreadImpl::current()->video_capture_impl_manager(); 593 return PP_DEVICETYPE_DEV_INVALID;
592 manager->RemoveDevice(1, handler_proxy_.get()); 594 case media_stream::kAudioCapture:
595 return PP_DEVICETYPE_DEV_AUDIOCAPTURE;
596 case media_stream::kVideoCapture:
597 return PP_DEVICETYPE_DEV_VIDEOCAPTURE;
598 default:
599 NOTREACHED();
600 return PP_DEVICETYPE_DEV_INVALID;
593 } 601 }
602 }
594 603
595 virtual void StartCapture( 604 ppapi::DeviceRefData FromStreamDeviceInfo(
596 EventHandler* handler, 605 const media_stream::StreamDeviceInfo& info) {
597 const VideoCaptureCapability& capability) OVERRIDE { 606 ppapi::DeviceRefData data;
598 DCHECK(handler == handler_proxy_->proxied()); 607 data.id = info.device_id;
599 video_capture_->StartCapture(handler_proxy_.get(), capability); 608 data.name = info.name;
600 } 609 data.type = FromMediaStreamType(info.stream_type);
601 610 return data;
602 virtual void StopCapture(EventHandler* handler) OVERRIDE { 611 }
603 DCHECK(handler == handler_proxy_->proxied());
604 video_capture_->StopCapture(handler_proxy_.get());
605 }
606
607 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE {
608 video_capture_->FeedBuffer(buffer);
609 }
610
611 virtual bool CaptureStarted() OVERRIDE {
612 return handler_proxy_->state().started;
613 }
614
615 virtual int CaptureWidth() OVERRIDE {
616 return handler_proxy_->state().width;
617 }
618
619 virtual int CaptureHeight() OVERRIDE {
620 return handler_proxy_->state().height;
621 }
622
623 virtual int CaptureFrameRate() OVERRIDE {
624 return handler_proxy_->state().frame_rate;
625 }
626
627 private:
628 scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_;
629 media::VideoCapture* video_capture_;
630 };
631 612
632 class PluginInstanceLockTarget : public MouseLockDispatcher::LockTarget { 613 class PluginInstanceLockTarget : public MouseLockDispatcher::LockTarget {
633 public: 614 public:
634 PluginInstanceLockTarget(webkit::ppapi::PluginInstance* plugin) 615 PluginInstanceLockTarget(webkit::ppapi::PluginInstance* plugin)
635 : plugin_(plugin) {} 616 : plugin_(plugin) {}
636 617
637 virtual void OnLockMouseACK(bool succeeded) OVERRIDE { 618 virtual void OnLockMouseACK(bool succeeded) OVERRIDE {
638 plugin_->OnLockMouseACK(succeeded); 619 plugin_->OnLockMouseACK(succeeded);
639 } 620 }
640 621
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 } 827 }
847 828
848 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing 829 // TOOD(ddorwin): Change the IPC to asynchronous: Queue an object containing
849 // client and plugin_socket.release(), then return. 830 // client and plugin_socket.release(), then return.
850 // That message handler will then call client->BrokerConnected() with the 831 // That message handler will then call client->BrokerConnected() with the
851 // saved pipe handle. 832 // saved pipe handle.
852 // Temporarily, just call back. 833 // Temporarily, just call back.
853 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result); 834 client->BrokerConnected(ppapi::PlatformFileToInt(plugin_handle), result);
854 } 835 }
855 836
837 class PepperPluginDelegateImpl::DeviceEnumerationEventHandler
838 : public MediaStreamDispatcherEventHandler {
839 public:
840 DeviceEnumerationEventHandler() : next_id_(1) {
841 }
842
843 virtual ~DeviceEnumerationEventHandler() {
844 DCHECK(enumerate_callbacks_.empty());
845 DCHECK(open_callbacks_.empty());
846 }
847
848 int RegisterEnumerateDevicesCallback(
849 const EnumerateDevicesCallback& callback) {
850 enumerate_callbacks_[next_id_] = callback;
851 return next_id_++;
852 }
853
854 int RegisterOpenDeviceCallback(const OpenDeviceCallback& callback) {
855 open_callbacks_[next_id_] = callback;
856 return next_id_++;
857 }
858
859 // MediaStreamDispatcherEventHandler implementation.
860 virtual void OnStreamGenerated(
861 int request_id,
862 const std::string& label,
863 const media_stream::StreamDeviceInfoArray& audio_device_array,
864 const media_stream::StreamDeviceInfoArray& video_device_array) OVERRIDE {
865 }
866
867 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE {
868 }
869
870 virtual void OnVideoDeviceFailed(const std::string& label,
871 int index) OVERRIDE {
872 }
873
874 virtual void OnAudioDeviceFailed(const std::string& label,
875 int index) OVERRIDE {
876 }
877
878 virtual void OnDevicesEnumerated(
879 int request_id,
880 const media_stream::StreamDeviceInfoArray& device_array) OVERRIDE {
881 NotifyDevicesEnumerated(request_id, true, device_array);
882 }
883
884 virtual void OnDevicesEnumerationFailed(int request_id) OVERRIDE {
885 NotifyDevicesEnumerated(request_id, false,
886 media_stream::StreamDeviceInfoArray());
887 }
888
889 virtual void OnDeviceOpened(
890 int request_id,
891 const std::string& label,
892 const media_stream::StreamDeviceInfo& device_info) OVERRIDE {
893 NotifyDeviceOpened(request_id, true, label);
894 }
895
896 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE {
897 NotifyDeviceOpened(request_id, false, "");
898 }
899
900 private:
901 void NotifyDevicesEnumerated(
902 int request_id,
903 bool succeeded,
904 const media_stream::StreamDeviceInfoArray& device_array) {
905 EnumerateCallbackMap::iterator iter = enumerate_callbacks_.find(request_id);
906 if (iter == enumerate_callbacks_.end()) {
907 NOTREACHED();
908 return;
909 }
910
911 EnumerateDevicesCallback callback = iter->second;
912 enumerate_callbacks_.erase(iter);
913
914 std::vector<ppapi::DeviceRefData> devices;
915 if (succeeded) {
916 devices.reserve(device_array.size());
917 for (media_stream::StreamDeviceInfoArray::const_iterator info =
918 device_array.begin(); info != device_array.end(); ++info) {
919 devices.push_back(FromStreamDeviceInfo(*info));
920 }
921 }
922 callback.Run(request_id, succeeded, devices);
923 }
924
925 void NotifyDeviceOpened(int request_id,
926 bool succeeded,
927 const std::string& label) {
928 OpenCallbackMap::iterator iter = open_callbacks_.find(request_id);
929 if (iter == open_callbacks_.end()) {
930 NOTREACHED();
931 return;
932 }
933
934 OpenDeviceCallback callback = iter->second;
935 open_callbacks_.erase(iter);
936
937 callback.Run(request_id, succeeded, label);
938 }
939
940 int next_id_;
941
942 typedef std::map<int, EnumerateDevicesCallback> EnumerateCallbackMap;
943 EnumerateCallbackMap enumerate_callbacks_;
944
945 typedef std::map<int, OpenDeviceCallback> OpenCallbackMap;
946 OpenCallbackMap open_callbacks_;
947
948 DISALLOW_COPY_AND_ASSIGN(DeviceEnumerationEventHandler);
949 };
950
856 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view) 951 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view)
857 : content::RenderViewObserver(render_view), 952 : content::RenderViewObserver(render_view),
858 render_view_(render_view), 953 render_view_(render_view),
859 has_saved_context_menu_action_(false), 954 has_saved_context_menu_action_(false),
860 saved_context_menu_action_(0), 955 saved_context_menu_action_(0),
861 focused_plugin_(NULL), 956 focused_plugin_(NULL),
862 last_mouse_event_target_(NULL) { 957 last_mouse_event_target_(NULL),
958 device_enumeration_event_handler_(new DeviceEnumerationEventHandler()) {
863 } 959 }
864 960
865 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() { 961 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() {
866 DCHECK(mouse_lock_instances_.empty()); 962 DCHECK(mouse_lock_instances_.empty());
867 } 963 }
868 964
869 scoped_refptr<webkit::ppapi::PluginModule> 965 scoped_refptr<webkit::ppapi::PluginModule>
870 PepperPluginDelegateImpl::CreatePepperPluginModule( 966 PepperPluginDelegateImpl::CreatePepperPluginModule(
871 const webkit::WebPluginInfo& webplugin_info, 967 const webkit::WebPluginInfo& webplugin_info,
872 bool* pepper_plugin_was_registered) { 968 bool* pepper_plugin_was_registered) {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 if (!render_view_->webkit_preferences().accelerated_plugins_enabled) 1327 if (!render_view_->webkit_preferences().accelerated_plugins_enabled)
1232 return NULL; 1328 return NULL;
1233 return new PlatformContext3DImpl(this); 1329 return new PlatformContext3DImpl(this);
1234 #else 1330 #else
1235 return NULL; 1331 return NULL;
1236 #endif 1332 #endif
1237 } 1333 }
1238 1334
1239 webkit::ppapi::PluginDelegate::PlatformVideoCapture* 1335 webkit::ppapi::PluginDelegate::PlatformVideoCapture*
1240 PepperPluginDelegateImpl::CreateVideoCapture( 1336 PepperPluginDelegateImpl::CreateVideoCapture(
1241 media::VideoCapture::EventHandler* handler) { 1337 const std::string& device_id,
1242 return new PlatformVideoCaptureImpl(handler); 1338 PlatformVideoCaptureEventHandler* handler) {
1339 return new PepperPlatformVideoCaptureImpl(AsWeakPtr(), device_id, handler);
1243 } 1340 }
1244 1341
1245 webkit::ppapi::PluginDelegate::PlatformVideoDecoder* 1342 webkit::ppapi::PluginDelegate::PlatformVideoDecoder*
1246 PepperPluginDelegateImpl::CreateVideoDecoder( 1343 PepperPluginDelegateImpl::CreateVideoDecoder(
1247 media::VideoDecodeAccelerator::Client* client, 1344 media::VideoDecodeAccelerator::Client* client,
1248 int32 command_buffer_route_id) { 1345 int32 command_buffer_route_id) {
1249 return new PlatformVideoDecoderImpl(client, command_buffer_route_id); 1346 return new PlatformVideoDecoderImpl(client, command_buffer_route_id);
1250 } 1347 }
1251 1348
1252 void PepperPluginDelegateImpl::NumberOfFindResultsChanged(int identifier, 1349 void PepperPluginDelegateImpl::NumberOfFindResultsChanged(int identifier,
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 void PepperPluginDelegateImpl::SampleGamepads(WebKit::WebGamepads* data) { 2055 void PepperPluginDelegateImpl::SampleGamepads(WebKit::WebGamepads* data) {
1959 if (!gamepad_shared_memory_reader_.get()) 2056 if (!gamepad_shared_memory_reader_.get())
1960 gamepad_shared_memory_reader_.reset(new content::GamepadSharedMemoryReader); 2057 gamepad_shared_memory_reader_.reset(new content::GamepadSharedMemoryReader);
1961 gamepad_shared_memory_reader_->SampleGamepads(*data); 2058 gamepad_shared_memory_reader_->SampleGamepads(*data);
1962 } 2059 }
1963 2060
1964 bool PepperPluginDelegateImpl::IsPageVisible() const { 2061 bool PepperPluginDelegateImpl::IsPageVisible() const {
1965 return !render_view_->is_hidden(); 2062 return !render_view_->is_hidden();
1966 } 2063 }
1967 2064
2065 int PepperPluginDelegateImpl::EnumerateDevices(
2066 PP_DeviceType_Dev type,
2067 const EnumerateDevicesCallback& callback) {
2068 int request_id =
2069 device_enumeration_event_handler_->RegisterEnumerateDevicesCallback(
2070 callback);
2071 render_view_->media_stream_dispatcher()->EnumerateDevices(
2072 request_id, device_enumeration_event_handler_.get(),
2073 FromPepperDeviceType(type), "");
2074 return request_id;
2075 }
2076
1968 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) { 2077 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) {
1969 bool handled = true; 2078 bool handled = true;
1970 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message) 2079 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message)
1971 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, 2080 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK,
1972 OnTCPSocketConnectACK) 2081 OnTCPSocketConnectACK)
1973 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, 2082 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK,
1974 OnTCPSocketSSLHandshakeACK) 2083 OnTCPSocketSSLHandshakeACK)
1975 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK) 2084 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ReadACK, OnTCPSocketReadACK)
1976 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK) 2085 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_WriteACK, OnTCPSocketWriteACK)
1977 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK) 2086 IPC_MESSAGE_HANDLER(PpapiMsg_PPBUDPSocket_BindACK, OnUDPSocketBindACK)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket = 2168 webkit::ppapi::PPB_UDPSocket_Private_Impl* socket =
2060 udp_sockets_.Lookup(socket_id); 2169 udp_sockets_.Lookup(socket_id);
2061 if (socket) 2170 if (socket)
2062 socket->OnSendToCompleted(succeeded, bytes_written); 2171 socket->OnSendToCompleted(succeeded, bytes_written);
2063 } 2172 }
2064 2173
2065 int PepperPluginDelegateImpl::GetRoutingId() const { 2174 int PepperPluginDelegateImpl::GetRoutingId() const {
2066 return render_view_->routing_id(); 2175 return render_view_->routing_id();
2067 } 2176 }
2068 2177
2178 int PepperPluginDelegateImpl::OpenDevice(PP_DeviceType_Dev type,
2179 const std::string& device_id,
2180 const OpenDeviceCallback& callback) {
2181 int request_id =
2182 device_enumeration_event_handler_->RegisterOpenDeviceCallback(callback);
2183 render_view_->media_stream_dispatcher()->OpenDevice(
2184 request_id, device_enumeration_event_handler_.get(), device_id,
2185 FromPepperDeviceType(type), "");
2186 return request_id;
2187 }
2188
2189 void PepperPluginDelegateImpl::CloseDevice(const std::string& label) {
2190 render_view_->media_stream_dispatcher()->CloseDevice(label);
2191 }
2192
2193 int PepperPluginDelegateImpl::GetSessionID(PP_DeviceType_Dev type,
2194 const std::string& label) {
2195 switch (type) {
2196 case PP_DEVICETYPE_DEV_AUDIOCAPTURE:
2197 return render_view_->media_stream_dispatcher()->audio_session_id(label,
2198 0);
2199 case PP_DEVICETYPE_DEV_VIDEOCAPTURE:
2200 return render_view_->media_stream_dispatcher()->video_session_id(label,
2201 0);
2202 default:
2203 NOTREACHED();
2204 return 0;
2205 }
2206 }
2207
2069 ContentGLContext* 2208 ContentGLContext*
2070 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() { 2209 PepperPluginDelegateImpl::GetParentContextForPlatformContext3D() {
2071 WebGraphicsContext3DCommandBufferImpl* context = 2210 WebGraphicsContext3DCommandBufferImpl* context =
2072 static_cast<WebGraphicsContext3DCommandBufferImpl*>( 2211 static_cast<WebGraphicsContext3DCommandBufferImpl*>(
2073 render_view_->webview()->graphicsContext3D()); 2212 render_view_->webview()->graphicsContext3D());
2074 if (!context) 2213 if (!context)
2075 return NULL; 2214 return NULL;
2076 if (!context->makeContextCurrent() || context->isContextLost()) 2215 if (!context->makeContextCurrent() || context->isContextLost())
2077 return NULL; 2216 return NULL;
2078 2217
(...skipping 27 matching lines...) Expand all
2106 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter( 2245 void PepperPluginDelegateImpl::UnSetAndDeleteLockTargetAdapter(
2107 webkit::ppapi::PluginInstance* instance) { 2246 webkit::ppapi::PluginInstance* instance) {
2108 LockTargetMap::iterator it = mouse_lock_instances_.find(instance); 2247 LockTargetMap::iterator it = mouse_lock_instances_.find(instance);
2109 if (it != mouse_lock_instances_.end()) { 2248 if (it != mouse_lock_instances_.end()) {
2110 MouseLockDispatcher::LockTarget* target = it->second; 2249 MouseLockDispatcher::LockTarget* target = it->second;
2111 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target); 2250 render_view_->mouse_lock_dispatcher()->OnLockTargetDestroyed(target);
2112 delete target; 2251 delete target;
2113 mouse_lock_instances_.erase(it); 2252 mouse_lock_instances_.erase(it);
2114 } 2253 }
2115 } 2254 }
OLDNEW
« no previous file with comments | « content/renderer/pepper_plugin_delegate_impl.h ('k') | ppapi/api/dev/ppb_video_capture_dev.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698