thorium-mirror/other/thorium-2024-ui.patch
Alexander Frick e73346cc8a .170
2024-09-23 15:42:33 -05:00

796 lines
32 KiB
Diff

diff --git a/chrome/browser/resources/downloads/item.html b/chrome/browser/resources/downloads/item.html
index 0197942167f44..9535c3a076409 100644
--- a/chrome/browser/resources/downloads/item.html
+++ b/chrome/browser/resources/downloads/item.html
@@ -523,7 +523,7 @@
</div>
<div class="more-options">
<!-- Only show the "x" button in the old UX. -->
- <template is="dom-if" if="[[!improvedDownloadWarningsUx_]]">
+ <template is="dom-if" if="[[improvedDownloadWarningsUx_]]">
<div role="gridcell">
<cr-icon-button class="icon-clear"
style$="[[computeRemoveStyle_(isDangerous_, showCancel_)]]"
diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc
index 49fd0b0f7a21c..c91d24529eb75 100644
--- a/chrome/browser/themes/theme_service_factory.cc
+++ b/chrome/browser/themes/theme_service_factory.cc
@@ -120,7 +120,7 @@ void ThemeServiceFactory::RegisterProfilePrefs(
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
ui::SystemTheme default_system_theme = ui::SystemTheme::kDefault;
#if BUILDFLAG(IS_LINUX)
- default_system_theme = ui::GetDefaultSystemTheme();
+ default_system_theme = ui::SystemTheme::kDefault;
#endif
registry->RegisterIntegerPref(prefs::kSystemTheme,
static_cast<int>(default_system_theme));
diff --git a/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc b/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc
index 64948595a4bc6..a568c893736ca 100644
--- a/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc
@@ -47,7 +47,7 @@ using bookmarks::BookmarkNode;
namespace chrome {
-size_t kNumBookmarkUrlsBeforePrompting = 15;
+size_t kNumBookmarkUrlsBeforePrompting = 50;
static BookmarkNavigationWrapper* g_nav_wrapper_test_instance = nullptr;
diff --git a/chrome/browser/ui/layout_constants.cc b/chrome/browser/ui/layout_constants.cc
index bba403a7e5068..351e081441698 100644
--- a/chrome/browser/ui/layout_constants.cc
+++ b/chrome/browser/ui/layout_constants.cc
@@ -1,12 +1,14 @@
-// Copyright 2015 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/layout_constants.h"
+#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/notreached.h"
#include "build/build_config.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "chrome/browser/ui/ui_features.h"
#include "components/omnibox/common/omnibox_features.h"
#include "ui/base/pointer/touch_ui_controller.h"
@@ -21,21 +23,25 @@ int GetLayoutConstant(LayoutConstant constant) {
const bool touch_ui = ui::TouchUiController::Get()->touch_ui();
switch (constant) {
case APP_MENU_PROFILE_ROW_AVATAR_ICON_SIZE:
- return 24;
+ return features::IsThorium2024() ? 18 : 24;
case APP_MENU_MAXIMUM_CHARACTER_LENGTH:
return 30;
case BOOKMARK_BAR_HEIGHT: {
// The fixed margin ensures the bookmark buttons appear centered relative
// to the white space above and below.
- const int bookmark_bar_attached_vertical_margin =
- features::IsChromeRefresh2023() ? 6 : 4;
+ const int bookmark_bar_attached_vertical_margin = features::IsThorium2024() ? 4 : 6;
return GetLayoutConstant(BOOKMARK_BAR_BUTTON_HEIGHT) +
bookmark_bar_attached_vertical_margin;
}
- case BOOKMARK_BAR_BUTTON_HEIGHT:
- return touch_ui ? 36 : 28;
+ case BOOKMARK_BAR_BUTTON_HEIGHT: {
+ if (features::IsThorium2024()) {
+ return touch_ui ? 34 : 26;
+ } else {
+ return touch_ui ? 36 : 28;
+ }
+ }
case BOOKMARK_BAR_BUTTON_PADDING:
- return GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
+ return 4;
case BOOKMARK_BAR_BUTTON_IMAGE_LABEL_PADDING:
return features::IsChromeRefresh2023() ? 6 : 8;
case WEB_APP_MENU_BUTTON_SIZE:
@@ -83,6 +89,8 @@ int GetLayoutConstant(LayoutConstant constant) {
return 16;
case TAB_ALERT_INDICATOR_ICON_WIDTH:
return touch_ui ? 12 : 16;
+ case TAB_BUTTON_OFFSET:
+ return features::IsThorium2024() ? -1 : 0;
case TAB_CLOSE_BUTTON_SIZE:
return touch_ui ? 24 : 16;
case TAB_HEIGHT: {
@@ -97,7 +105,13 @@ int GetLayoutConstant(LayoutConstant constant) {
return GetLayoutConstant(TAB_HEIGHT) +
GetLayoutConstant(TAB_STRIP_PADDING);
case TAB_STRIP_PADDING:
- return features::IsChromeRefresh2023() ? 6 : 0;
+ return features::IsThorium2024() ? 0 : 6;
+ case TAB_MARGIN:
+ return features::IsThorium2024() ? 6 : 6;
+ case TAB_INACTIVE_PADDING:
+ return features::IsThorium2024() ? 3 : 6;
+ case TAB_SEARCH_PADDING:
+ return features::IsThorium2024() ? 3 : 6;
case TAB_SEPARATOR_HEIGHT:
// TODO (crbug.com/1451400): ChromeRefresh2023 needs different values for
// this constant.
@@ -125,9 +139,13 @@ int GetLayoutConstant(LayoutConstant constant) {
case TOOLBAR_DIVIDER_CORNER_RADIUS:
return 1;
case TOOLBAR_DIVIDER_HEIGHT:
- return touch_ui ? 20 : 16;
+ if (features::IsThorium2024()) {
+ return 18;
+ } else {
+ return touch_ui ? 20 : 16;
+ }
case TOOLBAR_DIVIDER_SPACING:
- return 9;
+ return features::IsThorium2024() ? 8 : 9;
case TOOLBAR_DIVIDER_WIDTH:
return 2;
case TOOLBAR_ELEMENT_PADDING:
@@ -139,17 +157,17 @@ int GetLayoutConstant(LayoutConstant constant) {
return GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
}
case TOOLBAR_STANDARD_SPACING:
- if (features::IsChromeRefresh2023()) {
+ if (features::IsChromeRefresh2023() && !features::IsThorium2024()) {
return touch_ui ? 12 : 9;
} else {
- return touch_ui ? 12 : 8;
+ return touch_ui ? 12 : 6;
}
case PAGE_INFO_ICON_SIZE:
return features::IsChromeRefresh2023() ? 20 : 16;
case DOWNLOAD_ICON_SIZE:
return features::IsChromeRefresh2023() ? 20 : 16;
case TOOLBAR_CORNER_RADIUS:
- return 8;
+ return 0;
default:
break;
}
diff --git a/chrome/browser/ui/layout_constants.h b/chrome/browser/ui/layout_constants.h
index d26bc737d3177..d1cab25f32356 100644
--- a/chrome/browser/ui/layout_constants.h
+++ b/chrome/browser/ui/layout_constants.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -119,9 +119,21 @@ enum LayoutConstant {
// detached tab, and on all sides of the controls padding.
TAB_STRIP_PADDING,
+ // For the tab margins
+ TAB_MARGIN,
+
+ // For inactive tab padding
+ TAB_INACTIVE_PADDING,
+
// The height of a separator in the tabstrip.
TAB_SEPARATOR_HEIGHT,
+ // Padding for the tab search button
+ TAB_SEARCH_PADDING,
+
+ // Offset y for new tab button
+ TAB_BUTTON_OFFSET,
+
// Padding before the tab title.
TAB_PRE_TITLE_PADDING,
diff --git a/chrome/browser/ui/tabs/tab_menu_model.cc b/chrome/browser/ui/tabs/tab_menu_model.cc
index bec499693cd91..404316da5bcd2 100644
--- a/chrome/browser/ui/tabs/tab_menu_model.cc
+++ b/chrome/browser/ui/tabs/tab_menu_model.cc
@@ -105,6 +105,10 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) {
AddItemWithStringId(TabStripModel::CommandNewTabToRight,
base::i18n::IsRTL() ? IDS_TAB_CXMENU_NEWTABTOLEFT
: IDS_TAB_CXMENU_NEWTABTORIGHT);
+ AddItemWithStringId(TabStripModel::CommandNewTabToLeft,
+ base::i18n::IsRTL() ? IDS_TAB_CXMENU_NEWTABTORIGHT
+ : IDS_TAB_CXMENU_NEWTABTOLEFT);
+ //AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
if (tab_strip->delegate()->SupportsReadLater()) {
AddItem(
TabStripModel::CommandAddToReadLater,
diff --git a/chrome/browser/ui/tabs/tab_style.cc b/chrome/browser/ui/tabs/tab_style.cc
index aa9cd30374311..92cb6c3e0932c 100644
--- a/chrome/browser/ui/tabs/tab_style.cc
+++ b/chrome/browser/ui/tabs/tab_style.cc
@@ -1,27 +1,32 @@
-// Copyright 2019 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/tabs/tab_style.h"
#include "chrome/browser/ui/layout_constants.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "chrome/browser/ui/ui_features.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider.h"
#include "ui/views/layout/layout_provider.h"
namespace {
-
// Thickness in DIPs of the separator painted on the left and right edges of
// the tab.
constexpr int kGM2SeparatorThickness = 1;
+constexpr int kThoriumSeparatorThickness = 1;
constexpr int kChromeRefreshSeparatorThickness = 2;
+constexpr int kThoriumSeparatorHorizontalMargin = 0;
constexpr int kChromeRefreshSeparatorHorizontalMargin = 2;
// TODO (crbug.com/1451400): This constant should be in LayoutConstants.
+constexpr int kThoriumSeparatorHeight = 20;
constexpr int kChromeRefreshSeparatorHeight = 16;
// The padding from the top of the tab to the content area.
+constexpr int kThoriumTabVerticalPadding = 9;
constexpr int kChromeRefreshTabVerticalPadding = 6;
+constexpr int kThoriumTabHorizontalPadding = 6;
constexpr int kChromeRefreshTabHorizontalPadding = 8;
class GM2TabStyle : public TabStyle {
@@ -70,8 +75,26 @@ class ChromeRefresh2023TabStyle : public GM2TabStyle {
TabStyle::~TabStyle() = default;
int GM2TabStyle::GetStandardWidth() const {
+
+ const std::string custom_tab_width = base::CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII("custom-tab-width");
+ int kTabWidthValue = 240;
+ if (custom_tab_width == "60") {
+ kTabWidthValue = 60;
+ } else if (custom_tab_width == "120") {
+ kTabWidthValue = 120;
+ } else if (custom_tab_width == "240") {
+ kTabWidthValue = 240;
+ } else if (custom_tab_width == "300") {
+ kTabWidthValue = 300;
+ } else if (custom_tab_width == "400") {
+ kTabWidthValue = 400;
+ } else {
+ kTabWidthValue = 240;
+ }
+
// The standard tab width is 240 DIP including both separators.
- constexpr int kTabWidth = 240;
+ const int kTabWidth = kTabWidthValue;
// The overlap includes one separator, so subtract it here.
return kTabWidth + GetTabOverlap() - GetSeparatorSize().width();
}
@@ -197,47 +220,97 @@ float GM2TabStyle::GetSelectedTabOpacity() const {
}
int ChromeRefresh2023TabStyle::GetTopCornerRadius() const {
- return 10;
+ static const bool rectangular_tabs =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
+ if (features::IsThorium2024() && !rectangular_tabs) {
+ return 8;
+ } else if ((rectangular_tabs && features::IsThorium2024()) || (rectangular_tabs && !features::IsThorium2024())) {
+ return 3;
+ } else {
+ return 10;
+ }
}
int ChromeRefresh2023TabStyle::GetBottomCornerRadius() const {
- return 12;
+ static const bool rectangular_tabs =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
+ if (features::IsThorium2024() && !rectangular_tabs) {
+ return 10;
+ } else if ((rectangular_tabs && features::IsThorium2024()) || (rectangular_tabs && !features::IsThorium2024())) {
+ return 3;
+ } else {
+ return 12;
+ }
}
int ChromeRefresh2023TabStyle::GetTabOverlap() const {
- // The overlap removes the width and the margins of the separator.
- const float total_separator_width = GetSeparatorMargins().left() +
- GetSeparatorSize().width() +
- GetSeparatorMargins().right();
- return 2 * GetBottomCornerRadius() - total_separator_width;
+ if (features::IsThorium2024()) {
+ const float total_separator_width = GetSeparatorSize().width() +
+ GetSeparatorSize().width();
+ return 2 * GetBottomCornerRadius() - total_separator_width;
+ } else {
+ // The overlap removes the width and the margins of the separator.
+ const float total_separator_width = GetSeparatorMargins().left() +
+ GetSeparatorSize().width() +
+ GetSeparatorMargins().right();
+ return 2 * GetBottomCornerRadius() - total_separator_width;
+ }
}
gfx::Size ChromeRefresh2023TabStyle::GetSeparatorSize() const {
- return gfx::Size(kChromeRefreshSeparatorThickness,
- kChromeRefreshSeparatorHeight);
+ if (features::IsThorium2024()) {
+ return gfx::Size(kThoriumSeparatorThickness,
+ kThoriumSeparatorHeight);
+ } else {
+ return gfx::Size(kChromeRefreshSeparatorThickness,
+ kChromeRefreshSeparatorHeight);
+ }
}
gfx::Insets ChromeRefresh2023TabStyle::GetContentsInsets() const {
- return gfx::Insets::TLBR(
- kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
- GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding,
- kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
- GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding);
+ if (features::IsThorium2024()) {
+ return gfx::Insets::TLBR(
+ kThoriumTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kThoriumTabHorizontalPadding,
+ kThoriumTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kThoriumTabHorizontalPadding);
+ } else {
+ return gfx::Insets::TLBR(
+ kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding,
+ kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding);
+ }
}
gfx::Insets ChromeRefresh2023TabStyle::GetSeparatorMargins() const {
- return gfx::Insets::TLBR(GetLayoutConstant(TAB_STRIP_PADDING),
- kChromeRefreshSeparatorHorizontalMargin,
- GetLayoutConstant(TAB_STRIP_PADDING),
- kChromeRefreshSeparatorHorizontalMargin);
+ if (features::IsThorium2024()) {
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_INACTIVE_PADDING),
+ kThoriumSeparatorHorizontalMargin,
+ GetLayoutConstant(TAB_INACTIVE_PADDING),
+ kThoriumSeparatorHorizontalMargin);
+ } else {
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_STRIP_PADDING),
+ kChromeRefreshSeparatorHorizontalMargin,
+ GetLayoutConstant(TAB_STRIP_PADDING),
+ kChromeRefreshSeparatorHorizontalMargin);
+ }
}
int ChromeRefresh2023TabStyle::GetSeparatorCornerRadius() const {
- return GetSeparatorSize().width() / 2;
+ if (features::IsThorium2024()) {
+ return 0;
+ } else {
+ return GetSeparatorSize().width() / 2;
+ }
}
int ChromeRefresh2023TabStyle::GetDragHandleExtension(int height) const {
- return 6;
+ if (features::IsThorium2024()) {
+ return 12;
+ } else {
+ return 6;
+ }
}
SkColor ChromeRefresh2023TabStyle::GetTabBackgroundColor(
diff --git a/chrome/browser/ui/thorium_2024.h b/chrome/browser/ui/thorium_2024.h
new file mode 100644
index 0000000000000..de40b42fcc722
--- /dev/null
+++ b/chrome/browser/ui/thorium_2024.h
@@ -0,0 +1,14 @@
+// Copyright 2024 Alex313031
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_THORIUM_2024_UI_H_
+#define CHROME_BROWSER_UI_THORIUM_2024_UI_H_
+
+#include "base/command_line.h"
+#include "ui/base/ui_base_features.h"
+
+// Blanking out until moving file to //ui/base
+//static const bool thor24 = features::IsThorium2024();
+
+#endif // CHROME_BROWSER_UI_THORIUM_2024_UI_H_
diff --git a/chrome/browser/ui/views/chrome_layout_provider.cc b/chrome/browser/ui/views/chrome_layout_provider.cc
index efe87aa6d6dd6..600a4c7aeb05f 100644
--- a/chrome/browser/ui/views/chrome_layout_provider.cc
+++ b/chrome/browser/ui/views/chrome_layout_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -176,7 +176,7 @@ int ChromeLayoutProvider::GetDistanceMetric(int metric) const {
case DISTANCE_INFOBAR_HEIGHT:
// Spec says height of button should be 36dp, vertical padding on both
// top and bottom should be 8dp.
- return 36 + 2 * 8;
+ return features::IsThorium2024() ? 42 : 36 + 2 * 8;
case DISTANCE_PERMISSION_PROMPT_HORIZONTAL_ICON_LABEL_PADDING:
return features::IsChromeRefresh2023()
? 8
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.cc b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
index f534d7e925b86..53a9741048850 100644
--- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -222,7 +222,7 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr<TabStrip> tab_strip)
if (features::IsChromeRefresh2023()) {
tab_search_container_->SetProperty(
views::kMarginsKey,
- gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_STRIP_PADDING)));
+ gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_SEARCH_PADDING)));
} else {
const gfx::Insets control_padding = gfx::Insets::TLBR(
0, 0, 0, GetLayoutConstant(TABSTRIP_REGION_VIEW_CONTROL_PADDING));
@@ -357,7 +357,8 @@ void TabStripRegionView::Layout(PassKey) {
int product_specifications_button_width =
product_specifications_button_
? product_specifications_button_->GetPreferredSize().width()
- : 0;
+ : features::IsThorium2024() ? GetLayoutConstant(TAB_SEARCH_PADDING)
+ : 0;
AdjustViewBoundsRect(tab_search_container_,
product_specifications_button_width);
}
@@ -372,8 +373,8 @@ void TabStripRegionView::Layout(PassKey) {
gfx::Point new_tab_button_new_position =
gfx::Point(tab_strip_container_->bounds().right() -
TabStyle::Get()->GetBottomCornerRadius() +
- GetLayoutConstant(TAB_STRIP_PADDING),
- 0);
+ GetLayoutConstant(TAB_MARGIN),
+ GetLayoutConstant(TAB_BUTTON_OFFSET));
gfx::Rect new_tab_button_new_bounds =
gfx::Rect(new_tab_button_new_position, new_tab_button_size);
@@ -476,7 +477,9 @@ void TabStripRegionView::UpdateButtonBorders() {
// definitely isn't what we want in the scrolling case, so this naive approach
// should be improved, likely by taking the scroll state of the tabstrip into
// account.
- const auto border_insets = gfx::Insets::TLBR(top_inset, 0, bottom_inset, 0);
+ const auto border_insets =
+ gfx::Insets::TLBR(top_inset, 0, bottom_inset,
+ features::IsThorium2024() ? 8 : 0);
if (new_tab_button_) {
new_tab_button_->SetBorder(views::CreateEmptyBorder(border_insets));
}
@@ -502,7 +505,7 @@ void TabStripRegionView::UpdateTabStripMargin() {
new_tab_button_->SetProperty(views::kViewIgnoredByLayoutKey, true);
tab_strip_right_margin = new_tab_button_->GetPreferredSize().width() +
- GetLayoutConstant(TAB_STRIP_PADDING);
+ GetLayoutConstant(TAB_MARGIN);
}
// If the tab search button is before the tab strip, it also overlaps the
@@ -528,8 +531,8 @@ void TabStripRegionView::UpdateTabStripMargin() {
// should have 6 px of padding between it and the tab_search button (not
// including the corner radius).
tab_strip_left_margin = tab_strip_left_margin.value() +
- GetLayoutConstant(TAB_STRIP_PADDING) +
- GetLayoutConstant(TAB_STRIP_PADDING) -
+ GetLayoutConstant(TAB_INACTIVE_PADDING) +
+ GetLayoutConstant(TAB_INACTIVE_PADDING) -
TabStyle::Get()->GetBottomCornerRadius();
}
diff --git a/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc b/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc
index 66e38eaf7a5e9..6d7e98530ca03 100644
--- a/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc
+++ b/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "ui/accessibility/mojom/ax_node_data.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
+#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/geometry/size.h"
@@ -31,7 +32,7 @@ SidePanelResizeHandle::SidePanelResizeHandle(SidePanel* side_panel)
SetCanProcessEventsWithinSubtree(false);
SetFocusBehavior(FocusBehavior::ALWAYS);
FocusRing::Install(this);
- if (lens::features::IsLensOverlayEnabled()) {
+ if (lens::features::IsLensOverlayEnabled() && !features::IsThorium2024()) {
const int resize_handle_left_margin = 2;
SetProperty(views::kMarginsKey,
gfx::Insets().set_left(resize_handle_left_margin));
diff --git a/chrome/browser/ui/views/tabs/tab_slot_controller.h b/chrome/browser/ui/views/tabs/tab_slot_controller.h
index e928216ad00f7..4f33e232910c1 100644
--- a/chrome/browser/ui/views/tabs/tab_slot_controller.h
+++ b/chrome/browser/ui/views/tabs/tab_slot_controller.h
@@ -167,6 +167,9 @@ class TabSlotController {
// 0 if there is no stroke.
virtual int GetStrokeThickness() const = 0;
+ // Returns the inactive vertical tab offset when strokes are enabled.
+ virtual int Th24StrokeOffset() const = 0;
+
// Returns true if tab loading throbbers can be painted to a composited layer.
// This can only be done when the TabController can guarantee that nothing
// in the same window will redraw on top of the the favicon area of any tab.
diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h
index ae3b649cfcdc6..3bcf134a9b744 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.h
+++ b/chrome/browser/ui/views/tabs/tab_strip.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -291,6 +291,7 @@ class TabStrip : public views::View,
bool HoverCardIsShowingForTab(Tab* tab) override;
int GetBackgroundOffset() const override;
int GetStrokeThickness() const override;
+ int Th24StrokeOffset() const override;
bool CanPaintThrobberToLayer() const override;
bool HasVisibleBackgroundTabShapes() const override;
SkColor GetTabSeparatorColor() const override;
diff --git a/ui/views/controls/menu/menu_config.cc b/ui/views/controls/menu/menu_config.cc
index 83c7f06f1b236..173b829890079 100644
--- a/ui/views/controls/menu/menu_config.cc
+++ b/ui/views/controls/menu/menu_config.cc
@@ -1,10 +1,11 @@
-// Copyright 2012 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/controls/menu/menu_config.h"
#include "base/no_destructor.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "ui/base/ui_base_features.h"
#include "ui/views/controls/menu/menu_controller.h"
#include "ui/views/controls/menu/menu_item_view.h"
@@ -55,12 +56,12 @@ void MenuConfig::InitCommon() {
reserve_dedicated_arrow_column = false;
menu_horizontal_border_size = 0;
submenu_horizontal_overlap = 0;
- item_vertical_margin = 6;
+ item_vertical_margin = features::IsThorium2024() ? 4 : 6;
item_horizontal_border_padding = 12;
arrow_size = 16;
- separator_height = 17;
- separator_spacing_height = 4;
- use_outer_border = false;
+ separator_height = features::IsThorium2024() ? 11 : 17;
+ separator_spacing_height = features::IsThorium2024() ? 3 : 4;
+ use_outer_border = features::IsThorium2024() ? true : false;
}
// static
diff --git a/ui/views/controls/menu/menu_config_linux.cc b/ui/views/controls/menu/menu_config_linux.cc
index 7bd7c44ffc724..76d7b9ee786ba 100644
--- a/ui/views/controls/menu/menu_config_linux.cc
+++ b/ui/views/controls/menu/menu_config_linux.cc
@@ -1,16 +1,20 @@
-// Copyright 2015 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/controls/menu/menu_config.h"
+#include "chrome/browser/ui/thorium_2024.h"
+#include "ui/base/ui_base_features.h"
#include "ui/ozone/public/ozone_platform.h"
namespace views {
void MenuConfig::InitPlatform() {
- use_bubble_border =
- ui::OzonePlatform::GetInstance()->IsWindowCompositingSupported();
+ use_bubble_border = features::IsThorium2024() ? false
+ : ui::OzonePlatform::GetInstance()->IsWindowCompositingSupported();
+ arrow_to_edge_padding = features::IsThorium2024() ? 2 : 8;
+ separator_height = features::IsThorium2024() ? 4 : 17;
}
} // namespace views
diff --git a/ui/views/controls/menu/menu_config_mac.mm b/ui/views/controls/menu/menu_config_mac.mm
index eabfb364890d3..2374c18b0f3d7 100644
--- a/ui/views/controls/menu/menu_config_mac.mm
+++ b/ui/views/controls/menu/menu_config_mac.mm
@@ -1,17 +1,55 @@
-// Copyright 2014 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#import <AppKit/AppKit.h>
+
+#include "base/mac/mac_util.h"
+#include "chrome/browser/ui/thorium_2024.h"
+#include "ui/base/ui_base_features.h"
#include "ui/views/controls/menu/menu_config.h"
+#include "ui/gfx/platform_font_mac.h"
+
+namespace {
+
+void InitMaterialMenuConfig(views::MenuConfig* config) {
+ // These config parameters are from https://crbug.com/829347 and the spec
+ // images linked from that bug.
+ config->submenu_horizontal_overlap = 0;
+ config->minimum_text_item_height = 28;
+ config->minimum_container_item_height = 40;
+ config->arrow_to_edge_padding = 16;
+ config->separator_height = 9;
+ config->separator_lower_height = 4;
+ config->separator_upper_height = 4;
+ config->separator_spacing_height = 5;
+ config->separator_thickness = 1;
+ config->reserve_dedicated_arrow_column = false;
+ config->icons_in_label = true;
+ config->icon_label_spacing = 8;
+ config->corner_radius = 8;
+ config->auxiliary_corner_radius = 4;
+ config->item_horizontal_border_padding = 0;
+}
+
+} // namespace
+
namespace views {
void MenuConfig::InitPlatform() {
check_selected_combobox_item = true;
- arrow_key_selection_wraps = false;
+ arrow_key_selection_wraps = true;
use_mnemonics = false;
- show_context_menu_accelerators = false;
+ show_context_menu_accelerators = features::IsThorium2024() ? true : false;
all_menus_use_prefix_selection = true;
+ if (features::IsThorium2024()) {
+ menu_horizontal_border_size = 0;
+ }
+ use_outer_border = features::IsThorium2024() ? true : false;
+ if (features::IsThorium2024()) {
+ InitMaterialMenuConfig(this);
+ }
}
} // namespace views
diff --git a/ui/views/controls/menu/menu_config_win.cc b/ui/views/controls/menu/menu_config_win.cc
index a2dae078ccbd3..77881d769bdf0 100644
--- a/ui/views/controls/menu/menu_config_win.cc
+++ b/ui/views/controls/menu/menu_config_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,8 @@
#include <Vssym32.h>
+#include "base/win/windows_version.h"
+#include "ui/base/ui_base_features.h"
#include "ui/gfx/system_fonts_win.h"
namespace views {
@@ -22,9 +24,40 @@ void MenuConfig::InitPlatform() {
show_cues == TRUE);
SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &show_delay, 0);
- separator_upper_height = 5;
- separator_lower_height = 7;
+ bool is_win11 = base::win::GetVersion() >= base::win::Version::WIN11;
+ use_outer_border = features::IsThorium2024() ? true : false;
+
+ if (features::IsThorium2024()) {
+ if (is_win11) {
+ corner_radius = 8;
+ menu_horizontal_border_size = 4;
+ submenu_horizontal_overlap = 1;
+ rounded_menu_vertical_border_size = 4;
+ item_horizontal_padding = 12;
+ between_item_vertical_padding = 2;
+ separator_height = 1;
+ separator_upper_height = 1;
+ separator_lower_height = 1;
+ item_corner_radius = 4;
+ use_outer_border = false;
+ } else {
+ corner_radius = 0;
+ menu_horizontal_border_size = 3;
+ nonrounded_menu_vertical_border_size = 3;
+ item_vertical_margin = 3;
+ item_horizontal_border_padding = -2;
+ icon_label_spacing = 10;
+ always_reserve_check_region = true;
+ separator_height = 7;
+ separator_upper_height = 5;
+ separator_lower_height = 5;
+ use_outer_border = true;
+ }
+ } else {
+ separator_upper_height = 5;
+ separator_lower_height = 7;
+ }
use_bubble_border = corner_radius > 0;
}
diff --git a/ui/views/layout/layout_provider.cc b/ui/views/layout/layout_provider.cc
index 3684e27766834..bb4cc2b2423b2 100644
--- a/ui/views/layout/layout_provider.cc
+++ b/ui/views/layout/layout_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors
+// Copyright 2024 The Chromium Authors and Alex313031
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include "base/containers/fixed_flat_map.h"
#include "base/logging.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/font_list.h"
#include "ui/views/controls/focus_ring.h"
@@ -208,6 +209,37 @@ ShapeSysTokens GetShapeSysToken(ShapeContextTokens id) {
int LayoutProvider::GetCornerRadiusMetric(ShapeContextTokens id,
const gfx::Size& size) const {
+
+ if (features::IsThorium2024()) {
+ switch (id) {
+ case ShapeContextTokens::kBadgeRadius:
+ return 6;
+ case ShapeContextTokens::kButtonRadius:
+ return 4;
+ case ShapeContextTokens::kComboboxRadius:
+ return 6;
+ case ShapeContextTokens::kDialogRadius:
+ return 6;
+ case ShapeContextTokens::kFindBarViewRadius:
+ return 6;
+ case ShapeContextTokens::kMenuRadius:
+ case ShapeContextTokens::kMenuAuxRadius:
+ return 0;
+ case ShapeContextTokens::kMenuTouchRadius:
+ return 8;
+ case ShapeContextTokens::kOmniboxExpandedRadius:
+ return 16;
+ case ShapeContextTokens::kTextfieldRadius:
+ return 8;
+ case ShapeContextTokens::kSidePanelContentRadius:
+ return 16;
+ case ShapeContextTokens::kSidePanelPageContentRadius:
+ return 8;
+ default:
+ return 0;
+ }
+ }
+
if (!features::IsChromeRefresh2023()) {
switch (id) {
case ShapeContextTokens::kBadgeRadius: