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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/extensions/extension_system.h" |
16 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h" | 17 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h" |
17 #include "chrome/browser/geolocation/geolocation_permission_request_id.h" | 18 #include "chrome/browser/geolocation/geolocation_permission_request_id.h" |
18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/tab_contents/tab_util.h" | 20 #include "chrome/browser/tab_contents/tab_util.h" |
20 #include "chrome/browser/view_type_utils.h" | 21 #include "chrome/browser/view_type_utils.h" |
21 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
(...skipping 22 matching lines...) Expand all Loading... |
48 this, render_process_id, render_view_id, bridge_id, | 49 this, render_process_id, render_view_id, bridge_id, |
49 requesting_frame, callback)); | 50 requesting_frame, callback)); |
50 return; | 51 return; |
51 } | 52 } |
52 | 53 |
53 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 54 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
54 content::WebContents* web_contents = | 55 content::WebContents* web_contents = |
55 tab_util::GetWebContentsByID(render_process_id, render_view_id); | 56 tab_util::GetWebContentsByID(render_process_id, render_view_id); |
56 const GeolocationPermissionRequestID id(render_process_id, render_view_id, | 57 const GeolocationPermissionRequestID id(render_process_id, render_view_id, |
57 bridge_id); | 58 bridge_id); |
58 ExtensionService* extension_service = profile_->GetExtensionService(); | 59 ExtensionService* extension_service = |
| 60 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
59 if (extension_service) { | 61 if (extension_service) { |
60 const extensions::Extension* extension = | 62 const extensions::Extension* extension = |
61 extension_service->extensions()->GetExtensionOrAppByURL( | 63 extension_service->extensions()->GetExtensionOrAppByURL( |
62 ExtensionURLInfo(WebKit::WebSecurityOrigin::createFromString( | 64 ExtensionURLInfo(WebKit::WebSecurityOrigin::createFromString( |
63 UTF8ToUTF16(requesting_frame.spec())), | 65 UTF8ToUTF16(requesting_frame.spec())), |
64 requesting_frame)); | 66 requesting_frame)); |
65 if (extension && | 67 if (extension && |
66 extension->HasAPIPermission(extensions::APIPermission::kGeolocation)) { | 68 extension->HasAPIPermission(extensions::APIPermission::kGeolocation)) { |
67 // Make sure the extension is in the calling process. | 69 // Make sure the extension is in the calling process. |
68 if (extension_service->process_map()->Contains(extension->id(), | 70 if (extension_service->process_map()->Contains(extension->id(), |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 content::BrowserThread::PostTask( | 184 content::BrowserThread::PostTask( |
183 content::BrowserThread::UI, FROM_HERE, | 185 content::BrowserThread::UI, FROM_HERE, |
184 base::Bind( | 186 base::Bind( |
185 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, | 187 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, |
186 this, id)); | 188 this, id)); |
187 return; | 189 return; |
188 } | 190 } |
189 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 191 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
190 QueueController()->CancelInfoBarRequest(id); | 192 QueueController()->CancelInfoBarRequest(id); |
191 } | 193 } |
OLD | NEW |