| 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 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 5 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 void MediaCaptureDevicesDispatcher::RemoveObserver(Observer* observer) { | 131 void MediaCaptureDevicesDispatcher::RemoveObserver(Observer* observer) { |
| 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 133 observers_.RemoveObserver(observer); | 133 observers_.RemoveObserver(observer); |
| 134 } | 134 } |
| 135 | 135 |
| 136 const MediaStreamDevices& | 136 const MediaStreamDevices& |
| 137 MediaCaptureDevicesDispatcher::GetAudioCaptureDevices() { | 137 MediaCaptureDevicesDispatcher::GetAudioCaptureDevices() { |
| 138 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 138 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 139 if (!is_device_enumeration_disabled_ && !devices_enumerated_) { | 139 if (!is_device_enumeration_disabled_ && !devices_enumerated_) { |
| 140 BrowserThread::PostTask( | 140 content::EnsureMonitorCaptureDevices(); |
| 141 BrowserThread::IO, FROM_HERE, | |
| 142 base::Bind(&content::EnsureMonitorCaptureDevices)); | |
| 143 devices_enumerated_ = true; | 141 devices_enumerated_ = true; |
| 144 } | 142 } |
| 145 return audio_devices_; | 143 return audio_devices_; |
| 146 } | 144 } |
| 147 | 145 |
| 148 const MediaStreamDevices& | 146 const MediaStreamDevices& |
| 149 MediaCaptureDevicesDispatcher::GetVideoCaptureDevices() { | 147 MediaCaptureDevicesDispatcher::GetVideoCaptureDevices() { |
| 150 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 151 if (!is_device_enumeration_disabled_ && !devices_enumerated_) { | 149 if (!is_device_enumeration_disabled_ && !devices_enumerated_) { |
| 152 BrowserThread::PostTask( | 150 content::EnsureMonitorCaptureDevices(); |
| 153 BrowserThread::IO, FROM_HERE, | |
| 154 base::Bind(&content::EnsureMonitorCaptureDevices)); | |
| 155 devices_enumerated_ = true; | 151 devices_enumerated_ = true; |
| 156 } | 152 } |
| 157 return video_devices_; | 153 return video_devices_; |
| 158 } | 154 } |
| 159 | 155 |
| 160 void MediaCaptureDevicesDispatcher::Observe( | 156 void MediaCaptureDevicesDispatcher::Observe( |
| 161 int type, | 157 int type, |
| 162 const content::NotificationSource& source, | 158 const content::NotificationSource& source, |
| 163 const content::NotificationDetails& details) { | 159 const content::NotificationDetails& details) { |
| 164 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 int render_process_id, | 472 int render_process_id, |
| 477 int render_view_id, | 473 int render_view_id, |
| 478 const content::MediaStreamDevice& device, | 474 const content::MediaStreamDevice& device, |
| 479 content::MediaRequestState state) { | 475 content::MediaRequestState state) { |
| 480 FOR_EACH_OBSERVER(Observer, observers_, | 476 FOR_EACH_OBSERVER(Observer, observers_, |
| 481 OnRequestUpdate(render_process_id, | 477 OnRequestUpdate(render_process_id, |
| 482 render_view_id, | 478 render_view_id, |
| 483 device, | 479 device, |
| 484 state)); | 480 state)); |
| 485 } | 481 } |
| OLD | NEW |