Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / sessions / tab_restore_service_factory.cc
blob0cf92c7ae7845ed99d5432286134cf4a0f92aecc
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
3 // found in the LICENSE file.
5 #include "chrome/browser/sessions/tab_restore_service_factory.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sessions/tab_restore_service.h"
9 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
11 // static
12 TabRestoreService* TabRestoreServiceFactory::GetForProfile(Profile* profile) {
13 return static_cast<TabRestoreService*>(
14 GetInstance()->GetServiceForBrowserContext(profile, true));
17 // static
18 TabRestoreService* TabRestoreServiceFactory::GetForProfileIfExisting(
19 Profile* profile) {
20 return static_cast<TabRestoreService*>(
21 GetInstance()->GetServiceForBrowserContext(profile, false));
24 // static
25 void TabRestoreServiceFactory::ResetForProfile(Profile* profile) {
26 TabRestoreServiceFactory* factory = GetInstance();
27 factory->BrowserContextShutdown(profile);
28 factory->BrowserContextDestroyed(profile);
31 TabRestoreServiceFactory* TabRestoreServiceFactory::GetInstance() {
32 return Singleton<TabRestoreServiceFactory>::get();
35 TabRestoreServiceFactory::TabRestoreServiceFactory()
36 : BrowserContextKeyedServiceFactory(
37 "TabRestoreService",
38 BrowserContextDependencyManager::GetInstance()) {
41 TabRestoreServiceFactory::~TabRestoreServiceFactory() {
44 bool TabRestoreServiceFactory::ServiceIsNULLWhileTesting() const {
45 return true;