| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/chromeos/policy/recommendation_restorer_factory.h" | 5 #include "chrome/browser/chromeos/policy/recommendation_restorer_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/policy/recommendation_restorer.h" | 7 #include "chrome/browser/chromeos/policy/recommendation_restorer.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.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 "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 11 | 11 |
| 12 namespace policy { | 12 namespace policy { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 RecommendationRestorerFactory* RecommendationRestorerFactory::GetInstance() { | 15 RecommendationRestorerFactory* RecommendationRestorerFactory::GetInstance() { |
| 16 return Singleton<RecommendationRestorerFactory>::get(); | 16 return base::Singleton<RecommendationRestorerFactory>::get(); |
| 17 } | 17 } |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 RecommendationRestorer* RecommendationRestorerFactory::GetForProfile( | 20 RecommendationRestorer* RecommendationRestorerFactory::GetForProfile( |
| 21 Profile* profile) { | 21 Profile* profile) { |
| 22 return reinterpret_cast<RecommendationRestorer*>( | 22 return reinterpret_cast<RecommendationRestorer*>( |
| 23 GetInstance()->GetServiceForBrowserContext(profile, false)); | 23 GetInstance()->GetServiceForBrowserContext(profile, false)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 KeyedService* RecommendationRestorerFactory::BuildServiceInstanceFor( | 26 KeyedService* RecommendationRestorerFactory::BuildServiceInstanceFor( |
| 27 content::BrowserContext* context) const { | 27 content::BrowserContext* context) const { |
| 28 return new RecommendationRestorer(static_cast<Profile*>(context)); | 28 return new RecommendationRestorer(static_cast<Profile*>(context)); |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool RecommendationRestorerFactory::ServiceIsCreatedWithBrowserContext() const { | 31 bool RecommendationRestorerFactory::ServiceIsCreatedWithBrowserContext() const { |
| 32 return true; | 32 return true; |
| 33 } | 33 } |
| 34 | 34 |
| 35 RecommendationRestorerFactory::RecommendationRestorerFactory() | 35 RecommendationRestorerFactory::RecommendationRestorerFactory() |
| 36 : BrowserContextKeyedServiceFactory( | 36 : BrowserContextKeyedServiceFactory( |
| 37 "RecommendationRestorer", | 37 "RecommendationRestorer", |
| 38 BrowserContextDependencyManager::GetInstance()) { | 38 BrowserContextDependencyManager::GetInstance()) { |
| 39 } | 39 } |
| 40 | 40 |
| 41 RecommendationRestorerFactory::~RecommendationRestorerFactory() { | 41 RecommendationRestorerFactory::~RecommendationRestorerFactory() { |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace policy | 44 } // namespace policy |
| OLD | NEW |