| 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 "components/keyed_service/core/keyed_service.h" | 14 #include "components/keyed_service/core/keyed_service.h" | 
|  | 15 #include "components/sessions/core/tab_restore_service_client.h" | 
| 15 #include "components/sessions/serialized_navigation_entry.h" | 16 #include "components/sessions/serialized_navigation_entry.h" | 
| 16 #include "components/sessions/session_id.h" | 17 #include "components/sessions/session_id.h" | 
| 17 #include "components/sessions/session_types.h" | 18 #include "components/sessions/session_types.h" | 
| 18 #include "content/public/browser/session_storage_namespace.h" |  | 
| 19 #include "ui/base/window_open_disposition.h" | 19 #include "ui/base/window_open_disposition.h" | 
| 20 | 20 | 
| 21 class TabRestoreServiceDelegate; | 21 class TabRestoreServiceDelegate; | 
| 22 class TabRestoreServiceObserver; | 22 class TabRestoreServiceObserver; | 
| 23 | 23 | 
| 24 namespace content { | 24 namespace content { | 
| 25 class SessionStorageNamespace; |  | 
| 26 class WebContents; | 25 class WebContents; | 
| 27 } | 26 } | 
| 28 | 27 | 
| 29 // TabRestoreService is responsible for maintaining the most recently closed | 28 // TabRestoreService is responsible for maintaining the most recently closed | 
| 30 // tabs and windows. When a tab is closed | 29 // tabs and windows. When a tab is closed | 
| 31 // TabRestoreService::CreateHistoricalTab is invoked and a Tab is created to | 30 // TabRestoreService::CreateHistoricalTab is invoked and a Tab is created to | 
| 32 // represent the tab. Similarly, when a browser is closed, BrowserClosing is | 31 // represent the tab. Similarly, when a browser is closed, BrowserClosing is | 
| 33 // invoked and a Window is created to represent the window. | 32 // invoked and a Window is created to represent the window. | 
| 34 // | 33 // | 
| 35 // To restore a tab/window from the TabRestoreService invoke RestoreEntryById | 34 // To restore a tab/window from the TabRestoreService invoke RestoreEntryById | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 92 | 91 | 
| 93     // Index within the tab strip. May be -1 for an unknown index. | 92     // Index within the tab strip. May be -1 for an unknown index. | 
| 94     int tabstrip_index; | 93     int tabstrip_index; | 
| 95 | 94 | 
| 96     // True if the tab was pinned. | 95     // True if the tab was pinned. | 
| 97     bool pinned; | 96     bool pinned; | 
| 98 | 97 | 
| 99     // If non-empty gives the id of the extension for the tab. | 98     // If non-empty gives the id of the extension for the tab. | 
| 100     std::string extension_app_id; | 99     std::string extension_app_id; | 
| 101 | 100 | 
| 102     // The associated session storage namespace (if any). | 101     // The associated client data. | 
| 103     scoped_refptr<content::SessionStorageNamespace> session_storage_namespace; | 102     scoped_refptr<sessions::TabClientData> client_data; | 
| 104 | 103 | 
| 105     // The user agent override used for the tab's navigations (if applicable). | 104     // The user agent override used for the tab's navigations (if applicable). | 
| 106     std::string user_agent_override; | 105     std::string user_agent_override; | 
| 107   }; | 106   }; | 
| 108 | 107 | 
| 109   // Represents a previously open window. | 108   // Represents a previously open window. | 
| 110   struct Window : public Entry { | 109   struct Window : public Entry { | 
| 111     Window(); | 110     Window(); | 
| 112     ~Window() override; | 111     ~Window() override; | 
| 113 | 112 | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 184   virtual void LoadTabsFromLastSession() = 0; | 183   virtual void LoadTabsFromLastSession() = 0; | 
| 185 | 184 | 
| 186   // Returns true if the tab entries have been loaded. | 185   // Returns true if the tab entries have been loaded. | 
| 187   virtual bool IsLoaded() const = 0; | 186   virtual bool IsLoaded() const = 0; | 
| 188 | 187 | 
| 189   // Deletes the last session. | 188   // Deletes the last session. | 
| 190   virtual void DeleteLastSession() = 0; | 189   virtual void DeleteLastSession() = 0; | 
| 191 }; | 190 }; | 
| 192 | 191 | 
| 193 #endif  // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ | 192 #endif  // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ | 
| OLD | NEW | 
|---|