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

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: Failed to upload 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 ae4bb87a370458e217358063f6ee6fbb40481ace..46501a786bb601398622de1cec09520dacd295f3 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/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
@@ -11,7 +12,8 @@
ChromeGeolocationPermissionContextAndroid::
ChromeGeolocationPermissionContextAndroid(Profile* profile)
- : ChromeGeolocationPermissionContext(profile) {
+ : ChromeGeolocationPermissionContext(profile),
+ google_location_settings_helper_(new GoogleLocationSettingsHelper()) {
}
ChromeGeolocationPermissionContextAndroid::
@@ -30,7 +32,7 @@ void ChromeGeolocationPermissionContextAndroid::DecidePermission(
// Check to see if the feature in its entirety has been disabled.
// This must happen before other services (e.g. tabs, extensions)
// get an opportunity to allow the geolocation request.
- if (!profile()->GetPrefs()->GetBoolean(prefs::kGeolocationEnabled)) {
+ if (!google_location_settings_helper_->IsMasterLocationSettingEnabled()) {
PermissionDecided(render_process_id, render_view_id, bridge_id,
requesting_frame, embedder, callback, false);
return;
@@ -40,3 +42,28 @@ void ChromeGeolocationPermissionContextAndroid::DecidePermission(
render_process_id, render_view_id, bridge_id,
requesting_frame, embedder, callback);
}
+
+void ChromeGeolocationPermissionContextAndroid::PermissionDecided(
+ int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame,
+ const GURL& embedder,
+ 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_->IsGoogleAppsLocationSettingEnabled()) {
+ QueueController()->CreateInfoBarRequest(
+ render_process_id, render_view_id, bridge_id, requesting_frame,
+ embedder, callback);
+ return;
+ }
+
+ ChromeGeolocationPermissionContext::PermissionDecided(
+ render_process_id, render_view_id, bridge_id,
+ requesting_frame, embedder, callback, allowed);
+}

Powered by Google App Engine
This is Rietveld 408576698