#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/ui/views/status_bubble_views.h"
#include <algorithm>
#include <utility>
#include "base/functional/bind.h"
#include "base/i18n/rtl.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/timer/timer.h"
#include "base/types/cxx23_to_underlying.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "cc/paint/paint_flags.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/chrome_widget_sublevel.h"
#include "components/url_formatter/elide_url.h"
#include "components/url_formatter/url_formatter.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/pathops/SkPathOps.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/animation/linear_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rrect_f.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/gfx/text_elider.h"
#include "ui/gfx/text_utils.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/animation/animation_delegate_views.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/scrollbar/scroll_bar_views.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/style/typography.h"
#include "ui/views/style/typography_provider.h"
#include "ui/views/widget/root_view.h"
#include "ui/views/widget/widget.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/public/cpp/window_properties.h"
#include "ui/aura/window.h"
#endif
namespace {
constexpr int kBubbleCornerRadius = …;
constexpr int kMousePadding = …;
constexpr int kTextHorizPadding = …;
constexpr auto kShowDelay = …;
constexpr auto kHideDelay = …;
constexpr auto kShowFadeDuration = …;
constexpr auto kHideFadeDuration = …;
constexpr int kFramerate = …;
constexpr auto kMinExpansionStepDuration = …;
constexpr auto kMaxExpansionStepDuration = …;
constexpr auto kDestroyPopupDelay = …;
const gfx::FontList& GetFont() { … }
}
class StatusBubbleViews::StatusViewAnimation
: public gfx::LinearAnimation,
public views::AnimationDelegateViews { … };
class StatusBubbleViews::StatusView : public views::View { … };
StatusView;
StatusView::StatusView(StatusBubbleViews* status_bubble)
: … { … }
StatusView::~StatusView() { … }
gfx::Insets StatusView::GetInsets() const { … }
const std::u16string& StatusView::GetText() const { … }
void StatusView::SetText(const std::u16string& text) { … }
void StatusView::AnimateForText(const std::u16string& text) { … }
void StatusView::SetStyle(BubbleStyle style) { … }
void StatusView::ShowInstantly() { … }
void StatusView::HideInstantly() { … }
void StatusView::ResetTimer() { … }
void StatusView::SetOpacity(float opacity) { … }
void StatusView::OnAnimationEnded() { … }
bool StatusView::IsDestroyPopupTimerRunning() const { … }
void StatusView::OnThemeChanged() { … }
void StatusView::StartTimer(base::TimeDelta time) { … }
void StatusView::OnTimer() { … }
void StatusView::CancelTimer() { … }
void StatusView::RestartTimer(base::TimeDelta delay) { … }
void StatusView::StartFade(float start, float end, base::TimeDelta duration) { … }
void StatusView::StartHiding() { … }
void StatusView::StartShowing() { … }
void StatusView::SetTextLabelColors(views::Label* text) { … }
void StatusView::OnPaint(gfx::Canvas* canvas) { … }
DEFINE_ENUM_CONVERTERS(…)
DEFINE_ENUM_CONVERTERS(…)
BEGIN_METADATA(…)
StatusBubbleViews::StatusViewAnimation::StatusViewAnimation(
StatusView* status_view,
float opacity_start,
float opacity_end)
: … { … }
StatusBubbleViews::StatusViewAnimation::~StatusViewAnimation() { … }
float StatusBubbleViews::StatusViewAnimation::GetCurrentOpacity() { … }
void StatusBubbleViews::StatusViewAnimation::AnimateToState(double state) { … }
void StatusBubbleViews::StatusViewAnimation::AnimationEnded(
const gfx::Animation* animation) { … }
class StatusBubbleViews::StatusViewExpander
: public gfx::LinearAnimation,
public views::AnimationDelegateViews { … };
void StatusBubbleViews::StatusViewExpander::AnimateToState(double state) { … }
void StatusBubbleViews::StatusViewExpander::AnimationEnded(
const gfx::Animation* animation) { … }
void StatusBubbleViews::StatusViewExpander::StartExpansion(
const std::u16string& expanded_text,
int expansion_start,
int expansion_end) { … }
int StatusBubbleViews::StatusViewExpander::GetCurrentBubbleWidth() { … }
void StatusBubbleViews::StatusViewExpander::SetBubbleWidth(int width) { … }
const int StatusBubbleViews::kShadowThickness = …;
StatusBubbleViews::StatusBubbleViews(views::View* base_view)
: … { … }
StatusBubbleViews::~StatusBubbleViews() { … }
void StatusBubbleViews::InitPopup() { … }
void StatusBubbleViews::DestroyPopup() { … }
void StatusBubbleViews::Reposition() { … }
void StatusBubbleViews::RepositionPopup() { … }
int StatusBubbleViews::GetPreferredHeight() { … }
void StatusBubbleViews::SetBounds(int x, int y, int w, int h) { … }
int StatusBubbleViews::GetWidthForURL(const std::u16string& url_string) { … }
void StatusBubbleViews::SetStatus(const std::u16string& status_text) { … }
void StatusBubbleViews::SetURL(const GURL& url) { … }
void StatusBubbleViews::Hide() { … }
void StatusBubbleViews::MouseMoved(bool left_content) { … }
void StatusBubbleViews::MouseMovedAt(const gfx::Point& location,
bool left_content) { … }
void StatusBubbleViews::UpdateDownloadShelfVisibility(bool visible) { … }
void StatusBubbleViews::AvoidMouse(const gfx::Point& location) { … }
bool StatusBubbleViews::IsFrameVisible() { … }
bool StatusBubbleViews::IsFrameMaximized() { … }
void StatusBubbleViews::ExpandBubble() { … }
int StatusBubbleViews::GetStandardStatusBubbleWidth() { … }
int StatusBubbleViews::GetMaxStatusBubbleWidth() { … }
void StatusBubbleViews::SetBubbleWidth(int width) { … }
void StatusBubbleViews::CancelExpandTimer() { … }
gfx::Animation* StatusBubbleViews::GetShowHideAnimationForTest() { … }
bool StatusBubbleViews::IsDestroyPopupTimerRunningForTest() { … }