#include "chrome/browser/ui/views/frame/browser_view_layout.h"
#include <algorithm>
#include "base/feature_list.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_math.h"
#include "base/observer_list.h"
#include "base/scoped_observation.h"
#include "base/trace_event/common/trace_event_common.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
#include "chrome/browser/ui/views/download/download_shelf_view.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h"
#include "chrome/browser/ui/views/frame/contents_layout_manager.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "chrome/browser/ui/views/frame/tab_strip_region_view.h"
#include "chrome/browser/ui/views/frame/top_container_view.h"
#include "chrome/browser/ui/views/infobars/infobar_container_view.h"
#include "chrome/browser/ui/views/side_panel/side_panel.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_view.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/common/pref_names.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "ui/base/hit_test.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/view_utils.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
#include "ui/views/window/client_view.h"
#include "ui/views/window/hit_test_utils.h"
View;
ModalDialogHostObserver;
WebContentsModalDialogHost;
namespace {
const int kTabShadowSize = …;
const int kConstrainedWindowOverlap = …;
bool ConvertedHitTest(views::View* src, views::View* dst, gfx::Point* point) { … }
}
constexpr int BrowserViewLayout::kMainBrowserContentsMinimumWidth;
class BrowserViewLayout::WebContentsModalDialogHostViews
: public WebContentsModalDialogHost,
public views::WidgetObserver { … };
BrowserViewLayout::BrowserViewLayout(
std::unique_ptr<BrowserViewLayoutDelegate> delegate,
BrowserView* browser_view,
views::View* top_container,
WebAppFrameToolbarView* web_app_frame_toolbar,
views::Label* web_app_window_title,
TabStripRegionView* tab_strip_region_view,
TabStrip* tab_strip,
views::View* toolbar,
InfoBarContainerView* infobar_container,
views::View* contents_container,
views::View* left_aligned_side_panel_separator,
views::View* unified_side_panel,
views::View* right_aligned_side_panel_separator,
views::View* side_panel_rounded_corner,
ImmersiveModeController* immersive_mode_controller,
views::View* contents_separator)
: … { … }
BrowserViewLayout::~BrowserViewLayout() = default;
WebContentsModalDialogHost* BrowserViewLayout::GetWebContentsModalDialogHost() { … }
gfx::Size BrowserViewLayout::GetMinimumSize(const views::View* host) const { … }
void BrowserViewLayout::SetContentBorderBounds(
const std::optional<gfx::Rect>& region_capture_rect) { … }
gfx::NativeView BrowserViewLayout::GetHostView() { … }
int BrowserViewLayout::NonClientHitTest(const gfx::Point& point) { … }
void BrowserViewLayout::Layout(views::View* browser_view) { … }
gfx::Size BrowserViewLayout::GetPreferredSize(
const views::View* host,
const views::SizeBounds& available_size) const { … }
gfx::Size BrowserViewLayout::GetPreferredSize(const views::View* host) const { … }
std::vector<raw_ptr<views::View, VectorExperimental>>
BrowserViewLayout::GetChildViewsInPaintOrder(const views::View* host) const { … }
int BrowserViewLayout::GetMinWebContentsWidthForTesting() const { … }
int BrowserViewLayout::LayoutTitleBarForWebApp(int top) { … }
int BrowserViewLayout::LayoutTabStripRegion(int top) { … }
int BrowserViewLayout::LayoutWebUITabStrip(int top) { … }
int BrowserViewLayout::LayoutToolbar(int top) { … }
int BrowserViewLayout::LayoutBookmarkAndInfoBars(int top, int browser_view_y) { … }
int BrowserViewLayout::LayoutBookmarkBar(int top) { … }
int BrowserViewLayout::LayoutInfoBar(int top) { … }
void BrowserViewLayout::LayoutContentsContainerView(int top, int bottom) { … }
void BrowserViewLayout::LayoutSidePanelView(
views::View* side_panel,
gfx::Rect& contents_container_bounds) { … }
void BrowserViewLayout::UpdateTopContainerBounds() { … }
int BrowserViewLayout::LayoutDownloadShelf(int bottom) { … }
void BrowserViewLayout::LayoutContentBorder() { … }
int BrowserViewLayout::GetClientAreaTop() { … }
int BrowserViewLayout::GetMinWebContentsWidth() const { … }
void BrowserViewLayout::OnCompactModeChanged() { … }
bool BrowserViewLayout::IsInfobarVisible() const { … }