Chromium Code Reviews| 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/webrtc/media_capture_devices_dispatcher.h" | 5 #include "chrome/browser/media/webrtc/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/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 default_device = prefs->GetString(prefs::kDefaultVideoCaptureDevice); | 227 default_device = prefs->GetString(prefs::kDefaultVideoCaptureDevice); |
| 228 const content::MediaStreamDevice* device = | 228 const content::MediaStreamDevice* device = |
| 229 GetRequestedVideoDevice(default_device); | 229 GetRequestedVideoDevice(default_device); |
| 230 if (!device) | 230 if (!device) |
| 231 device = GetFirstAvailableVideoDevice(); | 231 device = GetFirstAvailableVideoDevice(); |
| 232 if (device) | 232 if (device) |
| 233 devices->push_back(*device); | 233 devices->push_back(*device); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 std::string MediaCaptureDevicesDispatcher::GetDefaultDeviceIdForProfile( | |
| 238 Profile* profile, | |
| 239 content::MediaStreamType type) { | |
| 240 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 241 PrefService* prefs = profile->GetPrefs(); | |
| 242 if (type == content::MEDIA_DEVICE_AUDIO_CAPTURE) | |
| 243 return prefs->GetString(prefs::kDefaultAudioCaptureDevice); | |
| 244 else if (type == content::MEDIA_DEVICE_VIDEO_CAPTURE) | |
|
Peter Kasting
2017/01/17 21:02:46
Drive-by nit: No else after return
Guido Urdaneta
2017/01/18 15:03:59
Done.
| |
| 245 return prefs->GetString(prefs::kDefaultVideoCaptureDevice); | |
| 246 return std::string(); | |
| 247 } | |
| 248 | |
| 237 const content::MediaStreamDevice* | 249 const content::MediaStreamDevice* |
| 238 MediaCaptureDevicesDispatcher::GetRequestedAudioDevice( | 250 MediaCaptureDevicesDispatcher::GetRequestedAudioDevice( |
| 239 const std::string& requested_audio_device_id) { | 251 const std::string& requested_audio_device_id) { |
| 240 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 252 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 241 const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices(); | 253 const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices(); |
| 242 const content::MediaStreamDevice* const device = | 254 const content::MediaStreamDevice* const device = |
| 243 FindDeviceWithId(audio_devices, requested_audio_device_id); | 255 FindDeviceWithId(audio_devices, requested_audio_device_id); |
| 244 return device; | 256 return device; |
| 245 } | 257 } |
| 246 | 258 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 #if BUILDFLAG(ENABLE_EXTENSIONS) | 458 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 447 for (MediaAccessHandler* handler : media_access_handlers_) { | 459 for (MediaAccessHandler* handler : media_access_handlers_) { |
| 448 if (handler->SupportsStreamType(stream_type, nullptr)) { | 460 if (handler->SupportsStreamType(stream_type, nullptr)) { |
| 449 ToCaptureAccessHandlerBase(handler)->UpdateCapturingLinkSecured( | 461 ToCaptureAccessHandlerBase(handler)->UpdateCapturingLinkSecured( |
| 450 render_process_id, render_frame_id, page_request_id, is_secure); | 462 render_process_id, render_frame_id, page_request_id, is_secure); |
| 451 break; | 463 break; |
| 452 } | 464 } |
| 453 } | 465 } |
| 454 #endif | 466 #endif |
| 455 } | 467 } |
| OLD | NEW |