chromium/chrome/browser/ui/browser_live_tab_context.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/browser_live_tab_context.h"

#include <memory>
#include <numeric>
#include <optional>
#include <utility>
#include <vector>

#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "base/token.h"
#include "base/uuid.h"
#include "base/values.h"
#include "chrome/browser/apps/app_service/web_contents_app_id_utils.h"
#include "chrome/browser/browser_features.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_service_utils.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tab_strip_model_delegate.h"
#include "chrome/browser/ui/browser_tabrestore.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_utils.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/tab_group_action_context_desktop.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/tab_group_sync_service_proxy.h"
#include "chrome/browser/ui/tabs/tab_group.h"
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/common/buildflags.h"
#include "components/saved_tab_groups/features.h"
#include "components/saved_tab_groups/saved_tab_group.h"
#include "components/saved_tab_groups/types.h"
#include "components/sessions/content/content_live_tab.h"
#include "components/sessions/content/content_platform_specific_tab_data.h"
#include "components/sessions/core/live_tab_context.h"
#include "components/sessions/core/session_types.h"
#include "components/sessions/core/tab_restore_service.h"
#include "components/tab_groups/tab_group_id.h"
#include "components/tab_groups/tab_group_visual_data.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/session_storage_namespace.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/window_open_disposition.h"

#if BUILDFLAG(ENABLE_SESSION_SERVICE)
#include "chrome/browser/sessions/tab_loader.h"
#endif

#if defined(TOOLKIT_VIEWS)
#include "chrome/browser/ui/side_search/side_search_utils.h"
#endif  // defined(TOOLKIT_VIEWS)

NavigationController;
SessionStorageNamespace;
WebContents;

namespace {

// |app_name| can could be for an app that has been uninstalled. In that
// case we don't want to open an app window. Note that |app_name| is also used
// for other types of windows like dev tools and we always want to open an
// app window in those cases.
bool ShouldCreateAppWindowForAppName(Profile* profile,
                                     const std::string& app_name) {}

}  // namespace

void BrowserLiveTabContext::ShowBrowserWindow() {}

SessionID BrowserLiveTabContext::GetSessionID() const {}

sessions::SessionWindow::WindowType BrowserLiveTabContext::GetWindowType()
    const {}

int BrowserLiveTabContext::GetTabCount() const {}

int BrowserLiveTabContext::GetSelectedIndex() const {}

std::string BrowserLiveTabContext::GetAppName() const {}

std::string BrowserLiveTabContext::GetUserTitle() const {}

sessions::LiveTab* BrowserLiveTabContext::GetLiveTabAt(int index) const {}

sessions::LiveTab* BrowserLiveTabContext::GetActiveLiveTab() const {}

std::map<std::string, std::string> BrowserLiveTabContext::GetExtraDataForTab(
    int index) const {}

std::map<std::string, std::string>
BrowserLiveTabContext::GetExtraDataForWindow() const {}

std::optional<tab_groups::TabGroupId> BrowserLiveTabContext::GetTabGroupForTab(
    int index) const {}

const tab_groups::TabGroupVisualData*
BrowserLiveTabContext::GetVisualDataForGroup(
    const tab_groups::TabGroupId& group) const {}

const std::optional<base::Uuid>
BrowserLiveTabContext::GetSavedTabGroupIdForGroup(
    const tab_groups::TabGroupId& group) const {}

bool BrowserLiveTabContext::IsTabPinned(int index) const {}

void BrowserLiveTabContext::SetVisualDataForGroup(
    const tab_groups::TabGroupId& group,
    const tab_groups::TabGroupVisualData& visual_data) {}

const gfx::Rect BrowserLiveTabContext::GetRestoredBounds() const {}

ui::WindowShowState BrowserLiveTabContext::GetRestoredState() const {}

std::string BrowserLiveTabContext::GetWorkspace() const {}

sessions::LiveTab* BrowserLiveTabContext::AddRestoredTab(
    const sessions::tab_restore::Tab& tab,
    int tab_index,
    bool select,
    sessions::tab_restore::Type original_session_type) {}

sessions::LiveTab* BrowserLiveTabContext::ReplaceRestoredTab(
    const sessions::tab_restore::Tab& tab) {}

void BrowserLiveTabContext::CloseTab() {}

// static
sessions::LiveTabContext* BrowserLiveTabContext::Create(
    Profile* profile,
    sessions::SessionWindow::WindowType type,
    const std::string& app_name,
    const gfx::Rect& bounds,
    ui::WindowShowState show_state,
    const std::string& workspace,
    const std::string& user_title,
    const std::map<std::string, std::string>& extra_data) {}

// static
sessions::LiveTabContext* BrowserLiveTabContext::FindContextForWebContents(
    const WebContents* contents) {}

// static
sessions::LiveTabContext* BrowserLiveTabContext::FindContextWithID(
    SessionID desired_id) {}

// static
sessions::LiveTabContext* BrowserLiveTabContext::FindContextWithGroup(
    tab_groups::TabGroupId group,
    Profile* profile) {}