| 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 CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ | 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "chrome/browser/ui/host_desktop.h" | |
| 15 #include "components/keyed_service/core/keyed_service.h" | 14 #include "components/keyed_service/core/keyed_service.h" |
| 16 #include "components/sessions/serialized_navigation_entry.h" | 15 #include "components/sessions/serialized_navigation_entry.h" |
| 17 #include "components/sessions/session_id.h" | 16 #include "components/sessions/session_id.h" |
| 18 #include "components/sessions/session_types.h" | 17 #include "components/sessions/session_types.h" |
| 19 #include "content/public/browser/session_storage_namespace.h" | 18 #include "content/public/browser/session_storage_namespace.h" |
| 20 #include "ui/base/window_open_disposition.h" | 19 #include "ui/base/window_open_disposition.h" |
| 21 | 20 |
| 22 class TabRestoreServiceDelegate; | 21 class TabRestoreServiceDelegate; |
| 23 class TabRestoreServiceObserver; | 22 class TabRestoreServiceObserver; |
| 24 | 23 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Removes all entries from the list and notifies observers the list | 146 // Removes all entries from the list and notifies observers the list |
| 148 // of tabs has changed. | 147 // of tabs has changed. |
| 149 virtual void ClearEntries() = 0; | 148 virtual void ClearEntries() = 0; |
| 150 | 149 |
| 151 // Returns the entries, ordered with most recently closed entries at the | 150 // Returns the entries, ordered with most recently closed entries at the |
| 152 // front. | 151 // front. |
| 153 virtual const Entries& entries() const = 0; | 152 virtual const Entries& entries() const = 0; |
| 154 | 153 |
| 155 // Restores the most recently closed entry. Does nothing if there are no | 154 // Restores the most recently closed entry. Does nothing if there are no |
| 156 // entries to restore. If the most recently restored entry is a tab, it is | 155 // entries to restore. If the most recently restored entry is a tab, it is |
| 157 // added to |delegate|. If a new browser needs to be created for this entry, | 156 // added to |delegate|. |host_desktop_type| is a value that is opaque to this |
| 158 // it will be created on the desktop specified by |host_desktop_type|. Returns | 157 // class and will be used only to pass back to the embedder via |
| 159 // the WebContents of the restored tab(s). | 158 // TabRestoreServiceClient if necessary. Returns the WebContents of the |
| 159 // restored tab(s). |
| 160 virtual std::vector<content::WebContents*> RestoreMostRecentEntry( | 160 virtual std::vector<content::WebContents*> RestoreMostRecentEntry( |
| 161 TabRestoreServiceDelegate* delegate, | 161 TabRestoreServiceDelegate* delegate, |
| 162 chrome::HostDesktopType host_desktop_type) = 0; | 162 int host_desktop_type) = 0; |
| 163 | 163 |
| 164 // Removes the Tab with id |id| from the list and returns it; ownership is | 164 // Removes the Tab with id |id| from the list and returns it; ownership is |
| 165 // passed to the caller. | 165 // passed to the caller. |
| 166 virtual Tab* RemoveTabEntryById(SessionID::id_type id) = 0; | 166 virtual Tab* RemoveTabEntryById(SessionID::id_type id) = 0; |
| 167 | 167 |
| 168 // Restores an entry by id. If there is no entry with an id matching |id|, | 168 // Restores an entry by id. If there is no entry with an id matching |id|, |
| 169 // this does nothing. If |delegate| is NULL, this creates a new window for the | 169 // this does nothing. If |delegate| is NULL, this creates a new window for the |
| 170 // entry. |disposition| is respected, but the attributes (tabstrip index, | 170 // entry. |disposition| is respected, but the attributes (tabstrip index, |
| 171 // browser window) of the tab when it was closed will be respected if | 171 // browser window) of the tab when it was closed will be respected if |
| 172 // disposition is UNKNOWN. If a new browser needs to be created for this | 172 // disposition is UNKNOWN. |host_desktop_type| is a value that is opaque to |
| 173 // entry, it will be created on the desktop specified by |host_desktop_type|. | 173 // this class and will be used only to pass back to the embedder via |
| 174 // Returns the WebContents of the restored tab(s). | 174 // TabRestoreServiceClient if necessary. Returns the WebContents of the |
| 175 // restored tab(s). |
| 175 virtual std::vector<content::WebContents*> RestoreEntryById( | 176 virtual std::vector<content::WebContents*> RestoreEntryById( |
| 176 TabRestoreServiceDelegate* delegate, | 177 TabRestoreServiceDelegate* delegate, |
| 177 SessionID::id_type id, | 178 SessionID::id_type id, |
| 178 chrome::HostDesktopType host_desktop_type, | 179 int host_desktop_type, |
| 179 WindowOpenDisposition disposition) = 0; | 180 WindowOpenDisposition disposition) = 0; |
| 180 | 181 |
| 181 // Loads the tabs and previous session. This does nothing if the tabs | 182 // Loads the tabs and previous session. This does nothing if the tabs |
| 182 // from the previous session have already been loaded. | 183 // from the previous session have already been loaded. |
| 183 virtual void LoadTabsFromLastSession() = 0; | 184 virtual void LoadTabsFromLastSession() = 0; |
| 184 | 185 |
| 185 // Returns true if the tab entries have been loaded. | 186 // Returns true if the tab entries have been loaded. |
| 186 virtual bool IsLoaded() const = 0; | 187 virtual bool IsLoaded() const = 0; |
| 187 | 188 |
| 188 // Deletes the last session. | 189 // Deletes the last session. |
| 189 virtual void DeleteLastSession() = 0; | 190 virtual void DeleteLastSession() = 0; |
| 190 }; | 191 }; |
| 191 | 192 |
| 192 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ | 193 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ |
| OLD | NEW |