summaryrefslogtreecommitdiffstats
path: root/chrome/browser/geolocation
diff options
context:
space:
mode:
authorvasilii@chromium.org <vasilii@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-05 10:09:40 +0000
committervasilii@chromium.org <vasilii@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-05 10:09:40 +0000
commit89c0e15a2d5f6ef9a57837308eb95f1a82574745 (patch)
tree966d5d9702ed71ad2d8a97569226247be020b2eb /chrome/browser/geolocation
parent2ba70737e1a878181c7722c8dabf0500509936da (diff)
downloadchromium_src-89c0e15a2d5f6ef9a57837308eb95f1a82574745.zip
chromium_src-89c0e15a2d5f6ef9a57837308eb95f1a82574745.tar.gz
chromium_src-89c0e15a2d5f6ef9a57837308eb95f1a82574745.tar.bz2
Prevents leaking geolocation permission from Incognito mode to regular profile.
BUG=51204 TEST=GeolocationBrowserTest.NoLeakFromOffTheRecord Review URL: https://chromiumcodereview.appspot.com/13548003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation')
-rw-r--r--chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc5
-rw-r--r--chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h1
-rw-r--r--chrome/browser/geolocation/geolocation_browsertest.cc16
3 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc
index 3c61d15..407a376 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.cc
@@ -82,5 +82,10 @@ void ChromeGeolocationPermissionContextFactory::RegisterUserPrefs(
bool ChromeGeolocationPermissionContextFactory::
ServiceRedirectedInIncognito() const {
+ return false;
+}
+
+bool ChromeGeolocationPermissionContextFactory::
+ServiceHasOwnInstanceInIncognito() const {
return true;
}
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h
index dadd048..7f23846 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_factory.h
@@ -33,6 +33,7 @@ class ChromeGeolocationPermissionContextFactory
BuildServiceInstanceFor(Profile* profile) const OVERRIDE;
virtual void RegisterUserPrefs(PrefRegistrySyncable* registry) OVERRIDE;
virtual bool ServiceRedirectedInIncognito() const OVERRIDE;
+ virtual bool ServiceHasOwnInstanceInIncognito() const OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContextFactory);
};
diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc
index 2062dfe..f10b327 100644
--- a/chrome/browser/geolocation/geolocation_browsertest.cc
+++ b/chrome/browser/geolocation/geolocation_browsertest.cc
@@ -461,6 +461,22 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, NoInfobarForOffTheRecord) {
CheckGeoposition(fake_latitude_, fake_longitude_);
}
+IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, NoLeakFromOffTheRecord) {
+ // First, check infobar will be created for incognito profile.
+ ASSERT_TRUE(Initialize(INITIALIZATION_OFFTHERECORD));
+ AddGeolocationWatch(true);
+ // Response won't be persisted.
+ SetInfobarResponse(current_url_, true);
+ CheckGeoposition(fake_latitude_, fake_longitude_);
+ // Disables further prompts from this tab.
+ CheckStringValueFromJavascript("0", "geoSetMaxNavigateCount(0)");
+ // Go to the regular profile, infobar will be created.
+ ASSERT_TRUE(Initialize(INITIALIZATION_NONE));
+ AddGeolocationWatch(true);
+ SetInfobarResponse(current_url_, false);
+ CheckStringValueFromJavascript("1", "geoGetLastError()");
+}
+
// crbug.com/176291
IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest,
DISABLED_IFramesWithFreshPosition) {