Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/api/webrtc_audio_private/webrtc_audio_privat e_api.h" | 5 #include "chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_privat e_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 AudioDeviceNames source_devices; | 277 AudioDeviceNames source_devices; |
| 278 AudioManager::Get()->GetAudioInputDeviceNames(&source_devices); | 278 AudioManager::Get()->GetAudioInputDeviceNames(&source_devices); |
| 279 | 279 |
| 280 // Find the raw source ID for source_id_in_origin. | 280 // Find the raw source ID for source_id_in_origin. |
| 281 std::string raw_source_id; | 281 std::string raw_source_id; |
| 282 for (AudioDeviceNames::const_iterator it = source_devices.begin(); | 282 for (AudioDeviceNames::const_iterator it = source_devices.begin(); |
| 283 it != source_devices.end(); | 283 it != source_devices.end(); |
| 284 ++it) { | 284 ++it) { |
| 285 const std::string& id = it->unique_id; | 285 const std::string& id = it->unique_id; |
| 286 if (content::DoesMediaDeviceIDMatchHMAC( | 286 if (content::DoesMediaDeviceIDMatchHMAC( |
| 287 security_origin, source_id_in_origin, id)) { | 287 GetProfile()->GetResourceContext(), security_origin, |
|
Jói
2013/10/31 17:19:35
One param per line since they don't fit all on one
perkj_chrome
2013/11/01 13:39:34
Done.
| |
| 288 source_id_in_origin, id)) { | |
| 288 raw_source_id = id; | 289 raw_source_id = id; |
| 289 DVLOG(2) << "Found raw ID " << raw_source_id | 290 DVLOG(2) << "Found raw ID " << raw_source_id |
| 290 << " for source ID in origin " << source_id_in_origin; | 291 << " for source ID in origin " << source_id_in_origin; |
| 291 break; | 292 break; |
| 292 } | 293 } |
| 293 } | 294 } |
| 294 | 295 |
| 295 // We return an empty string if there is no associated output device. | 296 // We return an empty string if there is no associated output device. |
| 296 std::string result; | 297 std::string result; |
| 297 if (!raw_source_id.empty()) { | 298 if (!raw_source_id.empty()) { |
| 298 result = AudioManager::Get()->GetAssociatedOutputDeviceID(raw_source_id); | 299 result = AudioManager::Get()->GetAssociatedOutputDeviceID(raw_source_id); |
| 299 } | 300 } |
| 300 | 301 |
| 301 return result; | 302 return result; |
| 302 } | 303 } |
| 303 | 304 |
| 304 void WebrtcAudioPrivateGetAssociatedSinkFunction::DoneOnUIThread( | 305 void WebrtcAudioPrivateGetAssociatedSinkFunction::DoneOnUIThread( |
| 305 const std::string& associated_sink_id) { | 306 const std::string& associated_sink_id) { |
| 306 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 307 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 307 | 308 |
| 308 SetResult(wap::GetAssociatedSink::Results::Create( | 309 SetResult(wap::GetAssociatedSink::Results::Create( |
| 309 associated_sink_id).release()); | 310 associated_sink_id).release()); |
| 310 SendResponse(true); | 311 SendResponse(true); |
| 311 } | 312 } |
| 312 | 313 |
| 313 } // namespace extensions | 314 } // namespace extensions |
| OLD | NEW |