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

// Copyright 2020 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.h"

#include <memory>

#include "base/functional/bind.h"
#include "base/i18n/number_formatting.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/top_container_background.h"
#include "chrome/browser/ui/views/side_panel/side_panel_coordinator.h"
#include "chrome/browser/ui/views/side_panel/side_panel_enums.h"
#include "chrome/browser/ui/views/side_panel/side_panel_resize_area.h"
#include "chrome/browser/ui/views/side_panel/side_panel_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/lens/lens_features.h"
#include "components/prefs/pref_service.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/insets_conversions.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/rounded_corners_f.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/border.h"
#include "ui/views/controls/separator.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/view_observer.h"

namespace {

// This thickness includes the solid-color background and the inner round-rect
// border-color stroke. It does not include the outer-color separator.
int GetBorderThickness() {}

// This is how many units of the toolbar are essentially expected to be
// background.
constexpr int kOverlapFromToolbar =;

// We want the border to visually look like GetBorderThickness() units on all
// sides. On the top side, background is drawn on top of the top-content
// separator and some units of background inside the toolbar (or bookmarks bar)
// itself. Subtract both of those to not get visually-excessive padding.
gfx::Insets GetBorderInsets() {}

constexpr int kAnimationDurationMs =;

// This border paints the toolbar color around the side panel content and draws
// a roundrect viewport around the side panel content. The border can have
// rounded corners of its own.
class SidePanelBorder : public views::Border {};

class BorderView : public views::View {};

BEGIN_METADATA()

}  // namespace

// Ensures immediate children of the SidePanel have their layers clipped to
// their visible bounds to prevent incorrect clipping during animation.
// TODO: 344626785 - Remove this once WebView layer behavior has been fixed.
class SidePanel::VisibleBoundsViewClipper : public views::ViewObserver {};

SidePanel::SidePanel(BrowserView* browser_view,
                     HorizontalAlignment horizontal_alignment)
    :{}

SidePanel::~SidePanel() = default;

void SidePanel::SetPanelWidth(int width) {}

void SidePanel::SetBackgroundRadii(const gfx::RoundedCornersF& radii) {}

void SidePanel::SetHorizontalAlignment(HorizontalAlignment alignment) {}

SidePanel::HorizontalAlignment SidePanel::GetHorizontalAlignment() {}

bool SidePanel::IsRightAligned() {}

gfx::Size SidePanel::GetMinimumSize() const {}

bool SidePanel::IsClosing() {}

void SidePanel::AddHeaderView(std::unique_ptr<views::View> view) {}

gfx::Size SidePanel::GetContentSizeUpperBound() const {}

void SidePanel::ChildVisibilityChanged(View* child) {}

void SidePanel::OnBoundsChanged(const gfx::Rect& previous_bounds) {}

double SidePanel::GetAnimationValue() const {}

void SidePanel::OnChildViewAdded(View* observed_view, View* child) {}

void SidePanel::OnChildViewRemoved(View* observed_view, View* child) {}

void SidePanel::OnViewPropertyChanged(View* observed_view,
                                      const void* key,
                                      int64_t old_value) {}

void SidePanel::AnimationProgressed(const gfx::Animation* animation) {}

void SidePanel::AnimationEnded(const gfx::Animation* animation) {}

void SidePanel::UpdateSidePanelWidthPref(const std::string& panel_id,
                                         int width) {}

void SidePanel::OnResize(int resize_amount, bool done_resizing) {}

void SidePanel::RecordMetricsIfResized() {}

void SidePanel::UpdateVisibility() {}

bool SidePanel::ShouldShowAnimation() const {}

void SidePanel::AnnounceResize() {}

BEGIN_METADATA()