| 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/memory/ptr_util.h" |
| 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 #include "components/keyed_service/core/keyed_service.h" | 10 #include "components/keyed_service/core/keyed_service.h" |
| 10 #include "components/pref_registry/pref_registry_syncable.h" | 11 #include "components/pref_registry/pref_registry_syncable.h" |
| 11 #include "components/user_prefs/user_prefs.h" | 12 #include "components/user_prefs/user_prefs.h" |
| 12 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
| 13 | 14 |
| 14 void BrowserContextKeyedServiceFactory::SetTestingFactory( | 15 void BrowserContextKeyedServiceFactory::SetTestingFactory( |
| 15 content::BrowserContext* context, | 16 content::BrowserContext* context, |
| 16 TestingFactoryFunction testing_factory) { | 17 TestingFactoryFunction testing_factory) { |
| 17 KeyedServiceFactory::SetTestingFactory( | 18 KeyedServiceFactory::SetTestingFactory( |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void BrowserContextKeyedServiceFactory::BrowserContextShutdown( | 79 void BrowserContextKeyedServiceFactory::BrowserContextShutdown( |
| 79 content::BrowserContext* context) { | 80 content::BrowserContext* context) { |
| 80 KeyedServiceFactory::ContextShutdown(context); | 81 KeyedServiceFactory::ContextShutdown(context); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void BrowserContextKeyedServiceFactory::BrowserContextDestroyed( | 84 void BrowserContextKeyedServiceFactory::BrowserContextDestroyed( |
| 84 content::BrowserContext* context) { | 85 content::BrowserContext* context) { |
| 85 KeyedServiceFactory::ContextDestroyed(context); | 86 KeyedServiceFactory::ContextDestroyed(context); |
| 86 } | 87 } |
| 87 | 88 |
| 88 scoped_ptr<KeyedService> | 89 std::unique_ptr<KeyedService> |
| 89 BrowserContextKeyedServiceFactory::BuildServiceInstanceFor( | 90 BrowserContextKeyedServiceFactory::BuildServiceInstanceFor( |
| 90 base::SupportsUserData* context) const { | 91 base::SupportsUserData* context) const { |
| 91 // TODO(isherman): The wrapped BuildServiceInstanceFor() should return a | 92 // TODO(isherman): The wrapped BuildServiceInstanceFor() should return a |
| 92 // scoped_ptr as well. | 93 // scoped_ptr as well. |
| 93 return make_scoped_ptr( | 94 return base::WrapUnique( |
| 94 BuildServiceInstanceFor(static_cast<content::BrowserContext*>(context))); | 95 BuildServiceInstanceFor(static_cast<content::BrowserContext*>(context))); |
| 95 } | 96 } |
| 96 | 97 |
| 97 bool BrowserContextKeyedServiceFactory::IsOffTheRecord( | 98 bool BrowserContextKeyedServiceFactory::IsOffTheRecord( |
| 98 base::SupportsUserData* context) const { | 99 base::SupportsUserData* context) const { |
| 99 return static_cast<content::BrowserContext*>(context)->IsOffTheRecord(); | 100 return static_cast<content::BrowserContext*>(context)->IsOffTheRecord(); |
| 100 } | 101 } |
| 101 | 102 |
| 102 base::SupportsUserData* BrowserContextKeyedServiceFactory::GetContextToUse( | 103 base::SupportsUserData* BrowserContextKeyedServiceFactory::GetContextToUse( |
| 103 base::SupportsUserData* context) const { | 104 base::SupportsUserData* context) const { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 115 | 116 |
| 116 void BrowserContextKeyedServiceFactory::ContextDestroyed( | 117 void BrowserContextKeyedServiceFactory::ContextDestroyed( |
| 117 base::SupportsUserData* context) { | 118 base::SupportsUserData* context) { |
| 118 BrowserContextDestroyed(static_cast<content::BrowserContext*>(context)); | 119 BrowserContextDestroyed(static_cast<content::BrowserContext*>(context)); |
| 119 } | 120 } |
| 120 | 121 |
| 121 void BrowserContextKeyedServiceFactory::RegisterPrefs( | 122 void BrowserContextKeyedServiceFactory::RegisterPrefs( |
| 122 user_prefs::PrefRegistrySyncable* registry) { | 123 user_prefs::PrefRegistrySyncable* registry) { |
| 123 RegisterProfilePrefs(registry); | 124 RegisterProfilePrefs(registry); |
| 124 } | 125 } |
| OLD | NEW |