| 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) |
| 245 return prefs->GetString(prefs::kDefaultVideoCaptureDevice); |
| 246 else |
| 247 return std::string(); |
| 248 } |
| 249 |
| 237 const content::MediaStreamDevice* | 250 const content::MediaStreamDevice* |
| 238 MediaCaptureDevicesDispatcher::GetRequestedAudioDevice( | 251 MediaCaptureDevicesDispatcher::GetRequestedAudioDevice( |
| 239 const std::string& requested_audio_device_id) { | 252 const std::string& requested_audio_device_id) { |
| 240 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 253 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 241 const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices(); | 254 const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices(); |
| 242 const content::MediaStreamDevice* const device = | 255 const content::MediaStreamDevice* const device = |
| 243 FindDeviceWithId(audio_devices, requested_audio_device_id); | 256 FindDeviceWithId(audio_devices, requested_audio_device_id); |
| 244 return device; | 257 return device; |
| 245 } | 258 } |
| 246 | 259 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 #if BUILDFLAG(ENABLE_EXTENSIONS) | 459 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 447 for (MediaAccessHandler* handler : media_access_handlers_) { | 460 for (MediaAccessHandler* handler : media_access_handlers_) { |
| 448 if (handler->SupportsStreamType(stream_type, nullptr)) { | 461 if (handler->SupportsStreamType(stream_type, nullptr)) { |
| 449 ToCaptureAccessHandlerBase(handler)->UpdateCapturingLinkSecured( | 462 ToCaptureAccessHandlerBase(handler)->UpdateCapturingLinkSecured( |
| 450 render_process_id, render_frame_id, page_request_id, is_secure); | 463 render_process_id, render_frame_id, page_request_id, is_secure); |
| 451 break; | 464 break; |
| 452 } | 465 } |
| 453 } | 466 } |
| 454 #endif | 467 #endif |
| 455 } | 468 } |
| OLD | NEW |