| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 GeolocationPermissionContextExtensions:: | 43 GeolocationPermissionContextExtensions:: |
| 44 ~GeolocationPermissionContextExtensions() { | 44 ~GeolocationPermissionContextExtensions() { |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool GeolocationPermissionContextExtensions::DecidePermission( | 47 bool GeolocationPermissionContextExtensions::DecidePermission( |
| 48 content::WebContents* web_contents, | 48 content::WebContents* web_contents, |
| 49 const PermissionRequestID& request_id, | 49 const PermissionRequestID& request_id, |
| 50 int bridge_id, | 50 int bridge_id, |
| 51 const GURL& requesting_frame, | 51 const GURL& requesting_frame, |
| 52 bool user_gesture, |
| 52 const base::Callback<void(ContentSetting)>& callback, | 53 const base::Callback<void(ContentSetting)>& callback, |
| 53 bool* permission_set, | 54 bool* permission_set, |
| 54 bool* new_permission) { | 55 bool* new_permission) { |
| 55 #if defined(ENABLE_EXTENSIONS) | 56 #if defined(ENABLE_EXTENSIONS) |
| 56 GURL requesting_frame_origin = requesting_frame.GetOrigin(); | 57 GURL requesting_frame_origin = requesting_frame.GetOrigin(); |
| 57 | 58 |
| 58 extensions::WebViewPermissionHelper* web_view_permission_helper = | 59 extensions::WebViewPermissionHelper* web_view_permission_helper = |
| 59 extensions::WebViewPermissionHelper::FromWebContents(web_contents); | 60 extensions::WebViewPermissionHelper::FromWebContents(web_contents); |
| 60 if (web_view_permission_helper) { | 61 if (web_view_permission_helper) { |
| 61 web_view_permission_helper->RequestGeolocationPermission( | 62 web_view_permission_helper->RequestGeolocationPermission( |
| 62 bridge_id, requesting_frame, | 63 bridge_id, requesting_frame, user_gesture, |
| 63 base::Bind(&CallbackContentSettingWrapper, callback)); | 64 base::Bind(&CallbackContentSettingWrapper, callback)); |
| 64 *permission_set = false; | 65 *permission_set = false; |
| 65 *new_permission = false; | 66 *new_permission = false; |
| 66 return true; | 67 return true; |
| 67 } | 68 } |
| 68 | 69 |
| 69 ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); | 70 ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); |
| 70 if (extension_registry) { | 71 if (extension_registry) { |
| 71 const extensions::Extension* extension = | 72 const extensions::Extension* extension = |
| 72 extension_registry->enabled_extensions().GetExtensionOrAppByURL( | 73 extension_registry->enabled_extensions().GetExtensionOrAppByURL( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 web_contents ? | 110 web_contents ? |
| 110 extensions::WebViewPermissionHelper::FromWebContents(web_contents) | 111 extensions::WebViewPermissionHelper::FromWebContents(web_contents) |
| 111 : NULL; | 112 : NULL; |
| 112 if (web_view_permission_helper) { | 113 if (web_view_permission_helper) { |
| 113 web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id); | 114 web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id); |
| 114 return true; | 115 return true; |
| 115 } | 116 } |
| 116 #endif // defined(ENABLE_EXTENSIONS) | 117 #endif // defined(ENABLE_EXTENSIONS) |
| 117 return false; | 118 return false; |
| 118 } | 119 } |
| OLD | NEW |