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 "chrome/browser/sessions/tab_restore_service_factory.h" | 5 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/sessions/tab_restore_service.h" | 8 #include "chrome/browser/sessions/tab_restore_service.h" |
9 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 9 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
10 | 10 |
11 // static | 11 // static |
12 TabRestoreService* TabRestoreServiceFactory::GetForProfile(Profile* profile) { | 12 TabRestoreService* TabRestoreServiceFactory::GetForProfile(Profile* profile) { |
13 return static_cast<TabRestoreService*>( | 13 return static_cast<TabRestoreService*>( |
14 GetInstance()->GetServiceForProfile(profile, true)); | 14 GetInstance()->GetServiceForBrowserContext(profile, true)); |
15 } | 15 } |
16 | 16 |
17 // static | 17 // static |
18 TabRestoreService* TabRestoreServiceFactory::GetForProfileIfExisting( | 18 TabRestoreService* TabRestoreServiceFactory::GetForProfileIfExisting( |
19 Profile* profile) { | 19 Profile* profile) { |
20 return static_cast<TabRestoreService*>( | 20 return static_cast<TabRestoreService*>( |
21 GetInstance()->GetServiceForProfile(profile, false)); | 21 GetInstance()->GetServiceForBrowserContext(profile, false)); |
22 } | 22 } |
23 | 23 |
24 // static | 24 // static |
25 void TabRestoreServiceFactory::ResetForProfile(Profile* profile) { | 25 void TabRestoreServiceFactory::ResetForProfile(Profile* profile) { |
26 TabRestoreServiceFactory* factory = GetInstance(); | 26 TabRestoreServiceFactory* factory = GetInstance(); |
27 factory->ProfileShutdown(profile); | 27 factory->BrowserContextShutdown(profile); |
28 factory->ProfileDestroyed(profile); | 28 factory->BrowserContextDestroyed(profile); |
29 } | 29 } |
30 | 30 |
31 TabRestoreServiceFactory* TabRestoreServiceFactory::GetInstance() { | 31 TabRestoreServiceFactory* TabRestoreServiceFactory::GetInstance() { |
32 return Singleton<TabRestoreServiceFactory>::get(); | 32 return Singleton<TabRestoreServiceFactory>::get(); |
33 } | 33 } |
34 | 34 |
35 TabRestoreServiceFactory::TabRestoreServiceFactory() | 35 TabRestoreServiceFactory::TabRestoreServiceFactory() |
36 : ProfileKeyedServiceFactory("TabRestoreService", | 36 : BrowserContextKeyedServiceFactory( |
37 ProfileDependencyManager::GetInstance()) { | 37 "TabRestoreService", |
| 38 BrowserContextDependencyManager::GetInstance()) { |
38 } | 39 } |
39 | 40 |
40 TabRestoreServiceFactory::~TabRestoreServiceFactory() { | 41 TabRestoreServiceFactory::~TabRestoreServiceFactory() { |
41 } | 42 } |
42 | 43 |
43 bool TabRestoreServiceFactory::ServiceIsNULLWhileTesting() const { | 44 bool TabRestoreServiceFactory::ServiceIsNULLWhileTesting() const { |
44 return true; | 45 return true; |
45 } | 46 } |
OLD | NEW |