| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 5 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | |
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 10 #include "components/keyed_service/core/keyed_service.h" | 9 #include "components/keyed_service/core/keyed_service.h" |
| 11 #include "components/pref_registry/pref_registry_syncable.h" | 10 #include "components/pref_registry/pref_registry_syncable.h" |
| 12 #include "components/user_prefs/user_prefs.h" | 11 #include "components/user_prefs/user_prefs.h" |
| 13 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
| 14 | 13 |
| 15 void BrowserContextKeyedServiceFactory::SetTestingFactory( | 14 void BrowserContextKeyedServiceFactory::SetTestingFactory( |
| 16 content::BrowserContext* context, | 15 content::BrowserContext* context, |
| 17 TestingFactoryFunction testing_factory) { | 16 TestingFactoryFunction testing_factory) { |
| 18 KeyedServiceFactory::SetTestingFactory( | 17 KeyedServiceFactory::SetTestingFactory( |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 base::SupportsUserData* context) const { | 89 base::SupportsUserData* context) const { |
| 91 return BuildServiceInstanceFor( | 90 return BuildServiceInstanceFor( |
| 92 static_cast<content::BrowserContext*>(context)); | 91 static_cast<content::BrowserContext*>(context)); |
| 93 } | 92 } |
| 94 | 93 |
| 95 bool BrowserContextKeyedServiceFactory::IsOffTheRecord( | 94 bool BrowserContextKeyedServiceFactory::IsOffTheRecord( |
| 96 base::SupportsUserData* context) const { | 95 base::SupportsUserData* context) const { |
| 97 return static_cast<content::BrowserContext*>(context)->IsOffTheRecord(); | 96 return static_cast<content::BrowserContext*>(context)->IsOffTheRecord(); |
| 98 } | 97 } |
| 99 | 98 |
| 100 user_prefs::PrefRegistrySyncable* | |
| 101 BrowserContextKeyedServiceFactory::GetAssociatedPrefRegistry( | |
| 102 base::SupportsUserData* context) const { | |
| 103 PrefService* prefs = user_prefs::UserPrefs::Get(context); | |
| 104 user_prefs::PrefRegistrySyncable* registry = | |
| 105 static_cast<user_prefs::PrefRegistrySyncable*>( | |
| 106 prefs->DeprecatedGetPrefRegistry()); | |
| 107 return registry; | |
| 108 } | |
| 109 | |
| 110 base::SupportsUserData* BrowserContextKeyedServiceFactory::GetContextToUse( | 99 base::SupportsUserData* BrowserContextKeyedServiceFactory::GetContextToUse( |
| 111 base::SupportsUserData* context) const { | 100 base::SupportsUserData* context) const { |
| 112 return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context)); | 101 return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context)); |
| 113 } | 102 } |
| 114 | 103 |
| 115 bool BrowserContextKeyedServiceFactory::ServiceIsCreatedWithContext() const { | 104 bool BrowserContextKeyedServiceFactory::ServiceIsCreatedWithContext() const { |
| 116 return ServiceIsCreatedWithBrowserContext(); | 105 return ServiceIsCreatedWithBrowserContext(); |
| 117 } | 106 } |
| 118 | 107 |
| 119 void BrowserContextKeyedServiceFactory::ContextShutdown( | 108 void BrowserContextKeyedServiceFactory::ContextShutdown( |
| 120 base::SupportsUserData* context) { | 109 base::SupportsUserData* context) { |
| 121 BrowserContextShutdown(static_cast<content::BrowserContext*>(context)); | 110 BrowserContextShutdown(static_cast<content::BrowserContext*>(context)); |
| 122 } | 111 } |
| 123 | 112 |
| 124 void BrowserContextKeyedServiceFactory::ContextDestroyed( | 113 void BrowserContextKeyedServiceFactory::ContextDestroyed( |
| 125 base::SupportsUserData* context) { | 114 base::SupportsUserData* context) { |
| 126 BrowserContextDestroyed(static_cast<content::BrowserContext*>(context)); | 115 BrowserContextDestroyed(static_cast<content::BrowserContext*>(context)); |
| 127 } | 116 } |
| 128 | 117 |
| 129 void BrowserContextKeyedServiceFactory::RegisterPrefs( | 118 void BrowserContextKeyedServiceFactory::RegisterPrefs( |
| 130 user_prefs::PrefRegistrySyncable* registry) { | 119 user_prefs::PrefRegistrySyncable* registry) { |
| 131 RegisterProfilePrefs(registry); | 120 RegisterProfilePrefs(registry); |
| 132 } | 121 } |
| OLD | NEW |