Skip to content

Commit

Permalink
borderless: Pass IsBorderlessModeEnabled to opaque's layout delegate
Browse files Browse the repository at this point in the history
Bug: 1325830
Change-Id: I664bc5998240ffa7698cc544ab4402899fc3911b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4196876
Reviewed-by: Christian Flach <cmfcmf@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Sonja Laurila <laurila@google.com>
Cr-Commit-Position: refs/heads/main@{#1097615}
  • Loading branch information
sonkkeli authored and Chromium LUCI CQ committed Jan 26, 2023
1 parent 83947dd commit 3ac59a6
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate {
bool IsMinimized() const override { return false; }
bool IsFullscreen() const override { return false; }
bool IsTabStripVisible() const override { return true; }
bool GetBorderlessModeEnabled() const override { return false; }
int GetTabStripHeight() const override {
return GetLayoutConstant(TAB_HEIGHT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate {
bool IsMinimized() const override { return false; }
bool IsFullscreen() const override { return false; }
bool IsTabStripVisible() const override { return true; }
bool GetBorderlessModeEnabled() const override { return false; }
int GetTabStripHeight() const override {
return GetLayoutConstant(TAB_HEIGHT);
}
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/ui/views/frame/browser_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,10 @@ class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate {
return browser_view_->GetTabStripVisible();
}

bool GetBorderlessModeEnabled() const override {
return browser_view_->IsBorderlessModeEnabled();
}

gfx::Rect GetBoundsForTabStripRegionInBrowserView() const override {
const gfx::Size tabstrip_minimum_size =
browser_view_->tab_strip_region_view()->GetMinimumSize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class BrowserViewLayoutDelegate {
virtual ~BrowserViewLayoutDelegate() {}

virtual bool IsTabStripVisible() const = 0;
virtual bool GetBorderlessModeEnabled() const = 0;
virtual gfx::Rect GetBoundsForTabStripRegionInBrowserView() const = 0;
virtual int GetTopInsetInBrowserView() const = 0;
virtual int GetThemeBackgroundXInset() const = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class MockBrowserViewLayoutDelegate : public BrowserViewLayoutDelegate {

// BrowserViewLayout::Delegate overrides:
bool IsTabStripVisible() const override { return tab_strip_visible_; }
bool GetBorderlessModeEnabled() const override { return false; }
gfx::Rect GetBoundsForTabStripRegionInBrowserView() const override {
return gfx::Rect();
}
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,10 @@ bool OpaqueBrowserFrameView::IsTabStripVisible() const {
return browser_view()->GetTabStripVisible();
}

bool OpaqueBrowserFrameView::GetBorderlessModeEnabled() const {
return browser_view()->IsBorderlessModeEnabled();
}

bool OpaqueBrowserFrameView::IsToolbarVisible() const {
return browser_view()->IsToolbarVisible() &&
!browser_view()->toolbar()->GetPreferredSize().IsEmpty();
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ui/views/frame/opaque_browser_frame_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
bool IsMinimized() const override;
bool IsFullscreen() const override;
bool IsTabStripVisible() const override;
bool GetBorderlessModeEnabled() const override;
int GetTabStripHeight() const override;
bool IsToolbarVisible() const override;
gfx::Size GetTabstripMinimumSize() const override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class OpaqueBrowserFrameViewLayoutDelegate {
virtual bool IsMaximized() const = 0;
virtual bool IsMinimized() const = 0;
virtual bool IsFullscreen() const = 0;
virtual bool GetBorderlessModeEnabled() const = 0;

virtual bool IsTabStripVisible() const = 0;
virtual int GetTabStripHeight() const = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class TestLayoutDelegate : public OpaqueBrowserFrameViewLayoutDelegate {
bool IsMinimized() const override { return false; }
bool IsFullscreen() const override { return false; }
bool IsTabStripVisible() const override { return window_title_.empty(); }
bool GetBorderlessModeEnabled() const override { return false; }
int GetTabStripHeight() const override {
return IsTabStripVisible() ? GetLayoutConstant(TAB_HEIGHT) : 0;
}
Expand Down

0 comments on commit 3ac59a6

Please sign in to comment.