helium/ui: keep pinned extensions in CAT & reduce grab handle (#562)

This commit is contained in:
wukko
2025-12-04 21:15:46 +06:00
committed by GitHub
2 changed files with 26 additions and 6 deletions

View File

@@ -197,7 +197,7 @@
show_avatar_button_.Init(
prefs::kShowAvatarButton, prefs,
base::BindRepeating(&ToolbarView::OnShowAvatarButtonChanged,
@@ -573,12 +596,24 @@ void ToolbarView::Init() {
@@ -573,12 +596,27 @@ void ToolbarView::Init() {
InitLayout();
@@ -213,16 +213,19 @@
}
}
+
+ // Pinned actions (including downloads) should not shrink in CAT layout.
+ // Pinned actions (including downloads) and extensions
+ // should not shrink in CAT layout.
+ if (features::IsHeliumCatEnabled()) {
+ pinned_toolbar_actions_container_->SetProperty(
+ views::kFlexBehaviorKey, flex_preferred);
+ extensions_container_->SetProperty(
+ views::kFlexBehaviorKey, flex_preferred);
+ }
+
if (browser_view_->GetSupportsTabStrip()) {
browser()->GetTabStripModel()->AddObserver(this);
}
@@ -703,6 +738,24 @@ bool ToolbarView::IsRectInWindowCaption(
@@ -703,6 +741,24 @@ bool ToolbarView::IsRectInWindowCaption(
return gfx::ToEnclosingRect(rect_in_target_coords_f);
};
@@ -247,7 +250,7 @@
// Check each child view in container_view_ to see if the rect intersects with
// any clickable elements. If it does, check if the click is actually on that
// element. False if on a clickable element, true if not on a clickable element.
@@ -982,8 +1035,12 @@ void ToolbarView::InitLayout() {
@@ -982,8 +1038,12 @@ void ToolbarView::InitLayout() {
constexpr int kToolbarActionsFlexOrder = kOrderOffset + 2;
constexpr int kExtensionsFlexOrder = kOrderOffset + 3;
@@ -261,7 +264,7 @@
views::MaximumFlexSizeRule::kUnbounded)
.WithOrder(kLocationBarFlexOrder);
@@ -999,6 +1056,12 @@ void ToolbarView::InitLayout() {
@@ -999,6 +1059,12 @@ void ToolbarView::InitLayout() {
location_bar_->SetProperty(views::kMarginsKey,
gfx::Insets::VH(0, location_bar_margin));
@@ -338,3 +341,20 @@
}
return !location_bar_model->GetSecureDisplayText().empty();
--- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -85,6 +85,14 @@ class FrameGrabHandle : public views::Vi
// is full.
// TODO(tbergquist): Define this relative to the NTB insets again.
if (base::CommandLine::ForCurrentProcess()->HasSwitch("remove-grab-handle")) return gfx::Size(0, 0);
+
+ // In CAT layout the horizontal space is very tight and toolbar padding
+ // partially makes up for the drag handle area, so we don't reserve extra
+ // space for an additional grab handle here.
+ if (features::IsHeliumCatEnabled()) {
+ return gfx::Size(0, 0);
+ }
+
return gfx::Size(27, 0);
}
};

View File

@@ -5,7 +5,7 @@
// TODO(tbergquist): Define this relative to the NTB insets again.
if (base::CommandLine::ForCurrentProcess()->HasSwitch("remove-grab-handle")) return gfx::Size(0, 0);
- return gfx::Size(42, 0);
+ return gfx::Size(29, 0);
+ return gfx::Size(27, 0);
}
};