#include "chrome/browser/ui/views/tabs/tab_hover_card_controller.h"
#include <optional>
#include "base/callback_list.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/memory_pressure_monitor.h"
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/tabs/tab_style.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/chrome_widget_sublevel.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/omnibox/omnibox_popup_view_views.h"
#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
#include "chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.h"
#include "chrome/browser/ui/views/tabs/tab_hover_card_thumbnail_observer.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/common/pref_names.h"
#include "components/omnibox/browser/omnibox_edit_model.h"
#include "components/omnibox/browser/omnibox_popup_view.h"
#include "components/user_education/common/help_bubble_factory_registry.h"
#include "components/user_education/views/help_bubble_factory_views.h"
#include "components/user_education/views/help_bubble_view.h"
#include "ui/events/event.h"
#include "ui/events/event_observer.h"
#include "ui/events/types/event_type.h"
#include "ui/views/event_monitor.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
namespace {
constexpr base::TimeDelta kMemoryPressureCaptureDelay = …;
base::TimeDelta GetPreviewImageCaptureDelay(
ThumbnailImage::CaptureReadiness readiness) { … }
base::TimeDelta GetShowDelay(int tab_width) { … }
bool IsBrowserForSystemWebApp(const Browser* browser) { … }
}
class TabHoverCardController::EventSniffer : public ui::EventObserver { … };
bool TabHoverCardController::disable_animations_for_testing_ = …;
TabHoverCardController::TabHoverCardController(TabStrip* tab_strip)
: … { … }
TabHoverCardController::~TabHoverCardController() = default;
bool TabHoverCardController::AreHoverCardImagesEnabled() { … }
bool TabHoverCardController::UseAnimations() { … }
bool TabHoverCardController::IsHoverCardVisible() const { … }
bool TabHoverCardController::IsHoverCardShowingForTab(Tab* tab) const { … }
void TabHoverCardController::UpdateHoverCard(
Tab* tab,
TabSlotController::HoverCardUpdateType update_type) { … }
void TabHoverCardController::PreventImmediateReshow() { … }
void TabHoverCardController::UpdateOrShowCard(
Tab* tab,
TabSlotController::HoverCardUpdateType update_type) { … }
void TabHoverCardController::ShowHoverCard(bool is_initial,
const Tab* intended_tab) { … }
void TabHoverCardController::HideHoverCard() { … }
void TabHoverCardController::OnViewIsDeleting(views::View* observed_view) { … }
void TabHoverCardController::OnViewVisibilityChanged(
views::View* observed_view,
views::View* starting_view) { … }
void TabHoverCardController::OnTabResourceMetricsRefreshed() { … }
bool TabHoverCardController::ArePreviewsEnabled() const { … }
void TabHoverCardController::CreateHoverCard(Tab* tab) { … }
void TabHoverCardController::UpdateCardContent(Tab* tab) { … }
void TabHoverCardController::MaybeStartThumbnailObservation(
Tab* tab,
bool is_initial_show) { … }
void TabHoverCardController::StartThumbnailObservation(Tab* tab) { … }
bool TabHoverCardController::ShouldShowImmediately(const Tab* tab) const { … }
const views::View* TabHoverCardController::GetTargetAnchorView() const { … }
bool TabHoverCardController::TargetTabIsValid() const { … }
void TabHoverCardController::OnCardFullyVisible() { … }
void TabHoverCardController::ResetCardsSeenCount() { … }
void TabHoverCardController::OnFadeAnimationEnded(
views::WidgetFadeAnimator* animator,
views::WidgetFadeAnimator::FadeType fade_type) { … }
void TabHoverCardController::OnSlideAnimationProgressed(
views::BubbleSlideAnimator* animator,
double value) { … }
void TabHoverCardController::OnSlideAnimationComplete(
views::BubbleSlideAnimator* animator) { … }
void TabHoverCardController::OnPreviewImageAvailable(
TabHoverCardThumbnailObserver* observer,
gfx::ImageSkia thumbnail_image) { … }
void TabHoverCardController::OnHovercardImagesEnabledChanged() { … }
void TabHoverCardController::OnHovercardMemoryUsageEnabledChanged() { … }