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/content_settings/permission_request_id.h" | 10 #include "chrome/browser/content_settings/permission_request_id.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 const PermissionRequestID& request_id, | 34 const PermissionRequestID& request_id, |
35 int bridge_id, | 35 int bridge_id, |
36 const GURL& requesting_frame, | 36 const GURL& requesting_frame, |
37 bool user_gesture, | 37 bool user_gesture, |
38 base::Callback<void(bool)> callback, | 38 base::Callback<void(bool)> callback, |
39 bool* permission_set, | 39 bool* permission_set, |
40 bool* new_permission) { | 40 bool* new_permission) { |
41 #if defined(ENABLE_EXTENSIONS) | 41 #if defined(ENABLE_EXTENSIONS) |
42 GURL requesting_frame_origin = requesting_frame.GetOrigin(); | 42 GURL requesting_frame_origin = requesting_frame.GetOrigin(); |
43 | 43 |
44 WebViewPermissionHelper* web_view_permission_helper = | 44 extensions::WebViewPermissionHelper* web_view_permission_helper = |
45 WebViewPermissionHelper::FromWebContents(web_contents); | 45 extensions::WebViewPermissionHelper::FromWebContents(web_contents); |
46 if (web_view_permission_helper) { | 46 if (web_view_permission_helper) { |
47 web_view_permission_helper->RequestGeolocationPermission( | 47 web_view_permission_helper->RequestGeolocationPermission( |
48 bridge_id, requesting_frame, user_gesture, callback); | 48 bridge_id, requesting_frame, user_gesture, callback); |
49 *permission_set = false; | 49 *permission_set = false; |
50 *new_permission = false; | 50 *new_permission = false; |
51 return true; | 51 return true; |
52 } | 52 } |
53 | 53 |
54 ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); | 54 ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); |
55 if (extension_registry) { | 55 if (extension_registry) { |
(...skipping 27 matching lines...) Expand all Loading... |
83 return true; | 83 return true; |
84 } | 84 } |
85 #endif // defined(ENABLE_EXTENSIONS) | 85 #endif // defined(ENABLE_EXTENSIONS) |
86 return false; | 86 return false; |
87 } | 87 } |
88 | 88 |
89 bool GeolocationPermissionContextExtensions::CancelPermissionRequest( | 89 bool GeolocationPermissionContextExtensions::CancelPermissionRequest( |
90 content::WebContents* web_contents, | 90 content::WebContents* web_contents, |
91 int bridge_id) { | 91 int bridge_id) { |
92 #if defined(ENABLE_EXTENSIONS) | 92 #if defined(ENABLE_EXTENSIONS) |
93 WebViewPermissionHelper* web_view_permission_helper = | 93 extensions::WebViewPermissionHelper* web_view_permission_helper = |
94 web_contents ? WebViewPermissionHelper::FromWebContents(web_contents) | 94 web_contents ? |
95 : NULL; | 95 extensions::WebViewPermissionHelper::FromWebContents(web_contents) |
| 96 : NULL; |
96 if (web_view_permission_helper) { | 97 if (web_view_permission_helper) { |
97 web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id); | 98 web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id); |
98 return true; | 99 return true; |
99 } | 100 } |
100 #endif // defined(ENABLE_EXTENSIONS) | 101 #endif // defined(ENABLE_EXTENSIONS) |
101 return false; | 102 return false; |
102 } | 103 } |
OLD | NEW |