#include "chrome/browser/ui/views/frame/webui_tab_strip_container_view.h"
#include <algorithm>
#include <string>
#include <utility>
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/i18n/message_formatter.h"
#include "base/i18n/number_formatting.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/scoped_observation.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/task_manager/web_contents_tags.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "chrome/browser/ui/views/frame/top_container_view.h"
#include "chrome/browser/ui/views/frame/webui_tab_strip_field_trial.h"
#include "chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
#include "chrome/browser/ui/views/toolbar/webui_tab_counter_button.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_layout.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_metrics.h"
#include "chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/webui_url_constants.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/feature_engagement/public/tracker.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_ui.h"
#include "ui/accessibility/ax_mode.h"
#include "ui/aura/window.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/dragdrop/os_exchange_data.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/theme_provider.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/events/event_handler.h"
#include "ui/events/event_target.h"
#include "ui/gfx/animation/tween.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/background.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/view_observer.h"
#include "ui/views/view_tracker.h"
#include "ui/views/widget/widget.h"
enum class WebUITabStripDragDirection { … };
enum class WebUITabStripOpenCloseReason { … };
namespace {
gfx::Tween::Type GetTweenTypeForTabstripOpenClose(
WebUITabStripOpenCloseReason reason) { … }
base::TimeDelta GetBaseTabstripOpenCloseAnimationDuration(
WebUITabStripDragDirection direction) { … }
base::TimeDelta GetTimeDeltaForTabstripOpenClose(
WebUITabStripOpenCloseReason reason,
WebUITabStripDragDirection direction,
double percent_remaining) { … }
WebUITabStripDragDirection DragDirectionFromDelta(float delta) { … }
std::optional<WebUITabStripDragDirection> DragDirectionFromSwipe(
const ui::GestureEvent* event) { … }
bool EventTypeCanCloseTabStrip(const ui::EventType& type) { … }
TabStripUI* GetTabStripUI(content::WebContents* web_contents) { … }
}
class WebUITabStripContainerView::AutoCloser : public ui::EventHandler,
public views::ViewObserver { … };
class WebUITabStripContainerView::DragToOpenHandler : public ui::EventHandler { … };
WebUITabStripContainerView::WebUITabStripContainerView(
BrowserView* browser_view,
views::View* tab_contents_container,
views::View* top_container,
views::View* omnibox)
: … { … }
WebUITabStripContainerView::~WebUITabStripContainerView() { … }
bool WebUITabStripContainerView::SupportsTouchableTabStrip(
const Browser* browser) { … }
bool WebUITabStripContainerView::UseTouchableTabStrip(const Browser* browser) { … }
void WebUITabStripContainerView::GetDropFormatsForView(
int* formats,
std::set<ui::ClipboardFormatType>* format_types) { … }
bool WebUITabStripContainerView::IsDraggedTab(const ui::OSExchangeData& data) { … }
void WebUITabStripContainerView::OpenForTabDrag() { … }
views::NativeViewHost* WebUITabStripContainerView::GetNativeViewHost() { … }
std::unique_ptr<views::View> WebUITabStripContainerView::CreateTabCounter() { … }
void WebUITabStripContainerView::SetVisibleForTesting(bool visible) { … }
void WebUITabStripContainerView::FinishAnimationForTesting() { … }
const ui::AcceleratorProvider*
WebUITabStripContainerView::GetAcceleratorProvider() const { … }
void WebUITabStripContainerView::CloseContainer() { … }
bool WebUITabStripContainerView::CanStartDragToOpen(
WebUITabStripDragDirection direction) const { … }
void WebUITabStripContainerView::UpdateHeightForDragToOpen(float height_delta) { … }
void WebUITabStripContainerView::EndDragToOpen(
std::optional<WebUITabStripDragDirection> fling_direction) { … }
void WebUITabStripContainerView::TabCounterPressed(const ui::Event& event) { … }
void WebUITabStripContainerView::SetContainerTargetVisibility(
bool target_visible,
WebUITabStripOpenCloseReason reason) { … }
void WebUITabStripContainerView::CloseForEventOutsideTabStrip(
TabStripUICloseAction reason) { … }
void WebUITabStripContainerView::AnimationEnded(
const gfx::Animation* animation) { … }
void WebUITabStripContainerView::AnimationProgressed(
const gfx::Animation* animation) { … }
void WebUITabStripContainerView::ShowContextMenuAtPoint(
gfx::Point point,
std::unique_ptr<ui::MenuModel> menu_model,
base::RepeatingClosure on_menu_closed_callback) { … }
void WebUITabStripContainerView::CloseContextMenu() { … }
void WebUITabStripContainerView::ShowEditDialogForGroupAtPoint(
gfx::Point point,
gfx::Rect rect,
tab_groups::TabGroupId group) { … }
void WebUITabStripContainerView::HideEditDialogForGroup() { … }
TabStripUILayout WebUITabStripContainerView::GetLayout() { … }
SkColor WebUITabStripContainerView::GetColorProviderColor(
ui::ColorId id) const { … }
gfx::Size WebUITabStripContainerView::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
gfx::Size WebUITabStripContainerView::FlexRule(
const views::View* view,
const views::SizeBounds& bounds) const { … }
void WebUITabStripContainerView::OnViewBoundsChanged(View* observed_view) { … }
void WebUITabStripContainerView::OnViewIsDeleting(View* observed_view) { … }
void WebUITabStripContainerView::OnWidgetDestroying(views::Widget* widget) { … }
bool WebUITabStripContainerView::SetPaneFocusAndFocusDefault() { … }
void WebUITabStripContainerView::PrimaryMainFrameRenderProcessGone(
base::TerminationStatus status) { … }
void WebUITabStripContainerView::InitializeWebView() { … }
void WebUITabStripContainerView::DeinitializeWebView() { … }
BEGIN_METADATA(…)