| 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_base_factory.h" | 5 #include "components/keyed_service/content/browser_context_keyed_base_factory.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | |
| 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 7 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 #include "components/pref_registry/pref_registry_syncable.h" | |
| 10 #include "components/user_prefs/user_prefs.h" | |
| 11 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
| 12 | 9 |
| 13 BrowserContextKeyedBaseFactory::BrowserContextKeyedBaseFactory( | 10 BrowserContextKeyedBaseFactory::BrowserContextKeyedBaseFactory( |
| 14 const char* name, | 11 const char* name, |
| 15 BrowserContextDependencyManager* manager) | 12 BrowserContextDependencyManager* manager) |
| 16 : KeyedServiceBaseFactory(name, manager) { | 13 : KeyedServiceBaseFactory(name, manager) { |
| 17 } | 14 } |
| 18 | 15 |
| 19 BrowserContextKeyedBaseFactory::~BrowserContextKeyedBaseFactory() { | 16 BrowserContextKeyedBaseFactory::~BrowserContextKeyedBaseFactory() { |
| 20 } | 17 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 46 | 43 |
| 47 bool BrowserContextKeyedBaseFactory::ServiceIsNULLWhileTesting() const { | 44 bool BrowserContextKeyedBaseFactory::ServiceIsNULLWhileTesting() const { |
| 48 return KeyedServiceBaseFactory::ServiceIsNULLWhileTesting(); | 45 return KeyedServiceBaseFactory::ServiceIsNULLWhileTesting(); |
| 49 } | 46 } |
| 50 | 47 |
| 51 void BrowserContextKeyedBaseFactory::BrowserContextDestroyed( | 48 void BrowserContextKeyedBaseFactory::BrowserContextDestroyed( |
| 52 content::BrowserContext* context) { | 49 content::BrowserContext* context) { |
| 53 KeyedServiceBaseFactory::ContextDestroyed(context); | 50 KeyedServiceBaseFactory::ContextDestroyed(context); |
| 54 } | 51 } |
| 55 | 52 |
| 56 user_prefs::PrefRegistrySyncable* | 53 base::SupportsUserData* |
| 57 BrowserContextKeyedBaseFactory::GetAssociatedPrefRegistry( | 54 BrowserContextKeyedBaseFactory::GetUnderlyingContextInternal( |
| 58 base::SupportsUserData* context) const { | 55 base::SupportsUserData* context) const { |
| 59 PrefService* prefs = user_prefs::UserPrefs::Get(context); | 56 return context; |
| 60 user_prefs::PrefRegistrySyncable* registry = | 57 } |
| 61 static_cast<user_prefs::PrefRegistrySyncable*>( | 58 |
| 62 prefs->DeprecatedGetPrefRegistry()); | 59 base::SupportsUserData* |
| 63 return registry; | 60 BrowserContextKeyedBaseFactory::GetOriginalContextInternal( |
| 61 base::SupportsUserData* context) const { |
| 62 return context; |
| 64 } | 63 } |
| 65 | 64 |
| 66 base::SupportsUserData* BrowserContextKeyedBaseFactory::GetContextToUse( | 65 base::SupportsUserData* BrowserContextKeyedBaseFactory::GetContextToUse( |
| 67 base::SupportsUserData* context) const { | 66 base::SupportsUserData* context) const { |
| 68 return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context)); | 67 return GetBrowserContextToUse(static_cast<content::BrowserContext*>(context)); |
| 69 } | 68 } |
| 70 | 69 |
| 71 bool BrowserContextKeyedBaseFactory::ServiceIsCreatedWithContext() const { | 70 bool BrowserContextKeyedBaseFactory::ServiceIsCreatedWithContext() const { |
| 72 return ServiceIsCreatedWithBrowserContext(); | 71 return ServiceIsCreatedWithBrowserContext(); |
| 73 } | 72 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 94 | 93 |
| 95 bool BrowserContextKeyedBaseFactory::HasTestingFactory( | 94 bool BrowserContextKeyedBaseFactory::HasTestingFactory( |
| 96 base::SupportsUserData* context) { | 95 base::SupportsUserData* context) { |
| 97 return HasTestingFactory(static_cast<content::BrowserContext*>(context)); | 96 return HasTestingFactory(static_cast<content::BrowserContext*>(context)); |
| 98 } | 97 } |
| 99 | 98 |
| 100 void BrowserContextKeyedBaseFactory::CreateServiceNow( | 99 void BrowserContextKeyedBaseFactory::CreateServiceNow( |
| 101 base::SupportsUserData* context) { | 100 base::SupportsUserData* context) { |
| 102 CreateServiceNow(static_cast<content::BrowserContext*>(context)); | 101 CreateServiceNow(static_cast<content::BrowserContext*>(context)); |
| 103 } | 102 } |
| OLD | NEW |