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 COMPONENTS_SESSIONS_CORE_IN_MEMORY_TAB_RESTORE_SERVICE_H_ | 5 #ifndef COMPONENTS_SESSIONS_CORE_IN_MEMORY_TAB_RESTORE_SERVICE_H_ |
6 #define COMPONENTS_SESSIONS_CORE_IN_MEMORY_TAB_RESTORE_SERVICE_H_ | 6 #define COMPONENTS_SESSIONS_CORE_IN_MEMORY_TAB_RESTORE_SERVICE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "components/sessions/core/tab_restore_service.h" | 11 #include "components/sessions/core/tab_restore_service.h" |
12 #include "components/sessions/core/tab_restore_service_client.h" | 12 #include "components/sessions/core/tab_restore_service_client.h" |
13 #include "components/sessions/core/tab_restore_service_helper.h" | 13 #include "components/sessions/core/tab_restore_service_helper.h" |
14 #include "components/sessions/sessions_export.h" | 14 #include "components/sessions/sessions_export.h" |
15 | 15 |
16 namespace sessions { | 16 namespace sessions { |
| 17 |
17 class TabRestoreServiceClient; | 18 class TabRestoreServiceClient; |
18 } | |
19 | 19 |
20 // Tab restore service that doesn't persist tabs on disk. This is used on | 20 // Tab restore service that doesn't persist tabs on disk. This is used on |
21 // Android where tabs persistence is implemented on the application side in | 21 // Android where tabs persistence is implemented on the application side in |
22 // Java. Other platforms should use PersistentTabRestoreService which can be | 22 // Java. Other platforms should use PersistentTabRestoreService which can be |
23 // instantiated through the TabRestoreServiceFactory. | 23 // instantiated through the TabRestoreServiceFactory. |
24 class SESSIONS_EXPORT InMemoryTabRestoreService : public TabRestoreService { | 24 class SESSIONS_EXPORT InMemoryTabRestoreService : public TabRestoreService { |
25 public: | 25 public: |
26 // Creates a new TabRestoreService and provides an object that provides the | 26 // Creates a new TabRestoreService and provides an object that provides the |
27 // current time. The TabRestoreService does not take ownership of | 27 // current time. The TabRestoreService does not take ownership of |
28 // |time_factory|. | 28 // |time_factory|. |
29 InMemoryTabRestoreService( | 29 InMemoryTabRestoreService(scoped_ptr<TabRestoreServiceClient> client, |
30 scoped_ptr<sessions::TabRestoreServiceClient> client, | 30 TimeFactory* time_factory); |
31 TimeFactory* time_factory); | |
32 | 31 |
33 ~InMemoryTabRestoreService() override; | 32 ~InMemoryTabRestoreService() override; |
34 | 33 |
35 // TabRestoreService: | 34 // TabRestoreService: |
36 void AddObserver(TabRestoreServiceObserver* observer) override; | 35 void AddObserver(TabRestoreServiceObserver* observer) override; |
37 void RemoveObserver(TabRestoreServiceObserver* observer) override; | 36 void RemoveObserver(TabRestoreServiceObserver* observer) override; |
38 void CreateHistoricalTab(sessions::LiveTab* live_tab, int index) override; | 37 void CreateHistoricalTab(LiveTab* live_tab, int index) override; |
39 void BrowserClosing(TabRestoreServiceDelegate* delegate) override; | 38 void BrowserClosing(TabRestoreServiceDelegate* delegate) override; |
40 void BrowserClosed(TabRestoreServiceDelegate* delegate) override; | 39 void BrowserClosed(TabRestoreServiceDelegate* delegate) override; |
41 void ClearEntries() override; | 40 void ClearEntries() override; |
42 const Entries& entries() const override; | 41 const Entries& entries() const override; |
43 std::vector<sessions::LiveTab*> RestoreMostRecentEntry( | 42 std::vector<LiveTab*> RestoreMostRecentEntry( |
44 TabRestoreServiceDelegate* delegate, | 43 TabRestoreServiceDelegate* delegate, |
45 int host_desktop_type) override; | 44 int host_desktop_type) override; |
46 Tab* RemoveTabEntryById(SessionID::id_type id) override; | 45 Tab* RemoveTabEntryById(SessionID::id_type id) override; |
47 std::vector<sessions::LiveTab*> RestoreEntryById( | 46 std::vector<LiveTab*> RestoreEntryById( |
48 TabRestoreServiceDelegate* delegate, | 47 TabRestoreServiceDelegate* delegate, |
49 SessionID::id_type id, | 48 SessionID::id_type id, |
50 int host_desktop_type, | 49 int host_desktop_type, |
51 WindowOpenDisposition disposition) override; | 50 WindowOpenDisposition disposition) override; |
52 void LoadTabsFromLastSession() override; | 51 void LoadTabsFromLastSession() override; |
53 bool IsLoaded() const override; | 52 bool IsLoaded() const override; |
54 void DeleteLastSession() override; | 53 void DeleteLastSession() override; |
55 void Shutdown() override; | 54 void Shutdown() override; |
56 | 55 |
57 private: | 56 private: |
58 scoped_ptr<sessions::TabRestoreServiceClient> client_; | 57 scoped_ptr<TabRestoreServiceClient> client_; |
59 TabRestoreServiceHelper helper_; | 58 TabRestoreServiceHelper helper_; |
60 | 59 |
61 DISALLOW_COPY_AND_ASSIGN(InMemoryTabRestoreService); | 60 DISALLOW_COPY_AND_ASSIGN(InMemoryTabRestoreService); |
62 }; | 61 }; |
63 | 62 |
| 63 } // namespace sessions |
| 64 |
64 #endif // COMPONENTS_SESSIONS_CORE_IN_MEMORY_TAB_RESTORE_SERVICE_H_ | 65 #endif // COMPONENTS_SESSIONS_CORE_IN_MEMORY_TAB_RESTORE_SERVICE_H_ |
OLD | NEW |