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/extensions/extension_service.h" | |
8 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 7 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 |
| 10 #if defined(ENABLE_EXTENSIONS) |
| 11 #include "chrome/browser/extensions/extension_service.h" |
10 #include "extensions/browser/extension_system.h" | 12 #include "extensions/browser/extension_system.h" |
11 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
| 14 #endif |
12 | 15 |
13 class Profile; | 16 class Profile; |
14 | 17 |
15 namespace content { | 18 namespace content { |
16 class WebContents; | 19 class WebContents; |
17 } | 20 } |
18 | 21 |
19 void RequestMediaAccessPermission( | 22 void RequestMediaAccessPermission( |
20 content::WebContents* web_contents, | 23 content::WebContents* web_contents, |
21 Profile* profile, | 24 Profile* profile, |
22 const content::MediaStreamRequest& request, | 25 const content::MediaStreamRequest& request, |
23 const content::MediaResponseCallback& callback) { | 26 const content::MediaResponseCallback& callback) { |
24 const extensions::Extension* extension = NULL; | 27 const extensions::Extension* extension = NULL; |
| 28 #if defined(ENABLE_EXTENSIONS) |
25 GURL origin(request.security_origin); | 29 GURL origin(request.security_origin); |
26 if (origin.SchemeIs(extensions::kExtensionScheme)) { | 30 if (origin.SchemeIs(extensions::kExtensionScheme)) { |
27 ExtensionService* extensions_service = | 31 ExtensionService* extensions_service = |
28 extensions::ExtensionSystem::Get(profile)->extension_service(); | 32 extensions::ExtensionSystem::Get(profile)->extension_service(); |
29 extension = extensions_service->extensions()->GetByID(origin.host()); | 33 extension = extensions_service->extensions()->GetByID(origin.host()); |
30 DCHECK(extension); | 34 DCHECK(extension); |
31 } | 35 } |
| 36 #endif |
32 | 37 |
33 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( | 38 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( |
34 web_contents, request, callback, extension); | 39 web_contents, request, callback, extension); |
35 } | 40 } |
OLD | NEW |