#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/avatar_menu.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/themes/custom_theme_supplier.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_types.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/tab_strip_region_view.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/grit/theme_resources.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/hit_test.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/theme_provider.h"
#include "ui/color/color_id.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/views/background.h"
#include "ui/views/window/hit_test_utils.h"
#if BUILDFLAG(IS_WIN)
#include "chrome/browser/taskbar/taskbar_decorator_win.h"
#include "ui/display/win/screen_win.h"
#include "ui/views/win/hwnd_util.h"
#endif
constexpr int BrowserNonClientFrameView::kMinimumDragHeight;
BrowserNonClientFrameView::BrowserNonClientFrameView(BrowserFrame* frame,
BrowserView* browser_view)
: … { … }
BrowserNonClientFrameView::~BrowserNonClientFrameView() { … }
void BrowserNonClientFrameView::OnBrowserViewInitViewsComplete() { … }
void BrowserNonClientFrameView::OnFullscreenStateChanged() { … }
bool BrowserNonClientFrameView::CaptionButtonsOnLeadingEdge() const { … }
void BrowserNonClientFrameView::UpdateFullscreenTopUI() { … }
bool BrowserNonClientFrameView::ShouldHideTopUIForFullscreen() const { … }
bool BrowserNonClientFrameView::CanUserExitFullscreen() const { … }
bool BrowserNonClientFrameView::IsFrameCondensed() const { … }
bool BrowserNonClientFrameView::HasVisibleBackgroundTabShapes(
BrowserFrameActiveState active_state) const { … }
bool BrowserNonClientFrameView::EverHasVisibleBackgroundTabShapes() const { … }
bool BrowserNonClientFrameView::CanDrawStrokes() const { … }
SkColor BrowserNonClientFrameView::GetCaptionColor(
BrowserFrameActiveState active_state) const { … }
SkColor BrowserNonClientFrameView::GetFrameColor(
BrowserFrameActiveState active_state) const { … }
std::optional<int> BrowserNonClientFrameView::GetCustomBackgroundId(
BrowserFrameActiveState active_state) const { … }
void BrowserNonClientFrameView::UpdateMinimumSize() { … }
void BrowserNonClientFrameView::VisibilityChanged(views::View* starting_from,
bool is_visible) { … }
gfx::Insets BrowserNonClientFrameView::RestoredMirroredFrameBorderInsets()
const { … }
gfx::Insets BrowserNonClientFrameView::GetInputInsets() const { … }
SkRRect BrowserNonClientFrameView::GetRestoredClipRegion() const { … }
int BrowserNonClientFrameView::GetTranslucentTopAreaHeight() const { … }
void BrowserNonClientFrameView::SetFrameBounds(const gfx::Rect& bounds) { … }
void BrowserNonClientFrameView::PaintAsActiveChanged() { … }
bool BrowserNonClientFrameView::ShouldPaintAsActive(
BrowserFrameActiveState active_state) const { … }
gfx::ImageSkia BrowserNonClientFrameView::GetFrameImage(
BrowserFrameActiveState active_state) const { … }
gfx::ImageSkia BrowserNonClientFrameView::GetFrameOverlayImage(
BrowserFrameActiveState active_state) const { … }
void BrowserNonClientFrameView::OnProfileAdded(
const base::FilePath& profile_path) { … }
void BrowserNonClientFrameView::OnProfileWasRemoved(
const base::FilePath& profile_path,
const std::u16string& profile_name) { … }
void BrowserNonClientFrameView::OnProfileAvatarChanged(
const base::FilePath& profile_path) { … }
void BrowserNonClientFrameView::OnProfileHighResAvatarLoaded(
const base::FilePath& profile_path) { … }
#if BUILDFLAG(IS_WIN)
void BrowserNonClientFrameView::OnGestureEvent(ui::GestureEvent* event) {
gfx::Point event_loc = event->location();
if (event->type() == ui::EventType::kGestureLongTap &&
NonClientHitTest(event_loc) == HTCAPTION) {
views::View::ConvertPointToScreen(this, &event_loc);
event_loc = display::win::ScreenWin::DIPToScreenPoint(event_loc);
views::ShowSystemMenuAtScreenPixelLocation(views::HWNDForView(this),
event_loc);
event->SetHandled();
}
}
int BrowserNonClientFrameView::GetSystemMenuY() const {
if (!browser_view()->GetTabStripVisible())
return GetTopInset(false);
return GetBoundsForTabStripRegion(
browser_view()->tab_strip_region_view()->GetMinimumSize())
.bottom() -
GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP);
}
#endif
BEGIN_METADATA(…)