chromium/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

// Copyright 2012 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/frame/opaque_browser_frame_view.h"

#include <algorithm>
#include <utility>

#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "build/chromeos_buildflags.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/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/caption_button_placeholder_container.h"
#include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h"
#include "chrome/browser/ui/views/frame/tab_strip_region_view.h"
#include "chrome/browser/ui/views/tab_icon_view.h"
#include "chrome/browser/ui/views/tabs/new_tab_button.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_contents.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/hit_test.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
#include "ui/base/theme_provider.h"
#include "ui/color/color_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/image/canvas_image_source.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/label.h"
#include "ui/views/resources/grit/views_resources.h"
#include "ui/views/views_delegate.h"
#include "ui/views/window/frame_background.h"
#include "ui/views/window/frame_caption_button.h"
#include "ui/views/window/vector_icons/vector_icons.h"
#include "ui/views/window/window_shape.h"

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include "ui/views/controls/menu/menu_runner.h"
#endif

#if BUILDFLAG(IS_WIN)
#include "ui/display/win/screen_win.h"
#endif

WebContents;

namespace {

class CaptionButtonBackgroundImageSource : public gfx::CanvasImageSource {};

bool HitTestCaptionButton(views::Button* button, const gfx::Point& point) {}

}  // namespace

///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, public:

OpaqueBrowserFrameView::OpaqueBrowserFrameView(
    BrowserFrame* frame,
    BrowserView* browser_view,
    OpaqueBrowserFrameViewLayout* layout)
    :{}

OpaqueBrowserFrameView::~OpaqueBrowserFrameView() {}

void OpaqueBrowserFrameView::InitViews() {}

///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, BrowserNonClientFrameView implementation:

gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStripRegion(
    const gfx::Size& tabstrip_minimum_size) const {}

gfx::Rect OpaqueBrowserFrameView::GetBoundsForWebAppFrameToolbar(
    const gfx::Size& toolbar_preferred_size) const {}

void OpaqueBrowserFrameView::LayoutWebAppWindowTitle(
    const gfx::Rect& available_space,
    views::Label& window_title_label) const {}

int OpaqueBrowserFrameView::GetTopInset(bool restored) const {}

void OpaqueBrowserFrameView::UpdateThrobber(bool running) {}

void OpaqueBrowserFrameView::WindowControlsOverlayEnabledChanged() {}

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

void OpaqueBrowserFrameView::PaintAsActiveChanged() {}

void OpaqueBrowserFrameView::OnThemeChanged() {}
///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, views::NonClientFrameView implementation:

gfx::Rect OpaqueBrowserFrameView::GetBoundsForClientView() const {}

gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds(
    const gfx::Rect& client_bounds) const {}

int OpaqueBrowserFrameView::NonClientHitTest(const gfx::Point& point) {}

void OpaqueBrowserFrameView::GetWindowMask(const gfx::Size& size,
                                           SkPath* window_mask) {}

void OpaqueBrowserFrameView::ResetWindowControls() {}

void OpaqueBrowserFrameView::UpdateWindowIcon() {}

void OpaqueBrowserFrameView::UpdateWindowTitle() {}

///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, TabIconView::TabContentsProvider implementation:

bool OpaqueBrowserFrameView::ShouldTabIconViewAnimate() const {}

ui::ImageModel OpaqueBrowserFrameView::GetFaviconForTabIconView() {}

///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, OpaqueBrowserFrameViewLayoutDelegate implementation:

bool OpaqueBrowserFrameView::ShouldShowWindowIcon() const {}

bool OpaqueBrowserFrameView::ShouldShowWindowTitle() const {}

std::u16string OpaqueBrowserFrameView::GetWindowTitle() const {}

int OpaqueBrowserFrameView::GetIconSize() const {}

gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const {}

bool OpaqueBrowserFrameView::ShouldShowCaptionButtons() const {}

bool OpaqueBrowserFrameView::IsRegularOrGuestSession() const {}

bool OpaqueBrowserFrameView::CanMaximize() const {}

bool OpaqueBrowserFrameView::CanMinimize() const {}

bool OpaqueBrowserFrameView::IsMaximized() const {}

bool OpaqueBrowserFrameView::IsMinimized() const {}

bool OpaqueBrowserFrameView::IsFullscreen() const {}

bool OpaqueBrowserFrameView::IsTabStripVisible() const {}

bool OpaqueBrowserFrameView::GetBorderlessModeEnabled() const {}

bool OpaqueBrowserFrameView::IsToolbarVisible() const {}

int OpaqueBrowserFrameView::GetTabStripHeight() const {}

gfx::Size OpaqueBrowserFrameView::GetTabstripMinimumSize() const {}

int OpaqueBrowserFrameView::GetTopAreaHeight() const {}

bool OpaqueBrowserFrameView::UseCustomFrame() const {}

bool OpaqueBrowserFrameView::IsFrameCondensed() const {}

bool OpaqueBrowserFrameView::EverHasVisibleBackgroundTabShapes() const {}

OpaqueBrowserFrameView::FrameButtonStyle
OpaqueBrowserFrameView::GetFrameButtonStyle() const {}

void OpaqueBrowserFrameView::UpdateWindowControlsOverlay(
    const gfx::Rect& bounding_rect) {}

bool OpaqueBrowserFrameView::ShouldDrawRestoredFrameShadow() const {}

#if BUILDFLAG(IS_LINUX)
bool OpaqueBrowserFrameView::IsTiled() const {}
#endif

int OpaqueBrowserFrameView::WebAppButtonHeight() const {}

///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, protected:

// views::View:
void OpaqueBrowserFrameView::OnPaint(gfx::Canvas* canvas) {}

///////////////////////////////////////////////////////////////////////////////
// OpaqueBrowserFrameView, private:

views::Button* OpaqueBrowserFrameView::CreateFrameCaptionButton(
    views::CaptionButtonIcon icon_type,
    int ht_component,
    const gfx::VectorIcon& icon_image) {}

views::Button* OpaqueBrowserFrameView::CreateImageButton(int normal_image_id,
                                                         int hot_image_id,
                                                         int pushed_image_id,
                                                         int mask_image_id,
                                                         ViewID view_id) {}

void OpaqueBrowserFrameView::InitWindowCaptionButton(
    views::Button* button,
    views::Button::PressedCallback callback,
    int accessibility_string_id,
    ViewID view_id) {}

gfx::Size OpaqueBrowserFrameView::GetThemeImageSize(int image_id) {}

int OpaqueBrowserFrameView::CalculateCaptionButtonBackgroundXOffset(
    ViewID view_id) {}

gfx::ImageSkia
OpaqueBrowserFrameView::GetProcessedBackgroundImageForCaptionButon(
    ViewID view_id,
    const gfx::Size& desired_size) {}

gfx::Insets OpaqueBrowserFrameView::FrameBorderInsets(bool restored) const {}

int OpaqueBrowserFrameView::FrameTopBorderThickness(bool restored) const {}

gfx::Rect OpaqueBrowserFrameView::GetIconBounds() const {}

void OpaqueBrowserFrameView::WindowIconPressed() {}

bool OpaqueBrowserFrameView::GetShowWindowTitleBar() const {}

void OpaqueBrowserFrameView::PaintRestoredFrameBorder(
    gfx::Canvas* canvas) const {}

void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(
    gfx::Canvas* canvas) const {}

void OpaqueBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) const {}

void OpaqueBrowserFrameView::
    UpdateCaptionButtonPlaceholderContainerBackground() {}

#if BUILDFLAG(IS_WIN)
void OpaqueBrowserFrameView::
    UpdateCaptionButtonToolTipsForWindowControlsOverlay() {
  if (browser_view()->IsWindowControlsOverlayEnabled()) {
    minimize_button_->SetTooltipText(
        minimize_button_->GetViewAccessibility().GetCachedName());
    maximize_button_->SetTooltipText(
        maximize_button_->GetViewAccessibility().GetCachedName());
    restore_button_->SetTooltipText(
        restore_button_->GetViewAccessibility().GetCachedName());
    close_button_->SetTooltipText(
        close_button_->GetViewAccessibility().GetCachedName());
  } else {
    minimize_button_->SetTooltipText(u"");
    maximize_button_->SetTooltipText(u"");
    restore_button_->SetTooltipText(u"");
    close_button_->SetTooltipText(u"");
  }
}
#endif

BEGIN_METADATA()