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); |
+} |