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
;
18 class PlatformSpecificTabData
;
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_platform_data| may be null (e.g., if |from_last_session| is
45 // true, as this data is not persisted, or if the platform does not provide
46 // platform-specific data).
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 PlatformSpecificTabData
* tab_platform_data
,
56 const std::string
& user_agent_override
) = 0;
58 // Note: |tab_platform_data| may be null (e.g., if |from_last_session| is
59 // true, as this data is not persisted, or if the platform does not provide
60 // platform-specific data).
61 virtual LiveTab
* ReplaceRestoredTab(
62 const std::vector
<SerializedNavigationEntry
>& navigations
,
63 int selected_navigation
,
64 bool from_last_session
,
65 const std::string
& extension_app_id
,
66 const PlatformSpecificTabData
* tab_platform_data
,
67 const std::string
& user_agent_override
) = 0;
68 virtual void CloseTab() = 0;
71 virtual ~TabRestoreServiceDelegate() {}
74 } // namespace sessions
76 #endif // COMPONENTS_SESSIONS_CORE_TAB_RESTORE_SERVICE_DELEGATE_H_