| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/webcam_private/webcam_private_api.h" | 5 #include "extensions/browser/api/webcam_private/webcam_private_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/media_device_id.h" | 10 #include "content/public/browser/media_device_id.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool WebcamPrivateAPI::GetDeviceId(const std::string& extension_id, | 115 bool WebcamPrivateAPI::GetDeviceId(const std::string& extension_id, |
| 116 const std::string& webcam_id, | 116 const std::string& webcam_id, |
| 117 std::string* device_id) { | 117 std::string* device_id) { |
| 118 url::Origin security_origin( | 118 url::Origin security_origin( |
| 119 extensions::Extension::GetBaseURLFromExtensionId(extension_id)); | 119 extensions::Extension::GetBaseURLFromExtensionId(extension_id)); |
| 120 | 120 |
| 121 return content::GetMediaDeviceIDForHMAC( | 121 return content::GetMediaDeviceIDForHMAC( |
| 122 content::MEDIA_DEVICE_VIDEO_CAPTURE, | 122 content::MEDIA_DEVICE_VIDEO_CAPTURE, |
| 123 browser_context_->GetResourceContext()->GetMediaDeviceIDSalt(), | 123 browser_context_->GetMediaDeviceIDSalt(), security_origin, webcam_id, |
| 124 security_origin, | |
| 125 webcam_id, | |
| 126 device_id); | 124 device_id); |
| 127 } | 125 } |
| 128 | 126 |
| 129 std::string WebcamPrivateAPI::GetWebcamId(const std::string& extension_id, | 127 std::string WebcamPrivateAPI::GetWebcamId(const std::string& extension_id, |
| 130 const std::string& device_id) { | 128 const std::string& device_id) { |
| 131 url::Origin security_origin( | 129 url::Origin security_origin( |
| 132 extensions::Extension::GetBaseURLFromExtensionId(extension_id)); | 130 extensions::Extension::GetBaseURLFromExtensionId(extension_id)); |
| 133 | 131 |
| 134 return content::GetHMACForMediaDeviceID( | 132 return content::GetHMACForMediaDeviceID( |
| 135 browser_context_->GetResourceContext()->GetMediaDeviceIDSalt(), | 133 browser_context_->GetMediaDeviceIDSalt(), security_origin, device_id); |
| 136 security_origin, device_id); | |
| 137 } | 134 } |
| 138 | 135 |
| 139 WebcamResource* WebcamPrivateAPI::FindWebcamResource( | 136 WebcamResource* WebcamPrivateAPI::FindWebcamResource( |
| 140 const std::string& extension_id, | 137 const std::string& extension_id, |
| 141 const std::string& webcam_id) const { | 138 const std::string& webcam_id) const { |
| 142 DCHECK(webcam_resource_manager_); | 139 DCHECK(webcam_resource_manager_); |
| 143 | 140 |
| 144 base::hash_set<int>* connection_ids = | 141 base::hash_set<int>* connection_ids = |
| 145 webcam_resource_manager_->GetResourceIds(extension_id); | 142 webcam_resource_manager_->GetResourceIds(extension_id); |
| 146 if (!connection_ids) | 143 if (!connection_ids) |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 429 } |
| 433 | 430 |
| 434 template <> | 431 template <> |
| 435 void BrowserContextKeyedAPIFactory<WebcamPrivateAPI> | 432 void BrowserContextKeyedAPIFactory<WebcamPrivateAPI> |
| 436 ::DeclareFactoryDependencies() { | 433 ::DeclareFactoryDependencies() { |
| 437 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 434 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 438 DependsOn(ProcessManagerFactory::GetInstance()); | 435 DependsOn(ProcessManagerFactory::GetInstance()); |
| 439 } | 436 } |
| 440 | 437 |
| 441 } // namespace extensions | 438 } // namespace extensions |
| OLD | NEW |