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 CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
6 #define CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 6 #define CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "content/public/browser/media_observer.h" | 12 #include "content/public/browser/media_observer.h" |
13 #include "content/public/common/media_stream_request.h" | 13 #include "content/public/common/media_stream_request.h" |
14 | 14 |
| 15 class AudioStreamIndicator; |
15 class MediaStreamCaptureIndicator; | 16 class MediaStreamCaptureIndicator; |
16 class PrefRegistrySyncable; | 17 class PrefRegistrySyncable; |
17 class PrefService; | 18 class PrefService; |
18 class Profile; | 19 class Profile; |
19 | 20 |
20 // This singleton is used to receive updates about media events from the content | 21 // This singleton is used to receive updates about media events from the content |
21 // layer. | 22 // layer. |
22 class MediaCaptureDevicesDispatcher : public content::MediaObserver { | 23 class MediaCaptureDevicesDispatcher : public content::MediaObserver { |
23 public: | 24 public: |
24 class Observer { | 25 class Observer { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const content::MediaStreamDevices& devices) OVERRIDE; | 87 const content::MediaStreamDevices& devices) OVERRIDE; |
87 virtual void OnAudioCaptureDevicesChanged( | 88 virtual void OnAudioCaptureDevicesChanged( |
88 const content::MediaStreamDevices& devices) OVERRIDE; | 89 const content::MediaStreamDevices& devices) OVERRIDE; |
89 virtual void OnVideoCaptureDevicesChanged( | 90 virtual void OnVideoCaptureDevicesChanged( |
90 const content::MediaStreamDevices& devices) OVERRIDE; | 91 const content::MediaStreamDevices& devices) OVERRIDE; |
91 virtual void OnMediaRequestStateChanged( | 92 virtual void OnMediaRequestStateChanged( |
92 int render_process_id, | 93 int render_process_id, |
93 int render_view_id, | 94 int render_view_id, |
94 const content::MediaStreamDevice& device, | 95 const content::MediaStreamDevice& device, |
95 content::MediaRequestState state) OVERRIDE; | 96 content::MediaRequestState state) OVERRIDE; |
| 97 virtual void OnAudioStreamPlayingChanged( |
| 98 int render_process_id, |
| 99 int render_view_id, |
| 100 int stream_id, |
| 101 bool playing) OVERRIDE; |
96 | 102 |
97 scoped_refptr<MediaStreamCaptureIndicator> GetMediaStreamCaptureIndicator(); | 103 scoped_refptr<MediaStreamCaptureIndicator> GetMediaStreamCaptureIndicator(); |
98 | 104 |
| 105 scoped_refptr<AudioStreamIndicator> GetAudioStreamIndicator(); |
| 106 |
99 private: | 107 private: |
100 friend struct DefaultSingletonTraits<MediaCaptureDevicesDispatcher>; | 108 friend struct DefaultSingletonTraits<MediaCaptureDevicesDispatcher>; |
101 | 109 |
102 MediaCaptureDevicesDispatcher(); | 110 MediaCaptureDevicesDispatcher(); |
103 virtual ~MediaCaptureDevicesDispatcher(); | 111 virtual ~MediaCaptureDevicesDispatcher(); |
104 | 112 |
105 // Called by the MediaObserver() functions, executed on UI thread. | 113 // Called by the MediaObserver() functions, executed on UI thread. |
106 void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices); | 114 void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices); |
107 void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices); | 115 void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices); |
108 void UpdateMediaRequestStateOnUIThread( | 116 void UpdateMediaRequestStateOnUIThread( |
109 int render_process_id, | 117 int render_process_id, |
110 int render_view_id, | 118 int render_view_id, |
111 const content::MediaStreamDevice& device, | 119 const content::MediaStreamDevice& device, |
112 content::MediaRequestState state); | 120 content::MediaRequestState state); |
113 | 121 |
114 // A list of cached audio capture devices. | 122 // A list of cached audio capture devices. |
115 content::MediaStreamDevices audio_devices_; | 123 content::MediaStreamDevices audio_devices_; |
116 | 124 |
117 // A list of cached video capture devices. | 125 // A list of cached video capture devices. |
118 content::MediaStreamDevices video_devices_; | 126 content::MediaStreamDevices video_devices_; |
119 | 127 |
120 // A list of observers for the device update notifications. | 128 // A list of observers for the device update notifications. |
121 ObserverList<Observer> observers_; | 129 ObserverList<Observer> observers_; |
122 | 130 |
123 // Flag to indicate if device enumeration has been done/doing. | 131 // Flag to indicate if device enumeration has been done/doing. |
124 // Only accessed on UI thread. | 132 // Only accessed on UI thread. |
125 bool devices_enumerated_; | 133 bool devices_enumerated_; |
126 | 134 |
127 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; | 135 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; |
| 136 |
| 137 scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; |
128 }; | 138 }; |
129 | 139 |
130 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 140 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
OLD | NEW |