thorium-mirror/other/thorium-2024-ui.patch
2024-09-24 05:56:24 -05:00

750 lines
30 KiB
Diff

diff --git a/chrome/browser/resources/downloads/item.html b/chrome/browser/resources/downloads/item.html
index eb515155212c9..1bc09f08c8717 100644
--- a/chrome/browser/resources/downloads/item.html
+++ b/chrome/browser/resources/downloads/item.html
@@ -427,6 +427,14 @@
--></div>
</div>
<div class="more-options">
+ <div role="gridcell">
+ <cr-icon-button class="icon-clear"
+ style$="[[computeRemoveStyle_(isDangerous_, showCancel_)]]"
+ id="remove-old" title="$i18n{controlDeleteFromHistory}"
+ aria-label$="$i18n{controlDeleteFromHistory}"
+ on-click="onRemoveClick_" focus-row-control focus-type="remove">
+ </cr-icon-button>
+ </div>
<!-- Menu and/or quick action(s). -->
<div role="gridcell" id="action-icon-buttons">
<cr-icon-button id="more-actions" iron-icon="cr:more-vert"
diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc
index 2c5c526f2a42f..57d16cc46df9a 100644
--- a/chrome/browser/themes/theme_service_factory.cc
+++ b/chrome/browser/themes/theme_service_factory.cc
@@ -123,7 +123,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 ea5c2c05f5fa9..c87e8b6e8fdd6 100644
--- a/chrome/browser/ui/layout_constants.cc
+++ b/chrome/browser/ui/layout_constants.cc
@@ -7,6 +7,7 @@
#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/tabs/features.h"
#include "chrome/browser/ui/ui_features.h"
#include "components/omnibox/common/omnibox_features.h"
@@ -22,20 +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 = 6;
+ 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 features::IsThorium2024() ? 3 : GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
case BOOKMARK_BAR_BUTTON_IMAGE_LABEL_PADDING:
return 6;
case WEB_APP_MENU_BUTTON_SIZE:
@@ -85,6 +91,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:
@@ -93,7 +101,13 @@ int GetLayoutConstant(LayoutConstant constant) {
return GetLayoutConstant(TAB_HEIGHT) +
GetLayoutConstant(TAB_STRIP_PADDING);
case TAB_STRIP_PADDING:
- return 6;
+ 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:
return touch_ui ? 24 : 20;
case TAB_PRE_TITLE_PADDING:
@@ -112,9 +126,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() ? 6 : 9;
case TOOLBAR_DIVIDER_WIDTH:
return 2;
case TOOLBAR_ELEMENT_PADDING:
@@ -122,13 +140,17 @@ int GetLayoutConstant(LayoutConstant constant) {
case TOOLBAR_ICON_DEFAULT_MARGIN:
return touch_ui ? 0 : 2;
case TOOLBAR_STANDARD_SPACING:
- return touch_ui ? 12 : 9;
+ if (features::IsThorium2024()) {
+ return touch_ui ? 12 : 6;
+ } else {
+ return touch_ui ? 12 : 9;
+ }
case PAGE_INFO_ICON_SIZE:
return 20;
case DOWNLOAD_ICON_SIZE:
return 20;
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 a35795ee8cc11..60577ba01a5fd 100644
--- a/chrome/browser/ui/layout_constants.h
+++ b/chrome/browser/ui/layout_constants.h
@@ -123,9 +123,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 d2aae6af7306b..da6152848c9e4 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 b32265fa04597..19c0e56124a5a 100644
--- a/chrome/browser/ui/tabs/tab_style.cc
+++ b/chrome/browser/ui/tabs/tab_style.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/features.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"
@@ -16,13 +17,18 @@ namespace {
// Thickness in DIPs of the separator painted on the left and right edges of
// the tab.
+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 ChromeRefresh2023TabStyle : public TabStyle {
@@ -54,8 +60,26 @@ class ChromeRefresh2023TabStyle : public TabStyle {
TabStyle::~TabStyle() = default;
int ChromeRefresh2023TabStyle::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();
}
@@ -102,19 +126,41 @@ int ChromeRefresh2023TabStyle::GetMinimumInactiveWidth() 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::GetPreviewImageSize() const {
@@ -124,23 +170,43 @@ gfx::Size ChromeRefresh2023TabStyle::GetPreviewImageSize() const {
}
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::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(
@@ -177,11 +243,19 @@ SkColor ChromeRefresh2023TabStyle::GetTabBackgroundColor(
}
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);
+ }
}
float ChromeRefresh2023TabStyle::GetSelectedTabOpacity() const {
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 5291d09d2154f..7cdd069aff2e2 100644
--- a/chrome/browser/ui/views/chrome_layout_provider.cc
+++ b/chrome/browser/ui/views/chrome_layout_provider.cc
@@ -161,7 +161,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 8;
case DISTANCE_RICH_HOVER_BUTTON_ICON_HORIZONTAL:
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 17cbbb1eb7f63..72684ae3a2d92 100644
--- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -227,7 +227,7 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr<TabStrip> tab_strip)
tab_search_container_ = AddChildView(std::move(tab_search_container));
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)));
}
UpdateTabStripMargin();
@@ -356,7 +356,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);
}
@@ -371,8 +372,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);
@@ -478,7 +479,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));
}
@@ -504,7 +507,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
@@ -522,7 +525,8 @@ void TabStripRegionView::UpdateTabStripMargin() {
int product_specifications_button_width =
product_specifications_button_
? product_specifications_button_->GetPreferredSize().width()
- : 0;
+ : features::IsThorium2024() ? GetLayoutConstant(TAB_SEARCH_PADDING)
+ : 0;
tab_strip_left_margin = tab_search_container_->GetPreferredSize().width() +
product_specifications_button_width;
@@ -530,8 +534,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 2ca8611118a21..e360e3afcdc9f 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
@@ -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"
@@ -32,7 +33,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 bbfcdbe0dd95e..169d43261a599 100644
--- a/chrome/browser/ui/views/tabs/tab_slot_controller.h
+++ b/chrome/browser/ui/views/tabs/tab_slot_controller.h
@@ -170,6 +170,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 27b0ff01d4ba9..a7fdc199f873c 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.h
+++ b/chrome/browser/ui/views/tabs/tab_strip.h
@@ -290,6 +290,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 2f1525c8880d4..c7b6d0822ba32 100644
--- a/ui/views/controls/menu/menu_config.cc
+++ b/ui/views/controls/menu/menu_config.cc
@@ -5,6 +5,7 @@
#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"
@@ -64,12 +65,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 09c03d1e87011..d0ebb10c67d67 100644
--- a/ui/views/controls/menu/menu_config_linux.cc
+++ b/ui/views/controls/menu/menu_config_linux.cc
@@ -4,12 +4,17 @@
#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 = true;
+ use_bubble_border = features::IsThorium2024() ? false
+ : true;
+ 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..41e3452b95f5c 100644
--- a/ui/views/controls/menu/menu_config_win.cc
+++ b/ui/views/controls/menu/menu_config_win.cc
@@ -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 01301096ca466..52ba88243bd57 100644
--- a/ui/views/layout/layout_provider.cc
+++ b/ui/views/layout/layout_provider.cc
@@ -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;
+ }
+ }
+
ShapeSysTokens token = GetShapeSysToken(id);
DCHECK_NE(token, ShapeSysTokens::kDefault)
<< "kDefault token means there is a missing mapping between shape tokens";