blob: b43269c4ad53ee5519be4a5f78dc6f5901d49225 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2012 The Chromium Authors
[email protected]52877dbc62012-06-29 22:22:032// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_BROWSER_TABRESTORE_H_
6#define CHROME_BROWSER_UI_BROWSER_TABRESTORE_H_
[email protected]52877dbc62012-06-29 22:22:037
Roman Arora6d9ab142021-12-06 17:46:098#include <map>
Lukasz Anforowicz3caa8372018-06-05 17:22:079#include <string>
[email protected]52877dbc62012-06-29 22:22:0310#include <vector>
11
Collin Baker81999fd2019-06-05 23:12:2712#include "base/token.h"
blundell47c6d8a2015-09-24 11:06:4013#include "components/sessions/core/session_types.h"
[email protected]52877dbc62012-06-29 22:22:0314
15class Browser;
16
17namespace content {
18class SessionStorageNamespace;
19class WebContents;
Aran Gilmand217b5b2019-04-11 17:45:4320} // namespace content
[email protected]52877dbc62012-06-29 22:22:0321
[email protected]40a7e412013-04-29 18:13:0122namespace sessions {
23class SerializedNavigationEntry;
Maks Orlovich303126962020-04-06 21:34:2524struct SerializedUserAgentOverride;
[email protected]40a7e412013-04-29 18:13:0125}
26
[email protected]52877dbc62012-06-29 22:22:0327namespace chrome {
28
Duc Bui70c59722017-08-09 15:25:0929// Add a tab with its session history restored from the SessionRestore and
Xiyuan Xiacf018c72024-07-18 15:23:3930// TabRestoreService systems. If `select` is true, the tab is selected.
Duc Bui70c59722017-08-09 15:25:0931// |tab_index| gives the index to insert the tab at. |selected_navigation| is
32// the index of the SerializedNavigationEntry in |navigations| to select. If
33// |extension_app_id| is non-empty the tab is an app tab and |extension_app_id|
Connie Wan866179b2019-12-18 21:39:3334// is the id of the extension. If |group| has a value, it specifies the
35// ID corresponding to the tab's group. If |pin| is true and |tab_index|/ is
Lukasz Anforowicz0de0f452020-12-02 19:57:1536// the last pinned tab, then the newly created tab is pinned.
Collin Baker81999fd2019-06-05 23:12:2737// |user_agent_override| contains the string being used as the user agent for
38// all of the tab's navigations when the regular user agent is overridden. If
Duc Bui70c59722017-08-09 15:25:0939// |from_session_restore| is true, the restored tab is created by session
Sebastien Marchand28cf23182018-06-20 02:39:3540// restore. |last_active_time| is the value to use to indicate the last time the
41// WebContents was made active, if this is left default initialized then the
Xiyuan Xiacf018c72024-07-18 15:23:3942// creation time will be used. If `is_active_browser` is set, it indicates
43// whether `browser` is (or will be) the active browser.
44// Returns the WebContents of the restored tab.
[email protected]52877dbc62012-06-29 22:22:0345content::WebContents* AddRestoredTab(
46 Browser* browser,
[email protected]40a7e412013-04-29 18:13:0147 const std::vector<sessions::SerializedNavigationEntry>& navigations,
[email protected]52877dbc62012-06-29 22:22:0348 int tab_index,
49 int selected_navigation,
50 const std::string& extension_app_id,
Mohamed Mansourbc071892023-12-07 04:08:0351 std::optional<tab_groups::TabGroupId> group,
[email protected]52877dbc62012-06-29 22:22:0352 bool select,
53 bool pin,
Olivier ROBIN4b58dd932024-08-06 13:30:3254 base::TimeTicks last_active_time_ticks,
Olivier ROBINda292fb2024-08-07 14:32:2955 base::Time last_active_time,
[email protected]8d0f3312012-08-18 01:47:5356 content::SessionStorageNamespace* storage_namespace,
Maks Orlovich303126962020-04-06 21:34:2557 const sessions::SerializedUserAgentOverride& user_agent_override,
Roman Arora6d9ab142021-12-06 17:46:0958 const std::map<std::string, std::string>& extra_data,
Xiyuan Xiacf018c72024-07-18 15:23:3959 bool from_session_restore,
60 std::optional<bool> is_active_browser);
[email protected]52877dbc62012-06-29 22:22:0361
[email protected]52877dbc62012-06-29 22:22:0362// Replaces the state of the currently selected tab with the session
Duc Bui70c59722017-08-09 15:25:0963// history restored from the SessionRestore and TabRestoreService systems.
64// Returns the WebContents of the restored tab.
[email protected]38eae4b2013-08-06 19:46:5465content::WebContents* ReplaceRestoredTab(
[email protected]52877dbc62012-06-29 22:22:0366 Browser* browser,
[email protected]40a7e412013-04-29 18:13:0167 const std::vector<sessions::SerializedNavigationEntry>& navigations,
[email protected]52877dbc62012-06-29 22:22:0368 int selected_navigation,
[email protected]52877dbc62012-06-29 22:22:0369 const std::string& extension_app_id,
[email protected]8d0f3312012-08-18 01:47:5370 content::SessionStorageNamespace* session_storage_namespace,
Maks Orlovich303126962020-04-06 21:34:2571 const sessions::SerializedUserAgentOverride& user_agent_override,
Roman Arora6d9ab142021-12-06 17:46:0972 const std::map<std::string, std::string>& extra_data,
Duc Bui70c59722017-08-09 15:25:0973 bool from_session_restore);
[email protected]52877dbc62012-06-29 22:22:0374
75} // namespace chrome
76
77#endif // CHROME_BROWSER_UI_BROWSER_TABRESTORE_H_