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