Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: chrome/browser/sessions/tab_restore_service_factory.cc

Issue 1350653004: [sessions] Properly namespace recently-componentized TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #if defined(OS_ANDROID) 11 #if defined(OS_ANDROID)
12 #include "components/sessions/core/in_memory_tab_restore_service.h" 12 #include "components/sessions/core/in_memory_tab_restore_service.h"
13 #else 13 #else
14 #include "components/sessions/core/persistent_tab_restore_service.h" 14 #include "components/sessions/core/persistent_tab_restore_service.h"
15 #endif 15 #endif
16 16
17 // static 17 // static
18 TabRestoreService* TabRestoreServiceFactory::GetForProfile(Profile* profile) { 18 sessions::TabRestoreService* TabRestoreServiceFactory::GetForProfile(
19 return static_cast<TabRestoreService*>( 19 Profile* profile) {
20 return static_cast<sessions::TabRestoreService*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true)); 21 GetInstance()->GetServiceForBrowserContext(profile, true));
21 } 22 }
22 23
23 // static 24 // static
24 TabRestoreService* TabRestoreServiceFactory::GetForProfileIfExisting( 25 sessions::TabRestoreService* TabRestoreServiceFactory::GetForProfileIfExisting(
25 Profile* profile) { 26 Profile* profile) {
26 return static_cast<TabRestoreService*>( 27 return static_cast<sessions::TabRestoreService*>(
27 GetInstance()->GetServiceForBrowserContext(profile, false)); 28 GetInstance()->GetServiceForBrowserContext(profile, false));
28 } 29 }
29 30
30 // static 31 // static
31 void TabRestoreServiceFactory::ResetForProfile(Profile* profile) { 32 void TabRestoreServiceFactory::ResetForProfile(Profile* profile) {
32 TabRestoreServiceFactory* factory = GetInstance(); 33 TabRestoreServiceFactory* factory = GetInstance();
33 factory->BrowserContextShutdown(profile); 34 factory->BrowserContextShutdown(profile);
34 factory->BrowserContextDestroyed(profile); 35 factory->BrowserContextDestroyed(profile);
35 } 36 }
36 37
37 TabRestoreServiceFactory* TabRestoreServiceFactory::GetInstance() { 38 TabRestoreServiceFactory* TabRestoreServiceFactory::GetInstance() {
38 return base::Singleton<TabRestoreServiceFactory>::get(); 39 return base::Singleton<TabRestoreServiceFactory>::get();
39 } 40 }
40 41
41 TabRestoreServiceFactory::TabRestoreServiceFactory() 42 TabRestoreServiceFactory::TabRestoreServiceFactory()
42 : BrowserContextKeyedServiceFactory( 43 : BrowserContextKeyedServiceFactory(
43 "TabRestoreService", 44 "sessions::TabRestoreService",
44 BrowserContextDependencyManager::GetInstance()) { 45 BrowserContextDependencyManager::GetInstance()) {}
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 DCHECK(!profile->IsOffTheRecord()); 57 DCHECK(!profile->IsOffTheRecord());
58 scoped_ptr<sessions::TabRestoreServiceClient> client( 58 scoped_ptr<sessions::TabRestoreServiceClient> client(
59 new ChromeTabRestoreServiceClient(profile)); 59 new ChromeTabRestoreServiceClient(profile));
60 60
61 #if defined(OS_ANDROID) 61 #if defined(OS_ANDROID)
62 return new InMemoryTabRestoreService(client.Pass(), nullptr); 62 return new sessions::InMemoryTabRestoreService(client.Pass(), nullptr);
63 #else 63 #else
64 return new PersistentTabRestoreService(client.Pass(), nullptr); 64 return new sessions::PersistentTabRestoreService(client.Pass(), nullptr);
65 #endif 65 #endif
66 } 66 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/tab_restore_service_factory.h ('k') | chrome/browser/ui/ash/chrome_new_window_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698