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