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 #ifndef CHROME_BROWSER_SESSIONS_IN_MEMORY_TAB_RESTORE_SERVICE_H_
6 #define CHROME_BROWSER_SESSIONS_IN_MEMORY_TAB_RESTORE_SERVICE_H_
10 #include "chrome/browser/sessions/tab_restore_service.h"
11 #include "chrome/browser/sessions/tab_restore_service_helper.h"
13 // Tab restore service that doesn't persist tabs on disk. This is used on
14 // Android where tabs persistence is implemented on the application side in
15 // Java. Other platforms should use PersistentTabRestoreService which can be
16 // instantiated through the TabRestoreServiceFactory.
17 class InMemoryTabRestoreService
: public TabRestoreService
{
19 // Creates a new TabRestoreService and provides an object that provides the
20 // current time. The TabRestoreService does not take ownership of
22 InMemoryTabRestoreService(Profile
* profile
,
23 TimeFactory
* time_factory
);
25 ~InMemoryTabRestoreService() override
;
28 void AddObserver(TabRestoreServiceObserver
* observer
) override
;
29 void RemoveObserver(TabRestoreServiceObserver
* observer
) override
;
30 void CreateHistoricalTab(content::WebContents
* contents
, int index
) override
;
31 void BrowserClosing(TabRestoreServiceDelegate
* delegate
) override
;
32 void BrowserClosed(TabRestoreServiceDelegate
* delegate
) override
;
33 void ClearEntries() override
;
34 const Entries
& entries() const override
;
35 std::vector
<content::WebContents
*> RestoreMostRecentEntry(
36 TabRestoreServiceDelegate
* delegate
,
37 chrome::HostDesktopType host_desktop_type
) override
;
38 Tab
* RemoveTabEntryById(SessionID::id_type id
) override
;
39 std::vector
<content::WebContents
*> RestoreEntryById(
40 TabRestoreServiceDelegate
* delegate
,
41 SessionID::id_type id
,
42 chrome::HostDesktopType host_desktop_type
,
43 WindowOpenDisposition disposition
) override
;
44 void LoadTabsFromLastSession() override
;
45 bool IsLoaded() const override
;
46 void DeleteLastSession() override
;
47 void Shutdown() override
;
50 TabRestoreServiceHelper helper_
;
52 DISALLOW_COPY_AND_ASSIGN(InMemoryTabRestoreService
);
55 #endif // CHROME_BROWSER_SESSIONS_IN_MEMORY_TAB_RESTORE_SERVICE_H_