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" | 8 #include "base/prefs/pref_service.h" |
9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
10 #include "components/keyed_service/core/keyed_service.h" | 10 #include "components/keyed_service/core/keyed_service.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 bool BrowserContextKeyedServiceFactory::IsOffTheRecord( | 95 bool BrowserContextKeyedServiceFactory::IsOffTheRecord( |
96 base::SupportsUserData* context) const { | 96 base::SupportsUserData* context) const { |
97 return static_cast<content::BrowserContext*>(context)->IsOffTheRecord(); | 97 return static_cast<content::BrowserContext*>(context)->IsOffTheRecord(); |
98 } | 98 } |
99 | 99 |
100 user_prefs::PrefRegistrySyncable* | 100 user_prefs::PrefRegistrySyncable* |
101 BrowserContextKeyedServiceFactory::GetAssociatedPrefRegistry( | 101 BrowserContextKeyedServiceFactory::GetAssociatedPrefRegistry( |
102 base::SupportsUserData* context) const { | 102 base::SupportsUserData* context) const { |
103 PrefService* prefs = user_prefs::UserPrefs::Get( | 103 PrefService* prefs = user_prefs::UserPrefs::Get(context); |
104 static_cast<content::BrowserContext*>(context)); | |
105 user_prefs::PrefRegistrySyncable* registry = | 104 user_prefs::PrefRegistrySyncable* registry = |
106 static_cast<user_prefs::PrefRegistrySyncable*>( | 105 static_cast<user_prefs::PrefRegistrySyncable*>( |
107 prefs->DeprecatedGetPrefRegistry()); | 106 prefs->DeprecatedGetPrefRegistry()); |
108 return registry; | 107 return registry; |
109 } | 108 } |
110 | 109 |
111 base::SupportsUserData* BrowserContextKeyedServiceFactory::GetContextToUse( | 110 base::SupportsUserData* BrowserContextKeyedServiceFactory::GetContextToUse( |
112 base::SupportsUserData* context) const { | 111 base::SupportsUserData* context) const { |
113 return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context)); | 112 return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context)); |
114 } | 113 } |
115 | 114 |
116 bool BrowserContextKeyedServiceFactory::ServiceIsCreatedWithContext() const { | 115 bool BrowserContextKeyedServiceFactory::ServiceIsCreatedWithContext() const { |
117 return ServiceIsCreatedWithBrowserContext(); | 116 return ServiceIsCreatedWithBrowserContext(); |
118 } | 117 } |
119 | 118 |
120 void BrowserContextKeyedServiceFactory::ContextShutdown( | 119 void BrowserContextKeyedServiceFactory::ContextShutdown( |
121 base::SupportsUserData* context) { | 120 base::SupportsUserData* context) { |
122 BrowserContextShutdown(static_cast<content::BrowserContext*>(context)); | 121 BrowserContextShutdown(static_cast<content::BrowserContext*>(context)); |
123 } | 122 } |
124 | 123 |
125 void BrowserContextKeyedServiceFactory::ContextDestroyed( | 124 void BrowserContextKeyedServiceFactory::ContextDestroyed( |
126 base::SupportsUserData* context) { | 125 base::SupportsUserData* context) { |
127 BrowserContextDestroyed(static_cast<content::BrowserContext*>(context)); | 126 BrowserContextDestroyed(static_cast<content::BrowserContext*>(context)); |
128 } | 127 } |
129 | 128 |
130 void BrowserContextKeyedServiceFactory::RegisterPrefs( | 129 void BrowserContextKeyedServiceFactory::RegisterPrefs( |
131 user_prefs::PrefRegistrySyncable* registry) { | 130 user_prefs::PrefRegistrySyncable* registry) { |
132 RegisterProfilePrefs(registry); | 131 RegisterProfilePrefs(registry); |
133 } | 132 } |
OLD | NEW |