| 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/session_service_factory.h" | 5 #include "chrome/browser/sessions/session_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/sessions/session_data_deleter.h" | 8 #include "chrome/browser/sessions/session_data_deleter.h" |
| 9 #include "chrome/browser/sessions/session_service.h" | 9 #include "chrome/browser/sessions/session_service.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 factory->GetServiceForBrowserContext(profile, true); | 56 factory->GetServiceForBrowserContext(profile, true); |
| 57 | 57 |
| 58 // Shut down and remove the reference to the session service, and replace it | 58 // Shut down and remove the reference to the session service, and replace it |
| 59 // with an explicit NULL to prevent it being recreated on the next access. | 59 // with an explicit NULL to prevent it being recreated on the next access. |
| 60 factory->BrowserContextShutdown(profile); | 60 factory->BrowserContextShutdown(profile); |
| 61 factory->BrowserContextDestroyed(profile); | 61 factory->BrowserContextDestroyed(profile); |
| 62 factory->Associate(profile, NULL); | 62 factory->Associate(profile, NULL); |
| 63 } | 63 } |
| 64 | 64 |
| 65 SessionServiceFactory* SessionServiceFactory::GetInstance() { | 65 SessionServiceFactory* SessionServiceFactory::GetInstance() { |
| 66 return Singleton<SessionServiceFactory>::get(); | 66 return base::Singleton<SessionServiceFactory>::get(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 SessionServiceFactory::SessionServiceFactory() | 69 SessionServiceFactory::SessionServiceFactory() |
| 70 : BrowserContextKeyedServiceFactory( | 70 : BrowserContextKeyedServiceFactory( |
| 71 "SessionService", | 71 "SessionService", |
| 72 BrowserContextDependencyManager::GetInstance()) { | 72 BrowserContextDependencyManager::GetInstance()) { |
| 73 } | 73 } |
| 74 | 74 |
| 75 SessionServiceFactory::~SessionServiceFactory() { | 75 SessionServiceFactory::~SessionServiceFactory() { |
| 76 } | 76 } |
| 77 | 77 |
| 78 KeyedService* SessionServiceFactory::BuildServiceInstanceFor( | 78 KeyedService* SessionServiceFactory::BuildServiceInstanceFor( |
| 79 content::BrowserContext* profile) const { | 79 content::BrowserContext* profile) const { |
| 80 SessionService* service = NULL; | 80 SessionService* service = NULL; |
| 81 service = new SessionService(static_cast<Profile*>(profile)); | 81 service = new SessionService(static_cast<Profile*>(profile)); |
| 82 service->ResetFromCurrentBrowsers(); | 82 service->ResetFromCurrentBrowsers(); |
| 83 return service; | 83 return service; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool SessionServiceFactory::ServiceIsCreatedWithBrowserContext() const { | 86 bool SessionServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
| 87 return true; | 87 return true; |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool SessionServiceFactory::ServiceIsNULLWhileTesting() const { | 90 bool SessionServiceFactory::ServiceIsNULLWhileTesting() const { |
| 91 return true; | 91 return true; |
| 92 } | 92 } |
| OLD | NEW |