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_PEPPER_DEVICE_ENUMERATION_EVENT_HANDLER_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_EVENT_HANDLER_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_EVENT_HANDLER_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_EVENT_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 int RegisterEnumerateDevicesCallback( | 24 int RegisterEnumerateDevicesCallback( |
25 const webkit::ppapi::PluginDelegate::EnumerateDevicesCallback& callback); | 25 const webkit::ppapi::PluginDelegate::EnumerateDevicesCallback& callback); |
26 | 26 |
27 int RegisterOpenDeviceCallback( | 27 int RegisterOpenDeviceCallback( |
28 const PepperPluginDelegateImpl::OpenDeviceCallback& callback); | 28 const PepperPluginDelegateImpl::OpenDeviceCallback& callback); |
29 | 29 |
30 // MediaStreamDispatcherEventHandler implementation. | 30 // MediaStreamDispatcherEventHandler implementation. |
31 virtual void OnStreamGenerated( | 31 virtual void OnStreamGenerated( |
32 int request_id, | 32 int request_id, |
33 const std::string& label, | 33 const std::string& label, |
34 const media_stream::StreamDeviceInfoArray& audio_device_array, | 34 const StreamDeviceInfoArray& audio_device_array, |
35 const media_stream::StreamDeviceInfoArray& video_device_array) OVERRIDE; | 35 const StreamDeviceInfoArray& video_device_array) OVERRIDE; |
36 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE; | 36 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE; |
37 virtual void OnDevicesEnumerated( | 37 virtual void OnDevicesEnumerated( |
38 int request_id, | 38 int request_id, |
39 const media_stream::StreamDeviceInfoArray& device_array) OVERRIDE; | 39 const StreamDeviceInfoArray& device_array) OVERRIDE; |
40 virtual void OnDevicesEnumerationFailed(int request_id) OVERRIDE; | 40 virtual void OnDevicesEnumerationFailed(int request_id) OVERRIDE; |
41 virtual void OnDeviceOpened( | 41 virtual void OnDeviceOpened( |
42 int request_id, | 42 int request_id, |
43 const std::string& label, | 43 const std::string& label, |
44 const media_stream::StreamDeviceInfo& device_info) OVERRIDE; | 44 const StreamDeviceInfo& device_info) OVERRIDE; |
45 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; | 45 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; |
46 | 46 |
47 // Stream type conversion. | 47 // Stream type conversion. |
48 static media_stream::MediaStreamType FromPepperDeviceType( | 48 static MediaStreamType FromPepperDeviceType(PP_DeviceType_Dev type); |
49 PP_DeviceType_Dev type); | 49 static PP_DeviceType_Dev FromMediaStreamType(MediaStreamType type); |
50 static PP_DeviceType_Dev FromMediaStreamType( | |
51 media_stream::MediaStreamType type); | |
52 | 50 |
53 private: | 51 private: |
54 void NotifyDevicesEnumerated( | 52 void NotifyDevicesEnumerated( |
55 int request_id, | 53 int request_id, |
56 bool succeeded, | 54 bool succeeded, |
57 const media_stream::StreamDeviceInfoArray& device_array); | 55 const StreamDeviceInfoArray& device_array); |
58 | 56 |
59 void NotifyDeviceOpened(int request_id, | 57 void NotifyDeviceOpened(int request_id, |
60 bool succeeded, | 58 bool succeeded, |
61 const std::string& label); | 59 const std::string& label); |
62 | 60 |
63 int next_id_; | 61 int next_id_; |
64 | 62 |
65 typedef std::map<int, | 63 typedef std::map<int, |
66 webkit::ppapi::PluginDelegate::EnumerateDevicesCallback> | 64 webkit::ppapi::PluginDelegate::EnumerateDevicesCallback> |
67 EnumerateCallbackMap; | 65 EnumerateCallbackMap; |
68 EnumerateCallbackMap enumerate_callbacks_; | 66 EnumerateCallbackMap enumerate_callbacks_; |
69 | 67 |
70 typedef std::map<int, PepperPluginDelegateImpl::OpenDeviceCallback> | 68 typedef std::map<int, PepperPluginDelegateImpl::OpenDeviceCallback> |
71 OpenCallbackMap; | 69 OpenCallbackMap; |
72 OpenCallbackMap open_callbacks_; | 70 OpenCallbackMap open_callbacks_; |
73 | 71 |
74 DISALLOW_COPY_AND_ASSIGN(PepperDeviceEnumerationEventHandler); | 72 DISALLOW_COPY_AND_ASSIGN(PepperDeviceEnumerationEventHandler); |
75 }; | 73 }; |
76 | 74 |
77 } // namespace content | 75 } // namespace content |
78 | 76 |
79 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_EVENT_HANDLER_H_ | 77 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_EVENT_HANDLER_H_ |
OLD | NEW |