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

Unified Diff: chrome/browser/geolocation/geolocation_permission_context_factory.cc

Issue 459953002: Migrate geolocation permissions to the new common permission class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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/geolocation_permission_context_factory.cc
diff --git a/chrome/browser/geolocation/geolocation_permission_context_factory.cc b/chrome/browser/geolocation/geolocation_permission_context_factory.cc
index a4d9c8ad6b42c3eddcaa2c9ab07c4b495e784e67..c1259b1e2c6519b7258a29b5b6550de240917ce2 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_factory.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_factory.cc
@@ -15,39 +15,12 @@
#include "chrome/browser/geolocation/geolocation_permission_context.h"
#endif
-namespace {
-
-class Service : public KeyedService {
- public:
- explicit Service(Profile* profile) {
-#if defined(OS_ANDROID)
- context_ = new GeolocationPermissionContextAndroid(profile);
-#else
- context_ = new GeolocationPermissionContext(profile);
-#endif
- }
-
- GeolocationPermissionContext* context() {
- return context_.get();
- }
-
- virtual void Shutdown() OVERRIDE {
- context()->ShutdownOnUIThread();
- }
-
- private:
- scoped_refptr<GeolocationPermissionContext> context_;
-
- DISALLOW_COPY_AND_ASSIGN(Service);
-};
-
-} // namespace
// static
GeolocationPermissionContext*
GeolocationPermissionContextFactory::GetForProfile(Profile* profile) {
- return static_cast<Service*>(
- GetInstance()->GetServiceForBrowserContext(profile, true))->context();
+ return static_cast<GeolocationPermissionContext*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
}
// static
@@ -56,11 +29,20 @@ GeolocationPermissionContextFactory::GetInstance() {
return Singleton<GeolocationPermissionContextFactory>::get();
}
+#if !defined(OS_ANDROID)
GeolocationPermissionContextFactory::GeolocationPermissionContextFactory()
: BrowserContextKeyedServiceFactory(
"GeolocationPermissionContext",
BrowserContextDependencyManager::GetInstance()) {
}
+#else
+GeolocationPermissionContextFactory::GeolocationPermissionContextFactory()
+ : BrowserContextKeyedServiceFactory(
+ "GeolocationPermissionContextAndroid",
+ BrowserContextDependencyManager::GetInstance()) {
+}
+#endif
+
GeolocationPermissionContextFactory::~GeolocationPermissionContextFactory() {
}
@@ -68,7 +50,12 @@ GeolocationPermissionContextFactory::~GeolocationPermissionContextFactory() {
KeyedService*
GeolocationPermissionContextFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const {
- return new Service(static_cast<Profile*>(profile));
+#if !defined(OS_ANDROID)
+ return new GeolocationPermissionContext(static_cast<Profile*>(profile));
+#else
+ return new GeolocationPermissionContextAndroid(
+ static_cast<Profile*>(profile));
+#endif
}
void GeolocationPermissionContextFactory::RegisterProfilePrefs(

Powered by Google App Engine
This is Rietveld 408576698