Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
[email protected] | fb7da413 | 2011-03-15 15:51:00 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
blundell | bde024d | 2015-09-30 13:47:07 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ |
6 | #define CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ | ||||
[email protected] | fb7da413 | 2011-03-15 15:51:00 | [diff] [blame] | 7 | |
Roman Arora | fa79458 | 2021-11-12 00:42:37 | [diff] [blame] | 8 | #include <map> |
[email protected] | fb7da413 | 2011-03-15 15:51:00 | [diff] [blame] | 9 | #include <string> |
10 | #include <vector> | ||||
11 | |||||
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 12 | #include "base/memory/raw_ptr.h" |
blundell | bde024d | 2015-09-30 13:47:07 | [diff] [blame] | 13 | #include "components/sessions/core/live_tab_context.h" |
dljames | ae5419e0 | 2024-04-23 19:01:47 | [diff] [blame] | 14 | #include "components/sessions/core/tab_restore_types.h" |
Connie Wan | 866179b | 2019-12-18 21:39:33 | [diff] [blame] | 15 | #include "components/tab_groups/tab_group_id.h" |
16 | #include "components/tab_groups/tab_group_visual_data.h" | ||||
Md Hasibul Hasan | 612b00ee | 2024-09-20 03:00:01 | [diff] [blame] | 17 | #include "ui/base/mojom/window_show_state.mojom-forward.h" |
chrisha | b1ba090f | 2017-08-18 22:00:50 | [diff] [blame] | 18 | #include "ui/base/ui_base_types.h" |
[email protected] | fb7da413 | 2011-03-15 15:51:00 | [diff] [blame] | 19 | |
20 | class Browser; | ||||
blundell | 7bf49a3d | 2015-09-14 18:38:11 | [diff] [blame] | 21 | class Profile; |
[email protected] | fb7da413 | 2011-03-15 15:51:00 | [diff] [blame] | 22 | |
dljames | a0499b6 | 2024-03-26 21:49:30 | [diff] [blame] | 23 | namespace base { |
24 | class Uuid; | ||||
25 | } | ||||
26 | |||||
blundell | 80c5b2a0 | 2015-09-17 18:22:12 | [diff] [blame] | 27 | namespace content { |
28 | class WebContents; | ||||
29 | } | ||||
30 | |||||
chrisha | b1ba090f | 2017-08-18 22:00:50 | [diff] [blame] | 31 | namespace gfx { |
32 | class Rect; | ||||
33 | } | ||||
34 | |||||
blundell | bde024d | 2015-09-30 13:47:07 | [diff] [blame] | 35 | // Implementation of LiveTabContext which uses an instance of |
[email protected] | fb7da413 | 2011-03-15 15:51:00 | [diff] [blame] | 36 | // Browser in order to fulfil its duties. |
blundell | bde024d | 2015-09-30 13:47:07 | [diff] [blame] | 37 | class BrowserLiveTabContext : public sessions::LiveTabContext { |
[email protected] | fb7da413 | 2011-03-15 15:51:00 | [diff] [blame] | 38 | public: |
blundell | bde024d | 2015-09-30 13:47:07 | [diff] [blame] | 39 | explicit BrowserLiveTabContext(Browser* browser) : browser_(browser) {} |
Peter Boström | 53c6c595 | 2021-09-17 09:41:26 | [diff] [blame] | 40 | |
41 | BrowserLiveTabContext(const BrowserLiveTabContext&) = delete; | ||||
42 | BrowserLiveTabContext& operator=(const BrowserLiveTabContext&) = delete; | ||||
43 | |||||
Sorin Jianu | 7648695 | 2024-11-28 04:21:50 | [diff] [blame] | 44 | ~BrowserLiveTabContext() override = default; |
[email protected] | fb7da413 | 2011-03-15 15:51:00 | [diff] [blame] | 45 | |
blundell | bde024d | 2015-09-30 13:47:07 | [diff] [blame] | 46 | // Overridden from LiveTabContext: |
dcheng | 5dd5ff6 | 2014-10-21 12:42:38 | [diff] [blame] | 47 | void ShowBrowserWindow() override; |
Mikel Astiz | e023c57 | 2018-03-28 07:56:56 | [diff] [blame] | 48 | SessionID GetSessionID() const override; |
Joel Hockey | 38c3389 | 2022-06-09 01:51:19 | [diff] [blame] | 49 | sessions::SessionWindow::WindowType GetWindowType() const override; |
dcheng | 5dd5ff6 | 2014-10-21 12:42:38 | [diff] [blame] | 50 | int GetTabCount() const override; |
51 | int GetSelectedIndex() const override; | ||||
52 | std::string GetAppName() const override; | ||||
Elly Fong-Jones | 8bdc12b | 2020-09-19 00:02:00 | [diff] [blame] | 53 | std::string GetUserTitle() const override; |
blundell | 80c5b2a0 | 2015-09-17 18:22:12 | [diff] [blame] | 54 | sessions::LiveTab* GetLiveTabAt(int index) const override; |
55 | sessions::LiveTab* GetActiveLiveTab() const override; | ||||
Roman Arora | 6fa0183 | 2021-12-01 00:25:41 | [diff] [blame] | 56 | std::map<std::string, std::string> GetExtraDataForTab( |
Roman Arora | fa79458 | 2021-11-12 00:42:37 | [diff] [blame] | 57 | int index) const override; |
Roman Arora | 6fa0183 | 2021-12-01 00:25:41 | [diff] [blame] | 58 | std::map<std::string, std::string> GetExtraDataForWindow() const override; |
Mohamed Mansour | bc07189 | 2023-12-07 04:08:03 | [diff] [blame] | 59 | std::optional<tab_groups::TabGroupId> GetTabGroupForTab( |
Connie Wan | 866179b | 2019-12-18 21:39:33 | [diff] [blame] | 60 | int index) const override; |
Connie Wan | dfd8f83 | 2020-01-06 20:22:30 | [diff] [blame] | 61 | const tab_groups::TabGroupVisualData* GetVisualDataForGroup( |
62 | const tab_groups::TabGroupId& group) const override; | ||||
dljames | a0499b6 | 2024-03-26 21:49:30 | [diff] [blame] | 63 | const std::optional<base::Uuid> GetSavedTabGroupIdForGroup( |
64 | const tab_groups::TabGroupId& group) const override; | ||||
Roman Arora | fa79458 | 2021-11-12 00:42:37 | [diff] [blame] | 65 | bool IsTabPinned(int index) const override; |
Connie Wan | 866179b | 2019-12-18 21:39:33 | [diff] [blame] | 66 | void SetVisualDataForGroup( |
Connie Wan | dfd8f83 | 2020-01-06 20:22:30 | [diff] [blame] | 67 | const tab_groups::TabGroupId& group, |
68 | const tab_groups::TabGroupVisualData& visual_data) override; | ||||
chrisha | b1ba090f | 2017-08-18 22:00:50 | [diff] [blame] | 69 | const gfx::Rect GetRestoredBounds() const override; |
Md Hasibul Hasan | 612b00ee | 2024-09-20 03:00:01 | [diff] [blame] | 70 | ui::mojom::WindowShowState GetRestoredState() const override; |
chrisha | b1ba090f | 2017-08-18 22:00:50 | [diff] [blame] | 71 | std::string GetWorkspace() const override; |
Jenny Zhang | 5d08744 | 2024-07-24 19:02:12 | [ |