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/chrome_geolocation_permission_context_exten
sions.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" |
11 #include "chrome/browser/extensions/suggest_permission_util.h" | 11 #include "chrome/browser/extensions/suggest_permission_util.h" |
12 #include "chrome/browser/guest_view/web_view/web_view_guest.h" | 12 #include "chrome/browser/guest_view/web_view/web_view_guest.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "extensions/browser/extension_registry.h" | 14 #include "extensions/browser/extension_registry.h" |
15 #include "extensions/browser/process_map.h" | 15 #include "extensions/browser/process_map.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 ChromeGeolocationPermissionContextExtensions:: | 23 GeolocationPermissionContextExtensions:: |
24 ChromeGeolocationPermissionContextExtensions(Profile* profile) | 24 GeolocationPermissionContextExtensions(Profile* profile) |
25 : profile_(profile) { | 25 : profile_(profile) { |
26 } | 26 } |
27 | 27 |
28 ChromeGeolocationPermissionContextExtensions:: | 28 GeolocationPermissionContextExtensions:: |
29 ~ChromeGeolocationPermissionContextExtensions() { | 29 ~GeolocationPermissionContextExtensions() { |
30 } | 30 } |
31 | 31 |
32 bool ChromeGeolocationPermissionContextExtensions::RequestPermission( | 32 bool GeolocationPermissionContextExtensions::RequestPermission( |
33 content::WebContents* web_contents, | 33 content::WebContents* web_contents, |
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(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 << request_id.ToString() | 80 << request_id.ToString() |
81 << " (can't prompt user without a visible tab)"; | 81 << " (can't prompt user without a visible tab)"; |
82 *permission_set = true; | 82 *permission_set = true; |
83 *new_permission = false; | 83 *new_permission = false; |
84 return true; | 84 return true; |
85 } | 85 } |
86 #endif // defined(ENABLE_EXTENSIONS) | 86 #endif // defined(ENABLE_EXTENSIONS) |
87 return false; | 87 return false; |
88 } | 88 } |
89 | 89 |
90 bool ChromeGeolocationPermissionContextExtensions::CancelPermissionRequest( | 90 bool GeolocationPermissionContextExtensions::CancelPermissionRequest( |
91 content::WebContents* web_contents, | 91 content::WebContents* web_contents, |
92 int bridge_id) { | 92 int bridge_id) { |
93 #if defined(ENABLE_EXTENSIONS) | 93 #if defined(ENABLE_EXTENSIONS) |
94 WebViewGuest* guest = | 94 WebViewGuest* guest = |
95 web_contents ? WebViewGuest::FromWebContents(web_contents) : NULL; | 95 web_contents ? WebViewGuest::FromWebContents(web_contents) : NULL; |
96 if (guest) { | 96 if (guest) { |
97 guest->CancelGeolocationPermissionRequest(bridge_id); | 97 guest->CancelGeolocationPermissionRequest(bridge_id); |
98 return true; | 98 return true; |
99 } | 99 } |
100 #endif // defined(ENABLE_EXTENSIONS) | 100 #endif // defined(ENABLE_EXTENSIONS) |
101 return false; | 101 return false; |
102 } | 102 } |
OLD | NEW |