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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 *permission_set = false; | 62 *permission_set = false; |
63 *new_permission = false; | 63 *new_permission = false; |
64 return true; | 64 return true; |
65 } | 65 } |
66 | 66 |
67 ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); | 67 ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); |
68 if (extension_registry) { | 68 if (extension_registry) { |
69 const extensions::Extension* extension = | 69 const extensions::Extension* extension = |
70 extension_registry->enabled_extensions().GetExtensionOrAppByURL( | 70 extension_registry->enabled_extensions().GetExtensionOrAppByURL( |
71 requesting_frame_origin); | 71 requesting_frame_origin); |
72 if (IsExtensionWithPermissionOrSuggestInConsole( | 72 if (IsExtensionWithPermissionOrSuggestInConsole(APIPermission::kGeolocation, |
73 APIPermission::kGeolocation, extension, | 73 extension, web_contents)) { |
74 web_contents->GetRenderViewHost())) { | |
75 // Make sure the extension is in the calling process. | 74 // Make sure the extension is in the calling process. |
76 if (extensions::ProcessMap::Get(profile_)->Contains( | 75 if (extensions::ProcessMap::Get(profile_)->Contains( |
77 extension->id(), request_id.render_process_id())) { | 76 extension->id(), request_id.render_process_id())) { |
78 *permission_set = true; | 77 *permission_set = true; |
79 *new_permission = true; | 78 *new_permission = true; |
80 return true; | 79 return true; |
81 } | 80 } |
82 } | 81 } |
83 } | 82 } |
84 | 83 |
(...skipping 22 matching lines...) Expand all Loading... |
107 web_contents ? | 106 web_contents ? |
108 extensions::WebViewPermissionHelper::FromWebContents(web_contents) | 107 extensions::WebViewPermissionHelper::FromWebContents(web_contents) |
109 : NULL; | 108 : NULL; |
110 if (web_view_permission_helper) { | 109 if (web_view_permission_helper) { |
111 web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id); | 110 web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id); |
112 return true; | 111 return true; |
113 } | 112 } |
114 #endif // defined(ENABLE_EXTENSIONS) | 113 #endif // defined(ENABLE_EXTENSIONS) |
115 return false; | 114 return false; |
116 } | 115 } |
OLD | NEW |