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

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

Issue 11186010: Update geolocation infobar to handle Android system settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix conflict Created 8 years, 2 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/chrome_geolocation_permission_context_android.cc
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc
index 4e3263b385872a02a07b4fc7afa950cc7b2a8de3..60dd64e47da83d7289a11856a7d72d55f22aebe5 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/geolocation/chrome_geolocation_permission_context_android.h"
+#include "chrome/browser/android/google_location_settings_helper.h"
#include "chrome/browser/geolocation/geolocation_infobar_queue_controller_android.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -24,7 +25,8 @@ void ChromeGeolocationPermissionContext::RegisterUserPrefs(
ChromeGeolocationPermissionContextAndroid::
ChromeGeolocationPermissionContextAndroid(Profile* profile)
- : ChromeGeolocationPermissionContext(profile) {
+ : ChromeGeolocationPermissionContext(profile),
+ google_location_settings_helper_(new GoogleLocationSettingsHelper()) {
}
void ChromeGeolocationPermissionContextAndroid::DecidePermission(
@@ -59,6 +61,17 @@ void ChromeGeolocationPermissionContextAndroid::PermissionDecided(
base::Callback<void(bool)> callback,
bool allowed) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ // If Google Apps Location setting is turned off then we ignore
+ // the 'allow' website setting for this site and instead show
+ // the infobar to go back to the 'settings' to turn it back on.
+ if (allowed &&
+ !google_location_settings_helper_->IsPlatformSettingEnabled()) {
+ QueueController()->CreateInfoBarRequest(
+ render_process_id, render_view_id, bridge_id, requesting_frame,
+ embedder, callback);
+ return;
+ }
+
ChromeGeolocationPermissionContextAndroid::PermissionDecided(
render_process_id, render_view_id, bridge_id,
requesting_frame, embedder, callback, true);
@@ -68,5 +81,6 @@ GeolocationInfoBarQueueController*
ChromeGeolocationPermissionContextAndroid::CreateQueueController() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
return new GeolocationInfoBarQueueControllerAndroid(
- profile());
+ profile(),
+ google_location_settings_helper_.get());
}

Powered by Google App Engine
This is Rietveld 408576698