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