| 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/common/media_stream_request.h" | 14 #include "content/public/common/media_stream_request.h" |
| 14 | 15 |
| 15 class AudioStreamIndicator; | 16 class AudioStreamIndicator; |
| 16 class MediaStreamCaptureIndicator; | 17 class MediaStreamCaptureIndicator; |
| 17 class PrefRegistrySyncable; | 18 class PrefRegistrySyncable; |
| 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 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 49 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 50 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
| 50 | 51 |
| 51 // Methods for observers. Called on UI thread. | 52 // Methods for observers. Called on UI thread. |
| 52 // Observers should add themselves on construction and remove themselves | 53 // Observers should add themselves on construction and remove themselves |
| 53 // on destruction. | 54 // on destruction. |
| 54 void AddObserver(Observer* observer); | 55 void AddObserver(Observer* observer); |
| 55 void RemoveObserver(Observer* observer); | 56 void RemoveObserver(Observer* observer); |
| 56 const content::MediaStreamDevices& GetAudioCaptureDevices(); | 57 const content::MediaStreamDevices& GetAudioCaptureDevices(); |
| 57 const content::MediaStreamDevices& GetVideoCaptureDevices(); | 58 const content::MediaStreamDevices& GetVideoCaptureDevices(); |
| 58 | 59 |
| 60 void RequestAccess( |
| 61 content::WebContents* web_contents, |
| 62 const content::MediaStreamRequest& request, |
| 63 const content::MediaResponseCallback& callback); |
| 64 |
| 59 // Helper to get the default devices which can be used by the media request, | 65 // Helper to get the default devices which can be used by the media request, |
| 60 // if the return list is empty, it means there is no available device on the | 66 // if the return list is empty, it means there is no available device on the |
| 61 // OS. | 67 // OS. |
| 62 // Called on the UI thread. | 68 // Called on the UI thread. |
| 63 void GetDefaultDevicesForProfile(Profile* profile, | 69 void GetDefaultDevicesForProfile(Profile* profile, |
| 64 bool audio, | 70 bool audio, |
| 65 bool video, | 71 bool video, |
| 66 content::MediaStreamDevices* devices); | 72 content::MediaStreamDevices* devices); |
| 67 | 73 |
| 68 // Helper for picking the device that was requested for an OpenDevice request. | 74 // Helper for picking the device that was requested for an OpenDevice request. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // Flag to indicate if device enumeration has been done/doing. | 136 // Flag to indicate if device enumeration has been done/doing. |
| 131 // Only accessed on UI thread. | 137 // Only accessed on UI thread. |
| 132 bool devices_enumerated_; | 138 bool devices_enumerated_; |
| 133 | 139 |
| 134 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; | 140 scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; |
| 135 | 141 |
| 136 scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; | 142 scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; |
| 137 }; | 143 }; |
| 138 | 144 |
| 139 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 145 #endif // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ |
| OLD | NEW |