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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 AudioDeviceNames source_devices; | 283 AudioDeviceNames source_devices; |
| 284 AudioManager::Get()->GetAudioInputDeviceNames(&source_devices); | 284 AudioManager::Get()->GetAudioInputDeviceNames(&source_devices); |
| 285 | 285 |
| 286 // Find the raw source ID for source_id_in_origin. | 286 // Find the raw source ID for source_id_in_origin. |
| 287 std::string raw_source_id; | 287 std::string raw_source_id; |
| 288 for (AudioDeviceNames::const_iterator it = source_devices.begin(); | 288 for (AudioDeviceNames::const_iterator it = source_devices.begin(); |
| 289 it != source_devices.end(); | 289 it != source_devices.end(); |
| 290 ++it) { | 290 ++it) { |
| 291 const std::string& id = it->unique_id; | 291 const std::string& id = it->unique_id; |
| 292 if (content::DoesMediaDeviceIDMatchHMAC( | 292 if (content::DoesMediaDeviceIDMatchHMAC( |
| 293 security_origin, source_id_in_origin, id)) { | 293 GetProfile()->GetResourceContext(), |
|
perkj_chrome
2013/11/28 21:42:15
indentation
| |
| 294 security_origin, | |
| 295 source_id_in_origin, | |
| 296 id)) { | |
| 294 raw_source_id = id; | 297 raw_source_id = id; |
| 295 DVLOG(2) << "Found raw ID " << raw_source_id | 298 DVLOG(2) << "Found raw ID " << raw_source_id |
| 296 << " for source ID in origin " << source_id_in_origin; | 299 << " for source ID in origin " << source_id_in_origin; |
| 297 break; | 300 break; |
| 298 } | 301 } |
| 299 } | 302 } |
| 300 | 303 |
| 301 // We return an empty string if there is no associated output device. | 304 // We return an empty string if there is no associated output device. |
| 302 std::string result; | 305 std::string result; |
| 303 if (!raw_source_id.empty()) { | 306 if (!raw_source_id.empty()) { |
| 304 result = AudioManager::Get()->GetAssociatedOutputDeviceID(raw_source_id); | 307 result = AudioManager::Get()->GetAssociatedOutputDeviceID(raw_source_id); |
| 305 } | 308 } |
| 306 | 309 |
| 307 return result; | 310 return result; |
| 308 } | 311 } |
| 309 | 312 |
| 310 void WebrtcAudioPrivateGetAssociatedSinkFunction::DoneOnUIThread( | 313 void WebrtcAudioPrivateGetAssociatedSinkFunction::DoneOnUIThread( |
| 311 const std::string& associated_sink_id) { | 314 const std::string& associated_sink_id) { |
| 312 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 315 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 313 | 316 |
| 314 results_.reset( | 317 results_.reset( |
| 315 wap::GetAssociatedSink::Results::Create(associated_sink_id).release()); | 318 wap::GetAssociatedSink::Results::Create(associated_sink_id).release()); |
| 316 SendResponse(true); | 319 SendResponse(true); |
| 317 } | 320 } |
| 318 | 321 |
| 319 } // namespace extensions | 322 } // namespace extensions |
| OLD | NEW |