diff options
author | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-18 08:26:32 +0000 |
---|---|---|
committer | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-18 08:26:32 +0000 |
commit | c715ce96b3df17c073f6fac83cd4d3190db5d265 (patch) | |
tree | 95679e179b8d3623bb3ef8084ba1fdb146244261 /chrome/browser/geolocation/chrome_geolocation_permission_context.cc | |
parent | e0f465d25399bc018bfa6000022eacca935488dc (diff) | |
download | chromium_src-c715ce96b3df17c073f6fac83cd4d3190db5d265.zip chromium_src-c715ce96b3df17c073f6fac83cd4d3190db5d265.tar.gz chromium_src-c715ce96b3df17c073f6fac83cd4d3190db5d265.tar.bz2 |
Upstream Geolocation global enable/disable preference.
Chrome for Android presents a checkbox in its user interface to
control whether sites may request access to the geolocation API. This
requires a new preference, "geolocation.enabled" to model this global
switch.
When geolocation.enabled is true, Chrome for Android will prompt the
user (with an infobar) to confirm whether access should be
granted. Sites that have been previously authorised by the user will
be granted access automatically.
When geolocation.enabled is false, Chrome for Android should prevent
any access to the geolocation API for all sites (even those sites
previously authorised).
BUG=None
TEST=unit_test:GeolocationPermissionContextTests.GeolocationEnabledDisabled
Review URL: https://chromiumcodereview.appspot.com/10532126
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142679 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation/chrome_geolocation_permission_context.cc')
-rw-r--r-- | chrome/browser/geolocation/chrome_geolocation_permission_context.cc | 19 |
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 = |