1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_FACTORY_H_
8 #include "base/memory/singleton.h"
9 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
14 class TabRestoreService
;
17 // Singleton that owns all TabRestoreServices and associates them with
18 // Profiles. Listens for the Profile's destruction notification and cleans up
19 // the associated TabRestoreService.
20 class TabRestoreServiceFactory
: public BrowserContextKeyedServiceFactory
{
22 static sessions::TabRestoreService
* GetForProfile(Profile
* profile
);
24 // Variant of GetForProfile() that returns NULL if TabRestoreService does not
26 static sessions::TabRestoreService
* GetForProfileIfExisting(Profile
* profile
);
28 static void ResetForProfile(Profile
* profile
);
30 static TabRestoreServiceFactory
* GetInstance();
33 friend struct base::DefaultSingletonTraits
<TabRestoreServiceFactory
>;
35 TabRestoreServiceFactory();
36 ~TabRestoreServiceFactory() override
;
38 // BrowserContextKeyedServiceFactory:
39 KeyedService
* BuildServiceInstanceFor(
40 content::BrowserContext
* browser_context
) const override
;
41 bool ServiceIsNULLWhileTesting() const override
;
44 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_FACTORY_H_