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_android.h" | 5 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 : GeolocationPermissionContext(profile), | 26 : GeolocationPermissionContext(profile), |
27 location_settings_(new LocationSettingsImpl()), | 27 location_settings_(new LocationSettingsImpl()), |
28 permission_update_infobar_(nullptr), | 28 permission_update_infobar_(nullptr), |
29 weak_factory_(this) { | 29 weak_factory_(this) { |
30 } | 30 } |
31 | 31 |
32 GeolocationPermissionContextAndroid::~GeolocationPermissionContextAndroid() { | 32 GeolocationPermissionContextAndroid::~GeolocationPermissionContextAndroid() { |
33 } | 33 } |
34 | 34 |
35 ContentSetting GeolocationPermissionContextAndroid::GetPermissionStatusInternal( | 35 ContentSetting GeolocationPermissionContextAndroid::GetPermissionStatusInternal( |
| 36 content::RenderFrameHost* render_frame_host, |
36 const GURL& requesting_origin, | 37 const GURL& requesting_origin, |
37 const GURL& embedding_origin) const { | 38 const GURL& embedding_origin) const { |
38 ContentSetting value = | 39 ContentSetting value = |
39 GeolocationPermissionContext::GetPermissionStatusInternal( | 40 GeolocationPermissionContext::GetPermissionStatusInternal( |
40 requesting_origin, embedding_origin); | 41 render_frame_host, requesting_origin, embedding_origin); |
41 | 42 |
42 if (value == CONTENT_SETTING_ASK && requesting_origin == embedding_origin) { | 43 if (value == CONTENT_SETTING_ASK && requesting_origin == embedding_origin) { |
43 // Consult the DSE Geolocation setting. Note that this only needs to be | 44 // Consult the DSE Geolocation setting. Note that this only needs to be |
44 // consulted when the content setting is ASK. In the other cases (ALLOW or | 45 // consulted when the content setting is ASK. In the other cases (ALLOW or |
45 // BLOCK) checking the setting is redundant, as the setting is kept | 46 // BLOCK) checking the setting is redundant, as the setting is kept |
46 // consistent with the content setting. | 47 // consistent with the content setting. |
47 SearchGeolocationService* search_helper = | 48 SearchGeolocationService* search_helper = |
48 SearchGeolocationService::Factory::GetForBrowserContext(profile()); | 49 SearchGeolocationService::Factory::GetForBrowserContext(profile()); |
49 | 50 |
50 // If the user is incognito, use the DSE Geolocation setting from the | 51 // If the user is incognito, use the DSE Geolocation setting from the |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 162 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
162 | 163 |
163 NotifyPermissionSet(id, requesting_frame_origin, embedding_origin, callback, | 164 NotifyPermissionSet(id, requesting_frame_origin, embedding_origin, callback, |
164 false /* persist */, new_setting); | 165 false /* persist */, new_setting); |
165 } | 166 } |
166 | 167 |
167 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( | 168 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( |
168 std::unique_ptr<LocationSettings> settings) { | 169 std::unique_ptr<LocationSettings> settings) { |
169 location_settings_ = std::move(settings); | 170 location_settings_ = std::move(settings); |
170 } | 171 } |
OLD | NEW |