| 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/ui/media_utils.h" | 5 #include "chrome/browser/ui/media_utils.h" |
| 6 | 6 |
| 7 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 7 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 | 10 |
| 11 #if defined(ENABLE_EXTENSIONS) | 11 #if defined(ENABLE_EXTENSIONS) |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "extensions/browser/extension_registry.h" |
| 13 #include "extensions/browser/extension_system.h" | |
| 14 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
| 15 #endif | 14 #endif |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 #if defined(ENABLE_EXTENSIONS) | 18 #if defined(ENABLE_EXTENSIONS) |
| 20 const extensions::Extension* GetExtensionForOrigin(Profile* profile, | 19 const extensions::Extension* GetExtensionForOrigin(Profile* profile, |
| 21 const GURL& security_origin) { | 20 const GURL& security_origin) { |
| 22 if (!security_origin.SchemeIs(extensions::kExtensionScheme)) | 21 if (!security_origin.SchemeIs(extensions::kExtensionScheme)) |
| 23 return NULL; | 22 return NULL; |
| 24 | 23 |
| 25 ExtensionService* extensions_service = | |
| 26 extensions::ExtensionSystem::Get(profile)->extension_service(); | |
| 27 const extensions::Extension* extension = | 24 const extensions::Extension* extension = |
| 28 extensions_service->extensions()->GetByID(security_origin.host()); | 25 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( |
| 26 security_origin.host(), extensions::ExtensionRegistry::ENABLED); |
| 29 DCHECK(extension); | 27 DCHECK(extension); |
| 30 return extension; | 28 return extension; |
| 31 } | 29 } |
| 32 #endif | 30 #endif |
| 33 | 31 |
| 34 } // namespace | 32 } // namespace |
| 35 | 33 |
| 36 void RequestMediaAccessPermission( | 34 void RequestMediaAccessPermission( |
| 37 content::WebContents* web_contents, | 35 content::WebContents* web_contents, |
| 38 Profile* profile, | 36 Profile* profile, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 59 ->CheckMediaAccessPermission( | 57 ->CheckMediaAccessPermission( |
| 60 web_contents, security_origin, type, extension); | 58 web_contents, security_origin, type, extension); |
| 61 } | 59 } |
| 62 return MediaCaptureDevicesDispatcher::GetInstance() | 60 return MediaCaptureDevicesDispatcher::GetInstance() |
| 63 ->CheckMediaAccessPermission(web_contents, security_origin, type); | 61 ->CheckMediaAccessPermission(web_contents, security_origin, type); |
| 64 #else | 62 #else |
| 65 return MediaCaptureDevicesDispatcher::GetInstance() | 63 return MediaCaptureDevicesDispatcher::GetInstance() |
| 66 ->CheckMediaAccessPermission(web_contents, security_origin, type); | 64 ->CheckMediaAccessPermission(web_contents, security_origin, type); |
| 67 #endif | 65 #endif |
| 68 } | 66 } |
| OLD | NEW |