Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / sessions / persistent_tab_restore_service.h
blob08b2a69d9d82847baa8d7cf3384dc73343a1330c
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_PERSISTENT_TAB_RESTORE_SERVICE_H_
6 #define CHROME_BROWSER_SESSIONS_PERSISTENT_TAB_RESTORE_SERVICE_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/sessions/tab_restore_service.h"
14 #include "chrome/browser/sessions/tab_restore_service_helper.h"
16 class Profile;
18 // Tab restore service that persists data on disk.
19 class PersistentTabRestoreService : public TabRestoreService {
20 public:
21 // Does not take ownership of |time_factory|.
22 PersistentTabRestoreService(Profile* profile,
23 TimeFactory* time_factory);
25 virtual ~PersistentTabRestoreService();
27 // TabRestoreService:
28 virtual void AddObserver(TabRestoreServiceObserver* observer) OVERRIDE;
29 virtual void RemoveObserver(TabRestoreServiceObserver* observer) OVERRIDE;
30 virtual void CreateHistoricalTab(content::WebContents* contents,
31 int index) OVERRIDE;
32 virtual void BrowserClosing(TabRestoreServiceDelegate* delegate) OVERRIDE;
33 virtual void BrowserClosed(TabRestoreServiceDelegate* delegate) OVERRIDE;
34 virtual void ClearEntries() OVERRIDE;
35 virtual const Entries& entries() const OVERRIDE;
36 virtual std::vector<content::WebContents*> RestoreMostRecentEntry(
37 TabRestoreServiceDelegate* delegate,
38 chrome::HostDesktopType host_desktop_type) OVERRIDE;
39 virtual Tab* RemoveTabEntryById(SessionID::id_type id) OVERRIDE;
40 virtual std::vector<content::WebContents*> RestoreEntryById(
41 TabRestoreServiceDelegate* delegate,
42 SessionID::id_type id,
43 chrome::HostDesktopType host_desktop_type,
44 WindowOpenDisposition disposition) OVERRIDE;
45 virtual void LoadTabsFromLastSession() OVERRIDE;
46 virtual bool IsLoaded() const OVERRIDE;
47 virtual void DeleteLastSession() OVERRIDE;
48 virtual void Shutdown() OVERRIDE;
50 private:
51 friend class PersistentTabRestoreServiceTest;
53 class Delegate;
55 // Exposed for testing.
56 Entries* mutable_entries();
57 void PruneEntries();
59 scoped_ptr<Delegate> delegate_;
60 TabRestoreServiceHelper helper_;
62 DISALLOW_COPY_AND_ASSIGN(PersistentTabRestoreService);
65 #endif // CHROME_BROWSER_SESSIONS_PERSISTENT_TAB_RESTORE_SERVICE_H_