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