Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors |
Mikel Astiz | ce816173 | 2018-06-18 11:08:48 | [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 | |
| 5 | #include "chrome/browser/ui/sync/browser_synced_tab_delegate.h" |
| 6 | |
Mikel Astiz | 3308e2e3 | 2018-06-19 19:08:42 | [diff] [blame] | 7 | #include "chrome/browser/sync/sessions/sync_sessions_router_tab_helper.h" |
Scott Violet | 5655874f | 2020-01-14 21:03:21 | [diff] [blame] | 8 | #include "components/sessions/content/session_tab_helper.h" |
Mikel Astiz | ce816173 | 2018-06-18 11:08:48 | [diff] [blame] | 9 | |
Mikel Astiz | ce816173 | 2018-06-18 11:08:48 | [diff] [blame] | 10 | BrowserSyncedTabDelegate::BrowserSyncedTabDelegate( |
Dave Tapuska | eeb6879 | 2021-11-16 21:38:40 | [diff] [blame] | 11 | content::WebContents* web_contents) |
| 12 | : content::WebContentsUserData<BrowserSyncedTabDelegate>(*web_contents) { |
Mikel Astiz | ce816173 | 2018-06-18 11:08:48 | [diff] [blame] | 13 | SetWebContents(web_contents); |
| 14 | } |
| 15 | |
Victor Hugo Vianna Silva | 3ecc1d6 | 2022-05-16 10:56:38 | [diff] [blame] | 16 | BrowserSyncedTabDelegate::~BrowserSyncedTabDelegate() = default; |
Mikel Astiz | ce816173 | 2018-06-18 11:08:48 | [diff] [blame] | 17 | |
| 18 | SessionID BrowserSyncedTabDelegate::GetWindowId() const { |
Scott Violet | 5655874f | 2020-01-14 21:03:21 | [diff] [blame] | 19 | return sessions::SessionTabHelper::FromWebContents(web_contents()) |
| 20 | ->window_id(); |
Mikel Astiz | ce816173 | 2018-06-18 11:08:48 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | SessionID BrowserSyncedTabDelegate::GetSessionId() const { |
Scott Violet | 5655874f | 2020-01-14 21:03:21 | [diff] [blame] | 24 | return sessions::SessionTabHelper::FromWebContents(web_contents()) |
| 25 | ->session_id(); |
Mikel Astiz | ce816173 | 2018-06-18 11:08:48 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | bool BrowserSyncedTabDelegate::IsPlaceholderTab() const { |
| 29 | return false; |
| 30 | } |
François Doray | 4f51d5d | 2018-12-03 22:26:24 | [diff] [blame] | 31 | |
Brandon Fong | 40f20c5d | 2023-08-31 17:41:50 | [diff] [blame] | 32 | std::unique_ptr<sync_sessions::SyncedTabDelegate> |
Sky Malice | 6ed9ac07 | 2024-07-03 22:02:56 | [diff] [blame] | 33 | BrowserSyncedTabDelegate::ReadPlaceholderTabSnapshotIfItShouldSync( |
| 34 | sync_sessions::SyncSessionsClient* sessions_client) { |
Peter Boström | cd1dc45 | 2024-11-05 10:36:34 | [diff] [blame] | 35 | NOTREACHED() |
Sky Malice | 6ed9ac07 | 2024-07-03 22:02:56 | [diff] [blame] | 36 | << "ReadPlaceholderTabSnapshotIfItShouldSync is not supported on " |
Peter Boström | 914bc34 | 2024-05-14 19:29:28 | [diff] [blame] | 37 | "desktop platforms."; |
Brandon Fong | 40f20c5d | 2023-08-31 17:41:50 | [diff] [blame] | 38 | } |
| 39 | |
Daniel Cheng | 383df85 | 2021-10-02 03:28:01 | [diff] [blame] | 40 | WEB_CONTENTS_USER_DATA_KEY_IMPL(BrowserSyncedTabDelegate); |