summaryrefslogtreecommitdiffstats
path: root/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/geolocation/chrome_geolocation_permission_context.cc')
-rw-r--r--chrome/browser/geolocation/chrome_geolocation_permission_context.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
index e48fba1..fb376a7 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
@@ -584,6 +584,14 @@ ChromeGeolocationPermissionContext::ChromeGeolocationPermissionContext(
new GeolocationInfoBarQueueController(this, profile))) {
}
+void ChromeGeolocationPermissionContext::RegisterUserPrefs(
+ PrefService *user_prefs) {
+#if defined(OS_ANDROID)
+ user_prefs->RegisterBooleanPref(prefs::kGeolocationEnabled, true,
+ PrefService::UNSYNCABLE_PREF);
+#endif
+}
+
ChromeGeolocationPermissionContext::~ChromeGeolocationPermissionContext() {
}
@@ -601,6 +609,17 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
}
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+#if defined(OS_ANDROID)
+ // 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)) {
+ NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
+ requesting_frame, callback, false);
+ return;
+ }
+#endif
+
ExtensionService* extension_service = profile_->GetExtensionService();
if (extension_service) {
const extensions::Extension* extension =