| 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_TAB_RESTORE_SERVICE_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ | 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "components/sessions/session_id.h" | 11 #include "components/sessions/session_id.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class NavigationController; | 14 class NavigationController; |
| 15 class SessionStorageNamespace; | |
| 16 class WebContents; | 15 class WebContents; |
| 17 } | 16 } |
| 18 | 17 |
| 19 namespace sessions { | 18 namespace sessions { |
| 20 class SerializedNavigationEntry; | 19 class SerializedNavigationEntry; |
| 20 class TabClientData; |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Objects implement this interface to provide necessary functionality for | 23 // Objects implement this interface to provide necessary functionality for |
| 24 // TabRestoreService to operate. These methods are mostly copies of existing | 24 // TabRestoreService to operate. These methods are mostly copies of existing |
| 25 // Browser methods. | 25 // Browser methods. |
| 26 class TabRestoreServiceDelegate { | 26 class TabRestoreServiceDelegate { |
| 27 public: | 27 public: |
| 28 // see BrowserWindow::Show() | 28 // see BrowserWindow::Show() |
| 29 virtual void ShowBrowserWindow() = 0; | 29 virtual void ShowBrowserWindow() = 0; |
| 30 | 30 |
| 31 // see Browser::session_id() | 31 // see Browser::session_id() |
| 32 virtual const SessionID& GetSessionID() const = 0; | 32 virtual const SessionID& GetSessionID() const = 0; |
| 33 | 33 |
| 34 // see Browser::tab_count() | 34 // see Browser::tab_count() |
| 35 virtual int GetTabCount() const = 0; | 35 virtual int GetTabCount() const = 0; |
| 36 | 36 |
| 37 // see Browser::active_index() | 37 // see Browser::active_index() |
| 38 virtual int GetSelectedIndex() const = 0; | 38 virtual int GetSelectedIndex() const = 0; |
| 39 | 39 |
| 40 // see Browser::app_name() | 40 // see Browser::app_name() |
| 41 virtual std::string GetAppName() const = 0; | 41 virtual std::string GetAppName() const = 0; |
| 42 | 42 |
| 43 // see Browser methods with the same names | 43 // see Browser methods with the same names |
| 44 virtual content::WebContents* GetWebContentsAt(int index) const = 0; | 44 virtual content::WebContents* GetWebContentsAt(int index) const = 0; |
| 45 virtual content::WebContents* GetActiveWebContents() const = 0; | 45 virtual content::WebContents* GetActiveWebContents() const = 0; |
| 46 virtual bool IsTabPinned(int index) const = 0; | 46 virtual bool IsTabPinned(int index) const = 0; |
| 47 |
| 48 // Note: |tab_client_data| may be null (e.g., if |from_last_session| is true, |
| 49 // as the tab client data is not persisted, or if the embedder did not supply |
| 50 // client data for the tab in question). |
| 47 virtual content::WebContents* AddRestoredTab( | 51 virtual content::WebContents* AddRestoredTab( |
| 48 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 52 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 49 int tab_index, | 53 int tab_index, |
| 50 int selected_navigation, | 54 int selected_navigation, |
| 51 const std::string& extension_app_id, | 55 const std::string& extension_app_id, |
| 52 bool select, | 56 bool select, |
| 53 bool pin, | 57 bool pin, |
| 54 bool from_last_session, | 58 bool from_last_session, |
| 55 content::SessionStorageNamespace* storage_namespace, | 59 const sessions::TabClientData* tab_client_data, |
| 56 const std::string& user_agent_override) = 0; | 60 const std::string& user_agent_override) = 0; |
| 61 |
| 62 // Note: |tab_client_data| may be null (e.g., if |from_last_session| is true, |
| 63 // as the tab client data is not persisted, or if the embedder did not supply |
| 57 virtual content::WebContents* ReplaceRestoredTab( | 64 virtual content::WebContents* ReplaceRestoredTab( |
| 58 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 65 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
| 59 int selected_navigation, | 66 int selected_navigation, |
| 60 bool from_last_session, | 67 bool from_last_session, |
| 61 const std::string& extension_app_id, | 68 const std::string& extension_app_id, |
| 62 content::SessionStorageNamespace* session_storage_namespace, | 69 const sessions::TabClientData* tab_client_data, |
| 63 const std::string& user_agent_override) = 0; | 70 const std::string& user_agent_override) = 0; |
| 64 virtual void CloseTab() = 0; | 71 virtual void CloseTab() = 0; |
| 65 | 72 |
| 66 protected: | 73 protected: |
| 67 virtual ~TabRestoreServiceDelegate() {} | 74 virtual ~TabRestoreServiceDelegate() {} |
| 68 }; | 75 }; |
| 69 | 76 |
| 70 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ | 77 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ |
| OLD | NEW |