| 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/browser/web_contents_delegate.h" | 13 #include "content/public/browser/web_contents_delegate.h" |
| 14 #include "content/public/common/media_stream_request.h" | 14 #include "content/public/common/media_stream_request.h" |
| 15 | 15 |
| 16 class AudioStreamIndicator; |
| 17 class MediaStreamCaptureIndicator; |
| 18 class Profile; |
| 19 |
| 16 namespace extensions { | 20 namespace extensions { |
| 17 class Extension; | 21 class Extension; |
| 18 } | 22 } |
| 19 | 23 |
| 20 class AudioStreamIndicator; | 24 namespace user_prefs { |
| 21 class MediaStreamCaptureIndicator; | |
| 22 class PrefRegistrySyncable; | 25 class PrefRegistrySyncable; |
| 23 class Profile; | 26 } |
| 24 | 27 |
| 25 // This singleton is used to receive updates about media events from the content | 28 // This singleton is used to receive updates about media events from the content |
| 26 // layer. | 29 // layer. |
| 27 class MediaCaptureDevicesDispatcher : public content::MediaObserver { | 30 class MediaCaptureDevicesDispatcher : public content::MediaObserver { |
| 28 public: | 31 public: |
| 29 class Observer { | 32 class Observer { |
| 30 public: | 33 public: |
| 31 // Handle an information update consisting of a up-to-date audio capture | 34 // Handle an information update consisting of a up-to-date audio capture |
| 32 // device lists. This happens when a microphone is plugged in or unplugged. | 35 // device lists. This happens when a microphone is plugged in or unplugged. |
| 33 virtual void OnUpdateAudioDevices( | 36 virtual void OnUpdateAudioDevices( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 int render_view_id, | 47 int render_view_id, |
| 45 const content::MediaStreamDevice& device, | 48 const content::MediaStreamDevice& device, |
| 46 const content::MediaRequestState state) {} | 49 const content::MediaRequestState state) {} |
| 47 | 50 |
| 48 virtual ~Observer() {} | 51 virtual ~Observer() {} |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 static MediaCaptureDevicesDispatcher* GetInstance(); | 54 static MediaCaptureDevicesDispatcher* GetInstance(); |
| 52 | 55 |
| 53 // Registers the preferences related to Media Stream default devices. | 56 // Registers the preferences related to Media Stream default devices. |
| 54 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 57 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
| 55 | 58 |
| 56 // Methods for observers. Called on UI thread. | 59 // Methods for observers. Called on UI thread. |
| 57 // Observers should add themselves on construction and remove themselves | 60 // Observers should add themselves on construction and remove themselves |
| 58 // on destruction. | 61 // on destruction. |
| 59 void AddObserver(Observer* observer); | 62 void AddObserver(Observer* observer); |
| 60 void RemoveObserver(Observer* observer); | 63 void RemoveObserver(Observer* observer); |
| 61 const content::MediaStreamDevices& GetAudioCaptureDevices(); | 64 const content::MediaStreamDevices& GetAudioCaptureDevices(); |
| 62 const content::MediaStreamDevices& GetVideoCaptureDevices(); | 65 const content::MediaStreamDevices& GetVideoCaptureDevices(); |
| 63 | 66 |
| 64 // Method called from WebCapturerDelegate implementations to process access | 67 // Method called from WebCapturerDelegate implementations to process access |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Flag to indicate if device enumeration has been done/doing. | 149 // Flag to indicate if device enumeration has been done/doing. |
| 147 // Only accessed on UI thread. | 150 // Only accessed on UI thread. |
| 148 bool devices_enumerated_; | 151 bool devices_enumerated_; |
| 149 | 152 |
| 150 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; | 153 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; |
| 151 | 154 |
| 152 scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; | 155 scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; |
| 153 }; | 156 }; |
| 154 | 157 |
| 155 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 158 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
| OLD | NEW |