| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "apps/app_restore_service_factory.h" | 5 #include "apps/app_restore_service_factory.h" |
| 6 | 6 |
| 7 #include "apps/app_restore_service.h" | 7 #include "apps/app_restore_service.h" |
| 8 #include "chrome/browser/extensions/shell_window_registry.h" | 8 #include "chrome/browser/extensions/shell_window_registry.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 11 | 11 |
| 12 namespace apps { | 12 namespace apps { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 AppRestoreService* AppRestoreServiceFactory::GetForProfile(Profile* profile) { | 15 AppRestoreService* AppRestoreServiceFactory::GetForProfile(Profile* profile) { |
| 16 return static_cast<AppRestoreService*>( | 16 return static_cast<AppRestoreService*>( |
| 17 GetInstance()->GetServiceForProfile(profile, true)); | 17 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 18 } | 18 } |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 void AppRestoreServiceFactory::ResetForProfile(Profile* profile) { | 21 void AppRestoreServiceFactory::ResetForProfile(Profile* profile) { |
| 22 AppRestoreServiceFactory* factory = GetInstance(); | 22 AppRestoreServiceFactory* factory = GetInstance(); |
| 23 factory->ProfileShutdown(profile); | 23 factory->BrowserContextShutdown(profile); |
| 24 factory->ProfileDestroyed(profile); | 24 factory->BrowserContextDestroyed(profile); |
| 25 } | 25 } |
| 26 | 26 |
| 27 AppRestoreServiceFactory* AppRestoreServiceFactory::GetInstance() { | 27 AppRestoreServiceFactory* AppRestoreServiceFactory::GetInstance() { |
| 28 return Singleton<AppRestoreServiceFactory>::get(); | 28 return Singleton<AppRestoreServiceFactory>::get(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 AppRestoreServiceFactory::AppRestoreServiceFactory() | 31 AppRestoreServiceFactory::AppRestoreServiceFactory() |
| 32 : ProfileKeyedServiceFactory("AppRestoreService", | 32 : BrowserContextKeyedServiceFactory( |
| 33 ProfileDependencyManager::GetInstance()) { | 33 "AppRestoreService", |
| 34 BrowserContextDependencyManager::GetInstance()) { |
| 34 DependsOn(extensions::ShellWindowRegistry::Factory::GetInstance()); | 35 DependsOn(extensions::ShellWindowRegistry::Factory::GetInstance()); |
| 35 } | 36 } |
| 36 | 37 |
| 37 AppRestoreServiceFactory::~AppRestoreServiceFactory() { | 38 AppRestoreServiceFactory::~AppRestoreServiceFactory() { |
| 38 } | 39 } |
| 39 | 40 |
| 40 ProfileKeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor( | 41 BrowserContextKeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor( |
| 41 content::BrowserContext* profile) const { | 42 content::BrowserContext* profile) const { |
| 42 return new AppRestoreService(static_cast<Profile*>(profile)); | 43 return new AppRestoreService(static_cast<Profile*>(profile)); |
| 43 } | 44 } |
| 44 | 45 |
| 45 bool AppRestoreServiceFactory::ServiceIsCreatedWithProfile() const { | 46 bool AppRestoreServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
| 46 return true; | 47 return true; |
| 47 } | 48 } |
| 48 | 49 |
| 49 } // namespace apps | 50 } // namespace apps |
| OLD | NEW |