| 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/chrome_tab_restore_service_client.h" | 8 #include "chrome/browser/sessions/chrome_tab_restore_service_client.h" |
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 void TabRestoreServiceFactory::ResetForProfile(Profile* profile) { | 31 void TabRestoreServiceFactory::ResetForProfile(Profile* profile) { |
| 32 TabRestoreServiceFactory* factory = GetInstance(); | 32 TabRestoreServiceFactory* factory = GetInstance(); |
| 33 factory->BrowserContextShutdown(profile); | 33 factory->BrowserContextShutdown(profile); |
| 34 factory->BrowserContextDestroyed(profile); | 34 factory->BrowserContextDestroyed(profile); |
| 35 } | 35 } |
| 36 | 36 |
| 37 TabRestoreServiceFactory* TabRestoreServiceFactory::GetInstance() { | 37 TabRestoreServiceFactory* TabRestoreServiceFactory::GetInstance() { |
| 38 return Singleton<TabRestoreServiceFactory>::get(); | 38 return base::Singleton<TabRestoreServiceFactory>::get(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 TabRestoreServiceFactory::TabRestoreServiceFactory() | 41 TabRestoreServiceFactory::TabRestoreServiceFactory() |
| 42 : BrowserContextKeyedServiceFactory( | 42 : BrowserContextKeyedServiceFactory( |
| 43 "TabRestoreService", | 43 "TabRestoreService", |
| 44 BrowserContextDependencyManager::GetInstance()) { | 44 BrowserContextDependencyManager::GetInstance()) { |
| 45 } | 45 } |
| 46 | 46 |
| 47 TabRestoreServiceFactory::~TabRestoreServiceFactory() { | 47 TabRestoreServiceFactory::~TabRestoreServiceFactory() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool TabRestoreServiceFactory::ServiceIsNULLWhileTesting() const { | 50 bool TabRestoreServiceFactory::ServiceIsNULLWhileTesting() const { |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 KeyedService* TabRestoreServiceFactory::BuildServiceInstanceFor( | 54 KeyedService* TabRestoreServiceFactory::BuildServiceInstanceFor( |
| 55 content::BrowserContext* browser_context) const { | 55 content::BrowserContext* browser_context) const { |
| 56 Profile* profile = Profile::FromBrowserContext(browser_context); | 56 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 57 scoped_ptr<sessions::TabRestoreServiceClient> client( | 57 scoped_ptr<sessions::TabRestoreServiceClient> client( |
| 58 new ChromeTabRestoreServiceClient(profile)); | 58 new ChromeTabRestoreServiceClient(profile)); |
| 59 | 59 |
| 60 #if defined(OS_ANDROID) | 60 #if defined(OS_ANDROID) |
| 61 return new InMemoryTabRestoreService(profile, nullptr); | 61 return new InMemoryTabRestoreService(profile, nullptr); |
| 62 #else | 62 #else |
| 63 return new PersistentTabRestoreService(profile, client.Pass(), nullptr); | 63 return new PersistentTabRestoreService(profile, client.Pass(), nullptr); |
| 64 #endif | 64 #endif |
| 65 } | 65 } |
| OLD | NEW |