| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" | |
| 6 | |
| 7 #include "chrome/browser/profiles/incognito_helpers.h" | |
| 8 #include "chrome/browser/profiles/profile.h" | |
| 9 #include "chrome/common/features.h" | |
| 10 #include "chrome/common/pref_names.h" | |
| 11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 12 #include "components/pref_registry/pref_registry_syncable.h" | |
| 13 #if BUILDFLAG(ANDROID_JAVA_UI) | |
| 14 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" | |
| 15 #else | |
| 16 #include "chrome/browser/geolocation/geolocation_permission_context.h" | |
| 17 #endif | |
| 18 | |
| 19 | |
| 20 // static | |
| 21 GeolocationPermissionContext* | |
| 22 GeolocationPermissionContextFactory::GetForProfile(Profile* profile) { | |
| 23 return static_cast<GeolocationPermissionContext*>( | |
| 24 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 25 } | |
| 26 | |
| 27 // static | |
| 28 GeolocationPermissionContextFactory* | |
| 29 GeolocationPermissionContextFactory::GetInstance() { | |
| 30 return base::Singleton<GeolocationPermissionContextFactory>::get(); | |
| 31 } | |
| 32 | |
| 33 #if !BUILDFLAG(ANDROID_JAVA_UI) | |
| 34 GeolocationPermissionContextFactory::GeolocationPermissionContextFactory() | |
| 35 : PermissionContextFactoryBase( | |
| 36 "GeolocationPermissionContext", | |
| 37 BrowserContextDependencyManager::GetInstance()) { | |
| 38 } | |
| 39 #else | |
| 40 GeolocationPermissionContextFactory::GeolocationPermissionContextFactory() | |
| 41 : PermissionContextFactoryBase( | |
| 42 "GeolocationPermissionContextAndroid", | |
| 43 BrowserContextDependencyManager::GetInstance()) { | |
| 44 } | |
| 45 #endif | |
| 46 | |
| 47 | |
| 48 GeolocationPermissionContextFactory::~GeolocationPermissionContextFactory() { | |
| 49 } | |
| 50 | |
| 51 KeyedService* | |
| 52 GeolocationPermissionContextFactory::BuildServiceInstanceFor( | |
| 53 content::BrowserContext* profile) const { | |
| 54 #if !BUILDFLAG(ANDROID_JAVA_UI) | |
| 55 return new GeolocationPermissionContext(static_cast<Profile*>(profile)); | |
| 56 #else | |
| 57 return new GeolocationPermissionContextAndroid( | |
| 58 static_cast<Profile*>(profile)); | |
| 59 #endif | |
| 60 } | |
| OLD | NEW |