chromium/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc

// Copyright 2021 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/views/side_panel/side_panel_coordinator.h"

#include <memory>
#include <string>
#include <utility>

#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_forward.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/user_metrics.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_actions.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/tabs/public/tab_features.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/pinned_toolbar/pinned_toolbar_actions_model.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_model.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/extensions/extensions_toolbar_container.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/side_panel/side_panel.h"
#include "chrome/browser/ui/views/side_panel/side_panel_content_proxy.h"
#include "chrome/browser/ui/views/side_panel/side_panel_entry_id.h"
#include "chrome/browser/ui/views/side_panel/side_panel_entry_key.h"
#include "chrome/browser/ui/views/side_panel/side_panel_header.h"
#include "chrome/browser/ui/views/side_panel/side_panel_web_ui_view.h"
#include "chrome/browser/ui/views/toolbar/pinned_toolbar_actions_container.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/feature_engagement/public/event_constants.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/lens/lens_features.h"
#include "components/strings/grit/components_strings.h"
#include "components/user_education/common/feature_promo_result.h"
#include "ui/actions/action_id.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/window_open_disposition.h"
#include "ui/color/color_id.h"
#include "ui/gfx/vector_icon_types.h"
#include "ui/gfx/vector_icon_utils.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/separator.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "ui/views/layout/flex_layout_view.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/vector_icons.h"
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"

namespace {

constexpr int kSidePanelContentWrapperViewId =;

void ConfigureControlButton(views::ImageButton* button) {}

std::unique_ptr<views::ToggleImageButton> CreatePinToggleButton(
    base::RepeatingClosure pressed_callback) {}

std::unique_ptr<views::ImageButton> CreateControlButton(
    views::View* host,
    base::RepeatingClosure pressed_callback,
    const gfx::VectorIcon& icon,
    const std::u16string& tooltip_text,
    ui::ElementIdentifier view_id,
    int dip_size) {}

std::unique_ptr<views::ImageView> CreateIcon() {}

std::unique_ptr<views::Label> CreateTitle() {}

PopulateSidePanelCallback;

// SidePanelContentSwappingContainer is used as the content wrapper for views
// hosted in the side panel. This uses the SidePanelContentProxy to check if or
// wait for a SidePanelEntry's content view to be ready to be shown then only
// swaps the views when the content is ready. If the SidePanelContextProxy
// doesn't exist, the content is swapped immediately.
class SidePanelContentSwappingContainer : public views::View {};

BEGIN_METADATA()

}  // namespace

SidePanelCoordinator::SidePanelCoordinator(BrowserView* browser_view)
    :{}

SidePanelCoordinator::~SidePanelCoordinator() = default;

void SidePanelCoordinator::TearDownPreBrowserViewDestruction() {}

SidePanelRegistry* SidePanelCoordinator::GetWindowRegistry() {}

void SidePanelCoordinator::OnToolbarPinnedActionsChanged() {}

actions::ActionItem* SidePanelCoordinator::GetActionItem(
    SidePanelEntry::Key entry_key) {}

void SidePanelCoordinator::Show(
    SidePanelEntry::Id entry_id,
    std::optional<SidePanelUtil::SidePanelOpenTrigger> open_trigger) {}

void SidePanelCoordinator::Show(
    SidePanelEntry::Key entry_key,
    std::optional<SidePanelUtil::SidePanelOpenTrigger> open_trigger) {}

void SidePanelCoordinator::AddSidePanelViewStateObserver(
    SidePanelViewStateObserver* observer) {}

void SidePanelCoordinator::RemoveSidePanelViewStateObserver(
    SidePanelViewStateObserver* observer) {}

void SidePanelCoordinator::Close() {}

void SidePanelCoordinator::Toggle(
    SidePanelEntryKey key,
    SidePanelUtil::SidePanelOpenTrigger open_trigger) {}

void SidePanelCoordinator::OpenInNewTab() {}

void SidePanelCoordinator::UpdatePinState() {}

void SidePanelCoordinator::OpenMoreInfoMenu() {}

std::optional<SidePanelEntry::Id> SidePanelCoordinator::GetCurrentEntryId()
    const {}

bool SidePanelCoordinator::IsSidePanelShowing() const {}

bool SidePanelCoordinator::IsSidePanelEntryShowing(
    const SidePanelEntry::Key& entry_key) const {}

content::WebContents* SidePanelCoordinator::GetWebContentsForTest(
    SidePanelEntryId id) {}

void SidePanelCoordinator::DisableAnimationsForTesting() {}

SidePanelEntry* SidePanelCoordinator::GetLoadingEntryForTesting() const {}

bool SidePanelCoordinator::IsSidePanelEntryShowing(
    const SidePanelEntry* entry) const {}

void SidePanelCoordinator::Show(
    SidePanelEntry* entry,
    std::optional<SidePanelUtil::SidePanelOpenTrigger> open_trigger,
    bool suppress_animations) {}

void SidePanelCoordinator::Close(bool suppress_animations) {}

SidePanelEntry* SidePanelCoordinator::GetEntryForKey(
    const SidePanelEntry::Key& entry_key) const {}

SidePanelEntry* SidePanelCoordinator::GetActiveContextualEntryForKey(
    const SidePanelEntry::Key& entry_key) const {}

SidePanelEntry* SidePanelCoordinator::GetLoadingEntry() const {}

bool SidePanelCoordinator::IsGlobalEntryShowing(
    const SidePanelEntry::Key& entry_key) const {}

void SidePanelCoordinator::InitializeSidePanel() {}

void SidePanelCoordinator::PopulateSidePanel(
    bool suppress_animations,
    SidePanelEntry* entry,
    std::optional<std::unique_ptr<views::View>> content_view) {}

void SidePanelCoordinator::ClearCachedEntryViews() {}

SidePanelRegistry* SidePanelCoordinator::GetActiveContextualRegistry() const {}

std::unique_ptr<views::View> SidePanelCoordinator::CreateHeader() {}

SidePanelEntry* SidePanelCoordinator::GetNewActiveEntryOnDeregister(
    SidePanelRegistry* deregistering_registry,
    const SidePanelEntry::Key& key) {}

SidePanelEntry* SidePanelCoordinator::GetNewActiveEntryOnTabChanged() {}

void SidePanelCoordinator::NotifyPinnedContainerOfActiveStateChange(
    SidePanelEntryKey key,
    bool is_active) {}

void SidePanelCoordinator::MaybeQueuePinPromo() {}

void SidePanelCoordinator::ShowPinPromo() {}

void SidePanelCoordinator::MaybeEndPinPromo(bool pinned) {}

void SidePanelCoordinator::OnEntryRegistered(SidePanelRegistry* registry,
                                             SidePanelEntry* entry) {}

void SidePanelCoordinator::OnEntryWillDeregister(SidePanelRegistry* registry,
                                                 SidePanelEntry* entry) {}

void SidePanelCoordinator::OnRegistryDestroying(SidePanelRegistry* registry) {}

void SidePanelCoordinator::OnTabStripModelChanged(
    TabStripModel* tab_strip_model,
    const TabStripModelChange& change,
    const TabStripSelectionChange& selection) {}

void SidePanelCoordinator::UpdateNewTabButtonState() {}

void SidePanelCoordinator::UpdateHeaderPinButtonState() {}

void SidePanelCoordinator::SetNoDelaysForTesting(bool no_delays_for_testing) {}

void SidePanelCoordinator::UpdatePanelIconAndTitle(
    const ui::ImageModel& icon,
    const std::u16string& text,
    const bool should_show_title_text,
    const bool is_extension) {}

void SidePanelCoordinator::OnViewVisibilityChanged(views::View* observed_view,
                                                   views::View* starting_from) {}

void SidePanelCoordinator::OnActionsChanged() {}