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 "chrome/browser/geolocation/geolocation_permission_context_extensions.h
" | 5 #include "chrome/browser/geolocation/geolocation_permission_context_extensions.h
" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 | 8 |
9 #if defined(ENABLE_EXTENSIONS) | 9 #if defined(ENABLE_EXTENSIONS) |
10 #include "chrome/browser/permissions/permission_request_id.h" | 10 #include "chrome/browser/permissions/permission_request_id.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "extensions/browser/extension_registry.h" | 12 #include "extensions/browser/extension_registry.h" |
13 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 13 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
14 #include "extensions/browser/process_map.h" | 14 #include "extensions/browser/process_map.h" |
15 #include "extensions/browser/suggest_permission_util.h" | 15 #include "extensions/browser/suggest_permission_util.h" |
16 #include "extensions/browser/view_type_utils.h" | 16 #include "extensions/browser/view_type_utils.h" |
17 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
18 | 18 |
19 using extensions::APIPermission; | 19 using extensions::APIPermission; |
20 using extensions::ExtensionRegistry; | 20 using extensions::ExtensionRegistry; |
21 #endif | 21 #endif |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 #if ENABLE_EXTENSIONS | 25 #if defined(ENABLE_EXTENSIONS) |
26 void CallbackContentSettingWrapper( | 26 void CallbackContentSettingWrapper( |
27 const base::Callback<void(ContentSetting)>& callback, | 27 const base::Callback<void(ContentSetting)>& callback, |
28 bool allowed) { | 28 bool allowed) { |
29 callback.Run(allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); | 29 callback.Run(allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
30 } | 30 } |
31 #endif // ENABLE_EXTENSIONS | 31 #endif // defined(ENABLE_EXTENSIONS) |
32 | 32 |
33 } // anonymous namespace | 33 } // anonymous namespace |
34 | 34 |
35 GeolocationPermissionContextExtensions:: | 35 GeolocationPermissionContextExtensions::GeolocationPermissionContextExtensions( |
36 GeolocationPermissionContextExtensions(Profile* profile) | 36 Profile* profile) |
37 : profile_(profile) { | 37 #if defined(ENABLE_EXTENSIONS) |
| 38 : profile_(profile) |
| 39 #endif |
| 40 { |
38 } | 41 } |
39 | 42 |
40 GeolocationPermissionContextExtensions:: | 43 GeolocationPermissionContextExtensions:: |
41 ~GeolocationPermissionContextExtensions() { | 44 ~GeolocationPermissionContextExtensions() { |
42 } | 45 } |
43 | 46 |
44 bool GeolocationPermissionContextExtensions::DecidePermission( | 47 bool GeolocationPermissionContextExtensions::DecidePermission( |
45 content::WebContents* web_contents, | 48 content::WebContents* web_contents, |
46 const PermissionRequestID& request_id, | 49 const PermissionRequestID& request_id, |
47 int bridge_id, | 50 int bridge_id, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 web_contents ? | 109 web_contents ? |
107 extensions::WebViewPermissionHelper::FromWebContents(web_contents) | 110 extensions::WebViewPermissionHelper::FromWebContents(web_contents) |
108 : NULL; | 111 : NULL; |
109 if (web_view_permission_helper) { | 112 if (web_view_permission_helper) { |
110 web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id); | 113 web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id); |
111 return true; | 114 return true; |
112 } | 115 } |
113 #endif // defined(ENABLE_EXTENSIONS) | 116 #endif // defined(ENABLE_EXTENSIONS) |
114 return false; | 117 return false; |
115 } | 118 } |
OLD | NEW |