OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/geolocation_permission_context.h" | 5 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "components/content_settings/core/common/permission_request_id.h" | 10 #include "components/content_settings/core/common/permission_request_id.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/geolocation_provider.h" | 12 #include "content/public/browser/geolocation_provider.h" |
13 #include "content/public/browser/render_frame_host.h" | |
13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
14 | 15 |
15 | 16 |
16 GeolocationPermissionContext::GeolocationPermissionContext( | 17 GeolocationPermissionContext::GeolocationPermissionContext( |
17 Profile* profile) | 18 Profile* profile) |
18 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_GEOLOCATION), | 19 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_GEOLOCATION), |
19 extensions_context_(profile) { | 20 extensions_context_(profile) { |
20 } | 21 } |
21 | 22 |
22 GeolocationPermissionContext::~GeolocationPermissionContext() { | 23 GeolocationPermissionContext::~GeolocationPermissionContext() { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 if (extensions_context_.CancelPermissionRequest( | 62 if (extensions_context_.CancelPermissionRequest( |
62 web_contents, id.bridge_id())) | 63 web_contents, id.bridge_id())) |
63 return; | 64 return; |
64 PermissionContextBase::CancelPermissionRequest(web_contents, id); | 65 PermissionContextBase::CancelPermissionRequest(web_contents, id); |
65 } | 66 } |
66 | 67 |
67 void GeolocationPermissionContext::UpdateTabContext( | 68 void GeolocationPermissionContext::UpdateTabContext( |
68 const PermissionRequestID& id, | 69 const PermissionRequestID& id, |
69 const GURL& requesting_frame, | 70 const GURL& requesting_frame, |
70 bool allowed) { | 71 bool allowed) { |
71 // WebContents may have gone away (or not exists for extension). | 72 // WebContents may have gone away (or not exists for extension). |
Bernhard Bauer
2015/05/27 08:26:40
Can you move this comment to the `if (content_sett
mlamouri (slow - plz ping)
2015/05/30 13:31:05
Done.
| |
72 TabSpecificContentSettings* content_settings = | 73 TabSpecificContentSettings* content_settings = |
73 TabSpecificContentSettings::Get(id.render_process_id(), | 74 TabSpecificContentSettings::Get(content::RenderFrameHost::FromID( |
Bernhard Bauer
2015/05/27 08:26:40
What if RenderFrameHost::FromID returns null?
mlamouri (slow - plz ping)
2015/05/30 13:31:06
content_settings will be null.
| |
74 id.render_view_id()); | 75 id.render_process_id(), id.render_frame_id())); |
75 if (content_settings) | 76 if (content_settings) |
76 content_settings->OnGeolocationPermissionSet( | 77 content_settings->OnGeolocationPermissionSet( |
77 requesting_frame.GetOrigin(), allowed); | 78 requesting_frame.GetOrigin(), allowed); |
78 | 79 |
79 if (allowed) { | 80 if (allowed) { |
80 content::GeolocationProvider::GetInstance() | 81 content::GeolocationProvider::GetInstance() |
81 ->UserDidOptIntoLocationServices(); | 82 ->UserDidOptIntoLocationServices(); |
82 } | 83 } |
83 } | 84 } |
OLD | NEW |