| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | |
| 9 | 8 |
| 10 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 11 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/task_runner_util.h" | 12 #include "base/task_runner_util.h" |
| 14 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 13 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| 15 #include "chrome/browser/extensions/extension_tab_util.h" | 14 #include "chrome/browser/extensions/extension_tab_util.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 17 #include "content/public/browser/media_device_id.h" | 16 #include "content/public/browser/media_device_id.h" |
| 18 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 202 |
| 204 url::Origin security_origin(source_url().GetOrigin()); | 203 url::Origin security_origin(source_url().GetOrigin()); |
| 205 return content::GetHMACForMediaDeviceID(device_id_salt(), security_origin, | 204 return content::GetHMACForMediaDeviceID(device_id_salt(), security_origin, |
| 206 raw_id); | 205 raw_id); |
| 207 } | 206 } |
| 208 | 207 |
| 209 void WebrtcAudioPrivateFunction::InitDeviceIDSalt() { | 208 void WebrtcAudioPrivateFunction::InitDeviceIDSalt() { |
| 210 device_id_salt_ = GetProfile()->GetResourceContext()->GetMediaDeviceIDSalt(); | 209 device_id_salt_ = GetProfile()->GetResourceContext()->GetMediaDeviceIDSalt(); |
| 211 } | 210 } |
| 212 | 211 |
| 213 std::string WebrtcAudioPrivateFunction::device_id_salt() const { | 212 const content::ResourceContext::SaltCallback& |
| 213 WebrtcAudioPrivateFunction::device_id_salt() const { |
| 214 DCHECK(!device_id_salt_.is_null()); |
| 214 return device_id_salt_; | 215 return device_id_salt_; |
| 215 } | 216 } |
| 216 | 217 |
| 217 bool WebrtcAudioPrivateGetSinksFunction::RunAsync() { | 218 bool WebrtcAudioPrivateGetSinksFunction::RunAsync() { |
| 218 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 219 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 219 | 220 |
| 220 InitDeviceIDSalt(); | 221 InitDeviceIDSalt(); |
| 221 GetOutputDeviceNames(); | 222 GetOutputDeviceNames(); |
| 222 | 223 |
| 223 return true; | 224 return true; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 results_.reset(wap::GetAssociatedSink::Results::Create("").release()); | 498 results_.reset(wap::GetAssociatedSink::Results::Create("").release()); |
| 498 } else { | 499 } else { |
| 499 results_.reset( | 500 results_.reset( |
| 500 wap::GetAssociatedSink::Results::Create(associated_sink_id).release()); | 501 wap::GetAssociatedSink::Results::Create(associated_sink_id).release()); |
| 501 } | 502 } |
| 502 | 503 |
| 503 SendResponse(true); | 504 SendResponse(true); |
| 504 } | 505 } |
| 505 | 506 |
| 506 } // namespace extensions | 507 } // namespace extensions |
| OLD | NEW |