Chromium Code Reviews| Index: chrome/browser/geolocation/geolocation_permission_context.cc |
| diff --git a/chrome/browser/geolocation/geolocation_permission_context.cc b/chrome/browser/geolocation/geolocation_permission_context.cc |
| index 4e282fcb21301b9a880e59d521cb15498b29b8f4..bee6c0c228dc123cead629efd96651c04fedd38b 100644 |
| --- a/chrome/browser/geolocation/geolocation_permission_context.cc |
| +++ b/chrome/browser/geolocation/geolocation_permission_context.cc |
| @@ -13,9 +13,10 @@ |
| #include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/web_contents.h" |
| #include "device/geolocation/geolocation_provider.h" |
| +#include "url/origin.h" |
| #if defined(OS_ANDROID) |
| -#include "chrome/browser/android/search_geolocation/search_geolocation_disclosure_infobar_delegate.h" |
| +#include "chrome/browser/android/search_geolocation/search_geolocation_service.h" |
| #endif |
| GeolocationPermissionContext::GeolocationPermissionContext(Profile* profile) |
| @@ -55,12 +56,20 @@ void GeolocationPermissionContext::DecidePermission( |
| } |
| #if defined(OS_ANDROID) |
| - // If the search geolocation disclosure is open, don't pop up a permission |
| - // request. Treat this as a dismissal instead. |
| - if (SearchGeolocationDisclosureInfoBarDelegate:: |
| - IsSearchGeolocationDisclosureOpen(web_contents)) { |
| + // Consult the DSE Geolocation setting. Note that for API permission requests, |
| + // this only needs to be consulted here, as it is only needed when the content |
| + // setting is ASK. In the other cases (ALLOW or BLOCK) checking the setting is |
| + // reduntant, as the setting is kept consistent with the content setting. |
| + SearchGeolocationService* search_helper = |
| + SearchGeolocationService::Factory::GetForBrowserContext( |
| + web_contents->GetBrowserContext()); |
| + if (search_helper && |
| + search_helper->UseDSEGeolocationSetting(url::Origin(embedding_origin))) { |
| + ContentSetting setting = search_helper->GetDSEGeolocationSetting() |
| + ? CONTENT_SETTING_ALLOW |
| + : CONTENT_SETTING_BLOCK; |
|
raymes
2017/01/09 05:47:27
As discussed I think we want to move this to GetPe
benwells
2017/01/09 21:02:22
Done. That's much much nicer!
|
| NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
| - false /* persist */, CONTENT_SETTING_DEFAULT); |
| + false /* persist */, setting); |
| return; |
| } |
| #endif |