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_MEDIA_DEVICE_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "content/common/media/media_devices.h" | 14 #include "content/common/media/media_devices.h" |
15 #include "content/common/media/media_devices.mojom.h" | 15 #include "content/common/media/media_devices.mojom.h" |
16 #include "content/public/renderer/render_frame_observer.h" | 16 #include "content/public/renderer/render_frame_observer.h" |
17 #include "content/public/renderer/render_frame_observer_tracker.h" | 17 #include "content/public/renderer/render_frame_observer_tracker.h" |
18 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" | 18 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" |
19 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h" | 19 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h" |
| 20 #include "ppapi/c/pp_instance.h" |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 class MediaStreamDispatcher; | 23 class MediaStreamDispatcher; |
23 | 24 |
24 class PepperMediaDeviceManager | 25 class PepperMediaDeviceManager |
25 : public MediaStreamDispatcherEventHandler, | 26 : public MediaStreamDispatcherEventHandler, |
26 public PepperDeviceEnumerationHostHelper::Delegate, | 27 public PepperDeviceEnumerationHostHelper::Delegate, |
27 public RenderFrameObserver, | 28 public RenderFrameObserver, |
28 public RenderFrameObserverTracker<PepperMediaDeviceManager>, | 29 public RenderFrameObserverTracker<PepperMediaDeviceManager>, |
29 public base::SupportsWeakPtr<PepperMediaDeviceManager> { | 30 public base::SupportsWeakPtr<PepperMediaDeviceManager> { |
(...skipping 16 matching lines...) Expand all Loading... |
46 bool /* succeeded */, | 47 bool /* succeeded */, |
47 const std::string& /* label */)> | 48 const std::string& /* label */)> |
48 OpenDeviceCallback; | 49 OpenDeviceCallback; |
49 | 50 |
50 // Opens the specified device. The request ID passed into the callback will be | 51 // Opens the specified device. The request ID passed into the callback will be |
51 // the same as the return value. If successful, the label passed into the | 52 // the same as the return value. If successful, the label passed into the |
52 // callback identifies a audio/video steam, which can be used to call | 53 // callback identifies a audio/video steam, which can be used to call |
53 // CloseDevice() and GetSesssionID(). | 54 // CloseDevice() and GetSesssionID(). |
54 int OpenDevice(PP_DeviceType_Dev type, | 55 int OpenDevice(PP_DeviceType_Dev type, |
55 const std::string& device_id, | 56 const std::string& device_id, |
56 const GURL& document_url, | 57 PP_Instance pp_instance, |
57 const OpenDeviceCallback& callback); | 58 const OpenDeviceCallback& callback); |
58 // Cancels an request to open device, using the request ID returned by | 59 // Cancels an request to open device, using the request ID returned by |
59 // OpenDevice(). It is guaranteed that the callback passed into OpenDevice() | 60 // OpenDevice(). It is guaranteed that the callback passed into OpenDevice() |
60 // won't be called afterwards. | 61 // won't be called afterwards. |
61 void CancelOpenDevice(int request_id); | 62 void CancelOpenDevice(int request_id); |
62 void CloseDevice(const std::string& label); | 63 void CloseDevice(const std::string& label); |
63 // Gets audio/video session ID given a label. | 64 // Gets audio/video session ID given a label. |
64 int GetSessionID(PP_DeviceType_Dev type, const std::string& label); | 65 int GetSessionID(PP_DeviceType_Dev type, const std::string& label); |
65 | 66 |
66 // MediaStreamDispatcherEventHandler implementation. | 67 // MediaStreamDispatcherEventHandler implementation. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 OpenCallbackMap open_callbacks_; | 114 OpenCallbackMap open_callbacks_; |
114 | 115 |
115 ::mojom::MediaDevicesDispatcherHostPtr media_devices_dispatcher_; | 116 ::mojom::MediaDevicesDispatcherHostPtr media_devices_dispatcher_; |
116 | 117 |
117 DISALLOW_COPY_AND_ASSIGN(PepperMediaDeviceManager); | 118 DISALLOW_COPY_AND_ASSIGN(PepperMediaDeviceManager); |
118 }; | 119 }; |
119 | 120 |
120 } // namespace content | 121 } // namespace content |
121 | 122 |
122 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_ | 123 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_ |
OLD | NEW |