| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 requesting_frame_origin, callback)); | 55 requesting_frame_origin, callback)); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| 59 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 59 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 60 if (shutting_down_) | 60 if (shutting_down_) |
| 61 return; | 61 return; |
| 62 | 62 |
| 63 content::WebContents* web_contents = | 63 content::WebContents* web_contents = |
| 64 tab_util::GetWebContentsByID(render_process_id, render_view_id); | 64 tab_util::GetWebContentsByID(render_process_id, render_view_id); |
| 65 const PermissionRequestID id(render_process_id, render_view_id, | 65 const PermissionRequestID id(render_process_id, render_view_id, bridge_id, 0); |
| 66 bridge_id); | |
| 67 ExtensionService* extension_service = | 66 ExtensionService* extension_service = |
| 68 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 67 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 69 if (extension_service) { | 68 if (extension_service) { |
| 70 const extensions::Extension* extension = | 69 const extensions::Extension* extension = |
| 71 extension_service->extensions()->GetExtensionOrAppByURL( | 70 extension_service->extensions()->GetExtensionOrAppByURL( |
| 72 requesting_frame_origin); | 71 requesting_frame_origin); |
| 73 if (IsExtensionWithPermissionOrSuggestInConsole(APIPermission::kGeolocation, | 72 if (IsExtensionWithPermissionOrSuggestInConsole(APIPermission::kGeolocation, |
| 74 extension, | 73 extension, |
| 75 profile_)) { | 74 profile_)) { |
| 76 // Make sure the extension is in the calling process. | 75 // Make sure the extension is in the calling process. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 105 } | 104 } |
| 106 | 105 |
| 107 DecidePermission(id, requesting_frame_origin, embedder, callback); | 106 DecidePermission(id, requesting_frame_origin, embedder, callback); |
| 108 } | 107 } |
| 109 | 108 |
| 110 void ChromeGeolocationPermissionContext::CancelGeolocationPermissionRequest( | 109 void ChromeGeolocationPermissionContext::CancelGeolocationPermissionRequest( |
| 111 int render_process_id, | 110 int render_process_id, |
| 112 int render_view_id, | 111 int render_view_id, |
| 113 int bridge_id, | 112 int bridge_id, |
| 114 const GURL& requesting_frame) { | 113 const GURL& requesting_frame) { |
| 115 CancelPendingInfoBarRequest(PermissionRequestID( | 114 CancelPendingInfobarRequest(PermissionRequestID( |
| 116 render_process_id, render_view_id, bridge_id)); | 115 render_process_id, render_view_id, bridge_id, 0)); |
| 117 } | 116 } |
| 118 | 117 |
| 119 void ChromeGeolocationPermissionContext::DecidePermission( | 118 void ChromeGeolocationPermissionContext::DecidePermission( |
| 120 const PermissionRequestID& id, | 119 const PermissionRequestID& id, |
| 121 const GURL& requesting_frame, | 120 const GURL& requesting_frame, |
| 122 const GURL& embedder, | 121 const GURL& embedder, |
| 123 base::Callback<void(bool)> callback) { | 122 base::Callback<void(bool)> callback) { |
| 124 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 123 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 125 | 124 |
| 126 ContentSetting content_setting = | 125 ContentSetting content_setting = |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 return permission_queue_controller_.get(); | 185 return permission_queue_controller_.get(); |
| 187 } | 186 } |
| 188 | 187 |
| 189 PermissionQueueController* | 188 PermissionQueueController* |
| 190 ChromeGeolocationPermissionContext::CreateQueueController() { | 189 ChromeGeolocationPermissionContext::CreateQueueController() { |
| 191 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 190 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 192 return new PermissionQueueController(profile(), | 191 return new PermissionQueueController(profile(), |
| 193 CONTENT_SETTINGS_TYPE_GEOLOCATION); | 192 CONTENT_SETTINGS_TYPE_GEOLOCATION); |
| 194 } | 193 } |
| 195 | 194 |
| 196 void ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest( | 195 void ChromeGeolocationPermissionContext::CancelPendingInfobarRequest( |
| 197 const PermissionRequestID& id) { | 196 const PermissionRequestID& id) { |
| 198 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { | 197 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { |
| 199 content::BrowserThread::PostTask( | 198 content::BrowserThread::PostTask( |
| 200 content::BrowserThread::UI, FROM_HERE, | 199 content::BrowserThread::UI, FROM_HERE, |
| 201 base::Bind( | 200 base::Bind( |
| 202 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, | 201 &ChromeGeolocationPermissionContext::CancelPendingInfobarRequest, |
| 203 this, id)); | 202 this, id)); |
| 204 return; | 203 return; |
| 205 } | 204 } |
| 206 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 205 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 207 if (shutting_down_) | 206 if (shutting_down_) |
| 208 return; | 207 return; |
| 209 QueueController()->CancelInfoBarRequest(id); | 208 QueueController()->CancelInfoBarRequest(id); |
| 210 } | 209 } |
| OLD | NEW |