Roll src/third_party/WebKit 1cd8cc5:4e01097 (svn 202507:202508)
[chromium-blink-merge.git] / chrome / browser / sessions / tab_restore_service_delegate.h
blobaf912f1c3f621f6f4533277888224b2feb6c4995
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 CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_
6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_
8 #include <string>
9 #include <vector>
11 #include "components/sessions/session_id.h"
13 namespace sessions {
14 class LiveTab;
17 namespace sessions {
18 class SerializedNavigationEntry;
19 class TabClientData;
22 // Objects implement this interface to provide necessary functionality for
23 // TabRestoreService to operate. These methods are mostly copies of existing
24 // Browser methods.
25 class TabRestoreServiceDelegate {
26 public:
27 // see BrowserWindow::Show()
28 virtual void ShowBrowserWindow() = 0;
30 // see Browser::session_id()
31 virtual const SessionID& GetSessionID() const = 0;
33 // see Browser::tab_count()
34 virtual int GetTabCount() const = 0;
36 // see Browser::active_index()
37 virtual int GetSelectedIndex() const = 0;
39 // see Browser::app_name()
40 virtual std::string GetAppName() const = 0;
42 virtual sessions::LiveTab* GetLiveTabAt(int index) const = 0;
43 virtual sessions::LiveTab* GetActiveLiveTab() const = 0;
44 virtual bool IsTabPinned(int index) const = 0;
46 // Note: |tab_client_data| may be null (e.g., if |from_last_session| is true,
47 // as the tab client data is not persisted, or if the embedder did not supply
48 // client data for the tab in question).
49 virtual sessions::LiveTab* AddRestoredTab(
50 const std::vector<sessions::SerializedNavigationEntry>& navigations,
51 int tab_index,
52 int selected_navigation,
53 const std::string& extension_app_id,
54 bool select,
55 bool pin,
56 bool from_last_session,
57 const sessions::TabClientData* tab_client_data,
58 const std::string& user_agent_override) = 0;
60 // Note: |tab_client_data| may be null (e.g., if |from_last_session| is true,
61 // as the tab client data is not persisted, or if the embedder did not supply
62 virtual sessions::LiveTab* ReplaceRestoredTab(
63 const std::vector<sessions::SerializedNavigationEntry>& navigations,
64 int selected_navigation,
65 bool from_last_session,
66 const std::string& extension_app_id,
67 const sessions::TabClientData* tab_client_data,
68 const std::string& user_agent_override) = 0;
69 virtual void CloseTab() = 0;
71 protected:
72 virtual ~TabRestoreServiceDelegate() {}
75 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_