| 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 "chrome/browser/ui/screen_capture_confirmation_ui.h" | 
| 12 #include "content/public/browser/media_observer.h" | 13 #include "content/public/browser/media_observer.h" | 
|  | 14 #include "content/public/browser/web_contents_delegate.h" | 
| 13 #include "content/public/common/media_stream_request.h" | 15 #include "content/public/common/media_stream_request.h" | 
| 14 | 16 | 
| 15 class AudioStreamIndicator; | 17 class AudioStreamIndicator; | 
| 16 class MediaStreamCaptureIndicator; | 18 class MediaStreamCaptureIndicator; | 
| 17 class PrefRegistrySyncable; | 19 class PrefRegistrySyncable; | 
| 18 class Profile; | 20 class Profile; | 
| 19 | 21 | 
| 20 // This singleton is used to receive updates about media events from the content | 22 // This singleton is used to receive updates about media events from the content | 
| 21 // layer. | 23 // layer. | 
| 22 class MediaCaptureDevicesDispatcher : public content::MediaObserver { | 24 class MediaCaptureDevicesDispatcher : public content::MediaObserver { | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 49   static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 51   static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 
| 50 | 52 | 
| 51   // Methods for observers. Called on UI thread. | 53   // Methods for observers. Called on UI thread. | 
| 52   // Observers should add themselves on construction and remove themselves | 54   // Observers should add themselves on construction and remove themselves | 
| 53   // on destruction. | 55   // on destruction. | 
| 54   void AddObserver(Observer* observer); | 56   void AddObserver(Observer* observer); | 
| 55   void RemoveObserver(Observer* observer); | 57   void RemoveObserver(Observer* observer); | 
| 56   const content::MediaStreamDevices& GetAudioCaptureDevices(); | 58   const content::MediaStreamDevices& GetAudioCaptureDevices(); | 
| 57   const content::MediaStreamDevices& GetVideoCaptureDevices(); | 59   const content::MediaStreamDevices& GetVideoCaptureDevices(); | 
| 58 | 60 | 
|  | 61   void RequestAccess( | 
|  | 62       content::WebContents* web_contents, | 
|  | 63       const content::MediaStreamRequest& request, | 
|  | 64       const content::MediaResponseCallback& callback); | 
|  | 65 | 
| 59   // Helper to get the default devices which can be used by the media request, | 66   // 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 | 67   // if the return list is empty, it means there is no available device on the | 
| 61   // OS. | 68   // OS. | 
| 62   // Called on the UI thread. | 69   // Called on the UI thread. | 
| 63   void GetDefaultDevicesForProfile(Profile* profile, | 70   void GetDefaultDevicesForProfile(Profile* profile, | 
| 64                                    bool audio, | 71                                    bool audio, | 
| 65                                    bool video, | 72                                    bool video, | 
| 66                                    content::MediaStreamDevices* devices); | 73                                    content::MediaStreamDevices* devices); | 
| 67 | 74 | 
| 68   // Helper for picking the device that was requested for an OpenDevice request. | 75   // Helper for picking the device that was requested for an OpenDevice request. | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 110 | 117 | 
| 111   // Called by the MediaObserver() functions, executed on UI thread. | 118   // Called by the MediaObserver() functions, executed on UI thread. | 
| 112   void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices); | 119   void UpdateAudioDevicesOnUIThread(const content::MediaStreamDevices& devices); | 
| 113   void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices); | 120   void UpdateVideoDevicesOnUIThread(const content::MediaStreamDevices& devices); | 
| 114   void UpdateMediaRequestStateOnUIThread( | 121   void UpdateMediaRequestStateOnUIThread( | 
| 115       int render_process_id, | 122       int render_process_id, | 
| 116       int render_view_id, | 123       int render_view_id, | 
| 117       const content::MediaStreamDevice& device, | 124       const content::MediaStreamDevice& device, | 
| 118       content::MediaRequestState state); | 125       content::MediaRequestState state); | 
| 119 | 126 | 
|  | 127   // Callback for ScreenCaptureConfirmationUI. | 
|  | 128   void OnScreenCaptureConfirmationResult( | 
|  | 129       const content::MediaResponseCallback& callback, | 
|  | 130       ScreenCaptureConfirmationUI::Result result); | 
|  | 131 | 
| 120   // A list of cached audio capture devices. | 132   // A list of cached audio capture devices. | 
| 121   content::MediaStreamDevices audio_devices_; | 133   content::MediaStreamDevices audio_devices_; | 
| 122 | 134 | 
| 123   // A list of cached video capture devices. | 135   // A list of cached video capture devices. | 
| 124   content::MediaStreamDevices video_devices_; | 136   content::MediaStreamDevices video_devices_; | 
| 125 | 137 | 
| 126   // A list of observers for the device update notifications. | 138   // A list of observers for the device update notifications. | 
| 127   ObserverList<Observer> observers_; | 139   ObserverList<Observer> observers_; | 
| 128 | 140 | 
| 129   // Flag to indicate if device enumeration has been done/doing. | 141   // Flag to indicate if device enumeration has been done/doing. | 
| 130   // Only accessed on UI thread. | 142   // Only accessed on UI thread. | 
| 131   bool devices_enumerated_; | 143   bool devices_enumerated_; | 
| 132 | 144 | 
| 133   scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; | 145   scoped_refptr<MediaStreamCaptureIndicator> media_stream_capture_indicator_; | 
| 134 | 146 | 
| 135   scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; | 147   scoped_refptr<AudioStreamIndicator> audio_stream_indicator_; | 
|  | 148 | 
|  | 149   scoped_ptr<ScreenCaptureConfirmationUI> screen_capture_confirmation_ui_; | 
| 136 }; | 150 }; | 
| 137 | 151 | 
| 138 #endif  // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 152 #endif  // CHROME_BROWSER_MEDIA_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_ | 
| OLD | NEW | 
|---|