OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_TAB_RESTORE_SERVICE_HELPER_H_ | 5 #ifndef COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_HELPER_H_ |
6 #define COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_HELPER_H_ | 6 #define COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_HELPER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 ~TabRestoreServiceHelper(); | 70 ~TabRestoreServiceHelper(); |
71 | 71 |
72 // Helper methods used to implement TabRestoreService. | 72 // Helper methods used to implement TabRestoreService. |
73 void AddObserver(TabRestoreServiceObserver* observer); | 73 void AddObserver(TabRestoreServiceObserver* observer); |
74 void RemoveObserver(TabRestoreServiceObserver* observer); | 74 void RemoveObserver(TabRestoreServiceObserver* observer); |
75 void CreateHistoricalTab(LiveTab* live_tab, int index); | 75 void CreateHistoricalTab(LiveTab* live_tab, int index); |
76 void BrowserClosing(LiveTabContext* context); | 76 void BrowserClosing(LiveTabContext* context); |
77 void BrowserClosed(LiveTabContext* context); | 77 void BrowserClosed(LiveTabContext* context); |
78 void ClearEntries(); | 78 void ClearEntries(); |
79 const Entries& entries() const; | 79 const Entries& entries() const; |
80 std::vector<LiveTab*> RestoreMostRecentEntry(LiveTabContext* context, | 80 std::vector<LiveTab*> RestoreMostRecentEntry(LiveTabContext* context); |
81 int host_desktop_type); | |
82 Tab* RemoveTabEntryById(SessionID::id_type id); | 81 Tab* RemoveTabEntryById(SessionID::id_type id); |
83 std::vector<LiveTab*> RestoreEntryById(LiveTabContext* context, | 82 std::vector<LiveTab*> RestoreEntryById(LiveTabContext* context, |
84 SessionID::id_type id, | 83 SessionID::id_type id, |
85 int host_desktop_type, | |
86 WindowOpenDisposition disposition); | 84 WindowOpenDisposition disposition); |
87 | 85 |
88 // Notifies observers the tabs have changed. | 86 // Notifies observers the tabs have changed. |
89 void NotifyTabsChanged(); | 87 void NotifyTabsChanged(); |
90 | 88 |
91 // Notifies observers the service has loaded. | 89 // Notifies observers the service has loaded. |
92 void NotifyLoaded(); | 90 void NotifyLoaded(); |
93 | 91 |
94 // Adds |entry| to the list of entries and takes ownership. If |prune| is true | 92 // Adds |entry| to the list of entries and takes ownership. If |prune| is true |
95 // |PruneAndNotify| is invoked. If |to_front| is true the entry is added to | 93 // |PruneAndNotify| is invoked. If |to_front| is true the entry is added to |
(...skipping 19 matching lines...) Expand all Loading... |
115 | 113 |
116 // Populates the tab's navigations from the LiveTab, and its browser_id and | 114 // Populates the tab's navigations from the LiveTab, and its browser_id and |
117 // pinned state from the context. | 115 // pinned state from the context. |
118 void PopulateTab(Tab* tab, | 116 void PopulateTab(Tab* tab, |
119 int index, | 117 int index, |
120 LiveTabContext* context, | 118 LiveTabContext* context, |
121 LiveTab* live_tab); | 119 LiveTab* live_tab); |
122 | 120 |
123 // This is a helper function for RestoreEntryById() for restoring a single | 121 // This is a helper function for RestoreEntryById() for restoring a single |
124 // tab. If |context| is NULL, this creates a new window for the entry. This | 122 // tab. If |context| is NULL, this creates a new window for the entry. This |
125 // returns the LiveTabContext into which the tab was restored. | 123 // returns the LiveTabContext into which the tab was restored. |disposition| |
126 // |disposition| will be respected, but if it is UNKNOWN then the tab's | 124 // will be respected, but if it is UNKNOWN then the tab's original attributes |
127 // original attributes will be respected instead. If a new | 125 // will be respected instead. If a new LiveTabContext needs to be created for |
128 // LiveTabContext needs to be created for this tab, | 126 // this tab, If present, |live_tab| will be populated with the LiveTab of the |
129 // |host_desktop_type| will be passed to | 127 // restored tab. |
130 // TabRestoreServiceClient::CreateLiveTabContext(). If present, | |
131 // |live_tab| will be populated with the LiveTab of the restored tab. | |
132 LiveTabContext* RestoreTab(const Tab& tab, | 128 LiveTabContext* RestoreTab(const Tab& tab, |
133 LiveTabContext* context, | 129 LiveTabContext* context, |
134 int host_desktop_type, | |
135 WindowOpenDisposition disposition, | 130 WindowOpenDisposition disposition, |
136 LiveTab** live_tab); | 131 LiveTab** live_tab); |
137 | 132 |
138 // Returns true if |tab| has more than one navigation. If |tab| has more | 133 // Returns true if |tab| has more than one navigation. If |tab| has more |
139 // than one navigation |tab->current_navigation_index| is constrained based | 134 // than one navigation |tab->current_navigation_index| is constrained based |
140 // on the number of navigations. | 135 // on the number of navigations. |
141 static bool ValidateTab(Tab* tab); | 136 static bool ValidateTab(Tab* tab); |
142 | 137 |
143 // Validates all the tabs in a window, plus the window's active tab index. | 138 // Validates all the tabs in a window, plus the window's active tab index. |
144 static bool ValidateWindow(Window* window); | 139 static bool ValidateWindow(Window* window); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 std::set<LiveTabContext*> closing_contexts_; | 176 std::set<LiveTabContext*> closing_contexts_; |
182 | 177 |
183 TimeFactory* const time_factory_; | 178 TimeFactory* const time_factory_; |
184 | 179 |
185 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper); | 180 DISALLOW_COPY_AND_ASSIGN(TabRestoreServiceHelper); |
186 }; | 181 }; |
187 | 182 |
188 } // namespace sessions | 183 } // namespace sessions |
189 | 184 |
190 #endif // COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_HELPER_H_ | 185 #endif // COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_HELPER_H_ |
OLD | NEW |