Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5336)

Unified Diff: chrome/browser/geolocation/geolocation_permission_context_android.cc

Issue 2612993002: Make geolocation API and X-Geo header access consistent (Closed)
Patch Set: Fix test / merge error Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/geolocation/geolocation_permission_context_android.cc
diff --git a/chrome/browser/geolocation/geolocation_permission_context_android.cc b/chrome/browser/geolocation/geolocation_permission_context_android.cc
index 65c96efb575e6ba09718d82990e8a8fd93f33080..51f1f1b82f79550e0c762a7815d46200281611a6 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_android.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_android.cc
@@ -10,8 +10,10 @@
#include "base/bind.h"
#include "chrome/browser/android/location_settings.h"
#include "chrome/browser/android/location_settings_impl.h"
+#include "chrome/browser/android/search_geolocation/search_geolocation_service.h"
#include "chrome/browser/permissions/permission_request_id.h"
#include "chrome/browser/permissions/permission_update_infobar_delegate_android.h"
+#include "chrome/browser/profiles/profile.h"
#include "components/infobars/core/infobar.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
@@ -28,6 +30,31 @@ GeolocationPermissionContextAndroid::
GeolocationPermissionContextAndroid::~GeolocationPermissionContextAndroid() {
}
+ContentSetting GeolocationPermissionContextAndroid::GetPermissionStatusInternal(
+ const GURL& requesting_origin,
+ const GURL& embedding_origin) const {
+ ContentSetting value =
+ GeolocationPermissionContext::GetPermissionStatusInternal(
+ requesting_origin, embedding_origin);
+
+ if (value == CONTENT_SETTING_ASK && requesting_origin == embedding_origin) {
+ // Consult the DSE Geolocation setting. Note that this only needs to be
+ // consulted when the content setting is ASK. In the other cases (ALLOW or
+ // BLOCK) checking the setting is redundant, as the setting is kept
+ // consistent with the content setting.
+ SearchGeolocationService* search_helper =
+ SearchGeolocationService::Factory::GetForBrowserContext(profile());
+ if (search_helper &&
+ search_helper->UseDSEGeolocationSetting(
+ url::Origin(embedding_origin))) {
+ value = search_helper->GetDSEGeolocationSetting() ? CONTENT_SETTING_ALLOW
+ : CONTENT_SETTING_BLOCK;
+ }
+ }
+
+ return value;
+}
+
void GeolocationPermissionContextAndroid::RequestPermission(
content::WebContents* web_contents,
const PermissionRequestID& id,

Powered by Google App Engine
This is Rietveld 408576698