mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-10 03:47:44 -03:00
1269 lines
52 KiB
Diff
1269 lines
52 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/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..5db2dac1b2fa2 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() ? 3 : 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() ? 2 : 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;
|
|
}
|
|
@@ -146,7 +168,11 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
|
|
return gfx::Insets::VH(8, 20);
|
|
|
|
case LOCATION_BAR_ICON_INTERIOR_PADDING:
|
|
- return gfx::Insets::VH(2, 2);
|
|
+ if (features::IsThorium2024()) {
|
|
+ return touch_ui ? gfx::Insets::VH(5, 10) : gfx::Insets::VH(4, 8);
|
|
+ } else {
|
|
+ return gfx::Insets::VH(2, 2);
|
|
+ }
|
|
|
|
case LOCATION_BAR_PAGE_INFO_ICON_PADDING:
|
|
return touch_ui ? gfx::Insets::VH(5, 10) : gfx::Insets::VH(4, 4);
|
|
@@ -161,7 +187,8 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
|
|
}
|
|
|
|
case TOOLBAR_BUTTON:
|
|
- return gfx::Insets(touch_ui ? 12 : 7);
|
|
+ return gfx::Insets(touch_ui ? 12
|
|
+ : (features::IsThorium2024() ? 6 : 7));
|
|
|
|
case BROWSER_APP_MENU_CHIP_PADDING:
|
|
if (touch_ui) {
|
|
@@ -178,10 +205,18 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
|
|
}
|
|
|
|
case TOOLBAR_INTERIOR_MARGIN:
|
|
- return touch_ui ? gfx::Insets() : gfx::Insets::VH(6, 5);
|
|
+ if (features::IsThorium2024()) {
|
|
+ return touch_ui ? gfx::Insets() : gfx::Insets::VH(4, 6);
|
|
+ } else {
|
|
+ return touch_ui ? gfx::Insets() : gfx::Insets::VH(6, 5);
|
|
+ }
|
|
|
|
case WEBUI_TAB_STRIP_TOOLBAR_INTERIOR_MARGIN:
|
|
- return gfx::Insets::VH(4, 0);
|
|
+ if (features::IsThorium2024()) {
|
|
+ return gfx::Insets::VH(4, 6);
|
|
+ } else {
|
|
+ return gfx::Insets::VH(4, 0);
|
|
+ }
|
|
}
|
|
NOTREACHED_IN_MIGRATION();
|
|
return gfx::Insets();
|
|
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_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc
|
|
index 89df9a7f7a805..d52782a295e31 100644
|
|
--- a/chrome/browser/ui/tabs/tab_strip_model.cc
|
|
+++ b/chrome/browser/ui/tabs/tab_strip_model.cc
|
|
@@ -1295,6 +1295,7 @@ bool TabStripModel::IsContextMenuCommandEnabled(
|
|
ContextMenuCommand command_id) const {
|
|
DCHECK(command_id > CommandFirst && command_id < CommandLast);
|
|
switch (command_id) {
|
|
+ case CommandNewTabToLeft:
|
|
case CommandNewTabToRight:
|
|
case CommandCloseTab:
|
|
return true;
|
|
@@ -1396,6 +1397,16 @@ void TabStripModel::ExecuteContextMenuCommand(int context_index,
|
|
if (!ContainsIndex(context_index))
|
|
return;
|
|
switch (command_id) {
|
|
+
|
|
+ case CommandNewTabToLeft: {
|
|
+ base::RecordAction(UserMetricsAction("TabContextMenu_NewTab"));
|
|
+ UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", NewTabTypes::NEW_TAB_CONTEXT_MENU,
|
|
+ NewTabTypes::NEW_TAB_ENUM_COUNT);
|
|
+ delegate()->AddTabAt(GURL(), context_index, true,
|
|
+ GetTabGroupForTab(context_index));
|
|
+ break;
|
|
+ }
|
|
+
|
|
case CommandNewTabToRight: {
|
|
base::RecordAction(UserMetricsAction("TabContextMenu_NewTab"));
|
|
UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", NewTabTypes::NEW_TAB_CONTEXT_MENU,
|
|
diff --git a/chrome/browser/ui/tabs/tab_strip_model.h b/chrome/browser/ui/tabs/tab_strip_model.h
|
|
index 7f2f57facf152..3638494eb0dbf 100644
|
|
--- a/chrome/browser/ui/tabs/tab_strip_model.h
|
|
+++ b/chrome/browser/ui/tabs/tab_strip_model.h
|
|
@@ -547,6 +547,7 @@ class TabStripModel : public TabGroupController {
|
|
// for entries in the 'Add to existing group' submenu.
|
|
enum ContextMenuCommand {
|
|
CommandFirst,
|
|
+ CommandNewTabToLeft,
|
|
CommandNewTabToRight,
|
|
CommandReload,
|
|
CommandDuplicate,
|
|
diff --git a/chrome/browser/ui/tabs/tab_style.cc b/chrome/browser/ui/tabs/tab_style.cc
|
|
index b32265fa04597..a23850ecead51 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 = 1;
|
|
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,42 @@ 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 = GetSeparatorMargins().left() +
|
|
+ GetSeparatorSize().width() +
|
|
+ GetSeparatorMargins().right();
|
|
+ return 2 * GetBottomCornerRadius() - total_separator_width;
|
|
+ } else {
|
|
+ const float total_separator_width = GetSeparatorMargins().left() +
|
|
+ GetSeparatorSize().width() +
|
|
+ GetSeparatorMargins().right();
|
|
+ return 2 * GetBottomCornerRadius() - total_separator_width;
|
|
+ }
|
|
}
|
|
|
|
gfx::Size ChromeRefresh2023TabStyle::GetPreviewImageSize() const {
|
|
@@ -124,23 +171,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 (height - GetSeparatorSize().height()) / 2 - 1;
|
|
+ } else {
|
|
+ return 6;
|
|
+ }
|
|
}
|
|
|
|
SkColor ChromeRefresh2023TabStyle::GetTabBackgroundColor(
|
|
@@ -177,11 +244,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/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
|
|
index fd011f8983a1d..8000a05951f9b 100644
|
|
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
|
|
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
|
|
@@ -54,6 +54,7 @@
|
|
#include "chrome/browser/ui/layout_constants.h"
|
|
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_service_factory.h"
|
|
#include "chrome/browser/ui/tabs/tab_strip_model.h"
|
|
+#include "chrome/browser/ui/thorium_2024.h"
|
|
#include "chrome/browser/ui/ui_features.h"
|
|
#include "chrome/browser/ui/view_ids.h"
|
|
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view_observer.h"
|
|
@@ -343,8 +344,8 @@ class BookmarkBarView::ButtonSeparatorView : public views::Separator {
|
|
|
|
public:
|
|
ButtonSeparatorView() {
|
|
- const int leading_padding = 8;
|
|
- const int trailing_padding = 8;
|
|
+ const int leading_padding = features::IsThorium2024() ? 4 : 8;
|
|
+ const int trailing_padding = features::IsThorium2024() ? 3 : 8;
|
|
separator_thickness_ = kBookmarkBarSeparatorThickness;
|
|
const gfx::Insets border_insets =
|
|
gfx::Insets::TLBR(0, leading_padding, 0, trailing_padding);
|
|
@@ -694,7 +695,7 @@ void BookmarkBarView::Layout(PassKey) {
|
|
}
|
|
|
|
int x = GetLeadingMargin();
|
|
- static constexpr int kBookmarkBarTrailingMargin = 8;
|
|
+ static const int kBookmarkBarTrailingMargin = features::IsThorium2024() ? 0 : 8;
|
|
int width = View::width() - x - kBookmarkBarTrailingMargin;
|
|
|
|
const int button_height = GetLayoutConstant(BOOKMARK_BAR_BUTTON_HEIGHT);
|
|
diff --git a/chrome/browser/ui/views/chrome_layout_provider.cc b/chrome/browser/ui/views/chrome_layout_provider.cc
|
|
index 5291d09d2154f..c8cf8e0ad6037 100644
|
|
--- a/chrome/browser/ui/views/chrome_layout_provider.cc
|
|
+++ b/chrome/browser/ui/views/chrome_layout_provider.cc
|
|
@@ -7,6 +7,7 @@
|
|
#include <algorithm>
|
|
|
|
#include "base/feature_list.h"
|
|
+#include "chrome/browser/ui/thorium_2024.h"
|
|
#include "chrome/browser/ui/views/chrome_typography.h"
|
|
#include "components/omnibox/common/omnibox_features.h"
|
|
#include "ui/base/pointer/touch_ui_controller.h"
|
|
@@ -161,7 +162,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/browser_frame_view_layout_linux.cc b/chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
|
|
index af21424e93618..7ab9cd6819469 100644
|
|
--- a/chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
|
|
+++ b/chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
|
|
@@ -73,5 +73,5 @@ gfx::Insets BrowserFrameViewLayoutLinux::RestoredFrameEdgeInsets() const {
|
|
}
|
|
|
|
int BrowserFrameViewLayoutLinux::NonClientExtraTopThickness() const {
|
|
- return delegate_->IsTabStripVisible() ? 0 : kExtraTopBorder;
|
|
+ return (!features::IsThorium2024() && delegate_->IsTabStripVisible()) ? 0 : kExtraTopBorder;
|
|
}
|
|
diff --git a/chrome/browser/ui/views/frame/browser_frame_view_win.cc b/chrome/browser/ui/views/frame/browser_frame_view_win.cc
|
|
index b57fb5baa52a7..4fc9467f16b6c 100644
|
|
--- a/chrome/browser/ui/views/frame/browser_frame_view_win.cc
|
|
+++ b/chrome/browser/ui/views/frame/browser_frame_view_win.cc
|
|
@@ -315,7 +315,9 @@ int BrowserFrameViewWin::NonClientHitTest(const gfx::Point& point) {
|
|
// pixels at the end of the top and bottom edges trigger diagonal resizing.
|
|
constexpr int kResizeCornerWidth = 16;
|
|
|
|
- const int top_border_thickness = GetLayoutConstant(TAB_STRIP_PADDING);
|
|
+ const int top_border_thickness = features::IsThorium2024()
|
|
+ ? GetLayoutConstant(TAB_INACTIVE_PADDING)
|
|
+ : FrameTopBorderThickness(false);
|
|
|
|
const int window_component = GetHTComponentForFrame(
|
|
point, gfx::Insets::TLBR(top_border_thickness, 0, 0, 0),
|
|
@@ -495,7 +497,7 @@ int BrowserFrameViewWin::FrameTopBorderThickness(bool restored) const {
|
|
// default. When maximized, the OS sizes the window such that the border
|
|
// extends beyond the screen edges. In that case, we must return the
|
|
// default value.
|
|
- const int kTopResizeFrameArea = 0;
|
|
+ const int kTopResizeFrameArea = features::IsThorium2024() ? 7 : 0;
|
|
return kTopResizeFrameArea;
|
|
}
|
|
|
|
@@ -555,6 +557,22 @@ int BrowserFrameViewWin::TopAreaHeight(bool restored) const {
|
|
return top;
|
|
}
|
|
|
|
+ // In maximized mode, we do not add any additional thickness to the grab
|
|
+ // handle above the tabs; just return the frame thickness.
|
|
+ if (maximized) {
|
|
+ return top;
|
|
+ }
|
|
+
|
|
+ // Besides the frame border, there's empty space atop the window in restored
|
|
+ // mode, to use to drag the window around.
|
|
+ constexpr int kNonClientRestoredExtraThickness = 6;
|
|
+ int thickness = kNonClientRestoredExtraThickness;
|
|
+ if (EverHasVisibleBackgroundTabShapes() && features::IsThorium2024()) {
|
|
+ thickness =
|
|
+ std::max(thickness, BrowserNonClientFrameView::kMinimumDragHeight);
|
|
+ return top + thickness;
|
|
+ }
|
|
+
|
|
// The tabstrip controls its own top padding.
|
|
return top;
|
|
}
|
|
@@ -803,17 +821,30 @@ void BrowserFrameViewWin::LayoutCaptionButtons() {
|
|
|
|
const gfx::Size preferred_size =
|
|
caption_button_container_->GetPreferredSize();
|
|
+ int height = preferred_size.height();
|
|
+ // We use the standard caption bar height when maximized in tablet mode, which
|
|
+ // is smaller than our preferred button size.
|
|
+ if (IsWebUITabStrip() && IsMaximized()) {
|
|
+ height = std::min(height, TitlebarMaximizedVisualHeight());
|
|
+ }
|
|
+ if (!browser_view()->GetWebAppFrameToolbarPreferredSize().IsEmpty()) {
|
|
+ height = IsMaximized() ? TitlebarMaximizedVisualHeight()
|
|
+ : TitlebarHeight(false) - WindowTopY();
|
|
+ }
|
|
|
|
const int system_caption_buttons_width =
|
|
ShouldBrowserCustomDrawTitlebar(browser_view())
|
|
? 0
|
|
: width() - frame()->GetMinimizeButtonOffset();
|
|
|
|
+ height = features::IsThorium2024() ? std::min(GetFrameHeight(), height)
|
|
+ : GetFrameHeight();
|
|
+
|
|
caption_button_container_->SetBounds(
|
|
CaptionButtonsOnLeadingEdge()
|
|
? system_caption_buttons_width
|
|
: width() - system_caption_buttons_width - preferred_size.width(),
|
|
- WindowTopY(), preferred_size.width(), GetFrameHeight());
|
|
+ WindowTopY(), preferred_size.width(), height);
|
|
}
|
|
|
|
void BrowserFrameViewWin::LayoutClientView() {
|
|
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
|
|
index 480b5be6b3f5e..de3c389d5bdf9 100644
|
|
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
|
|
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
|
|
@@ -280,7 +280,11 @@ int BrowserNonClientFrameViewChromeOS::GetTopInset(bool restored) const {
|
|
}
|
|
|
|
if (browser_view()->GetTabStripVisible()) {
|
|
- return 0;
|
|
+ if (features::IsThorium2024()) {
|
|
+ return header_height - browser_view()->GetTabStripHeight();
|
|
+ } else {
|
|
+ return 0;
|
|
+ }
|
|
}
|
|
|
|
Browser* browser = browser_view()->browser();
|
|
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h
|
|
index 263261b1c8204..93335609f27da 100644
|
|
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h
|
|
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h
|
|
@@ -105,6 +105,8 @@ class BrowserNonClientFrameViewMac : public BrowserNonClientFrameView,
|
|
const gfx::Rect& frame,
|
|
const gfx::Insets& caption_button_insets);
|
|
|
|
+ CGFloat FullscreenBackingBarHeight() const;
|
|
+
|
|
// Calculate the y offset the top UI needs to shift down due to showing the
|
|
// slide down menu bar at the very top in full screen.
|
|
int TopUIFullscreenYOffset() const;
|
|
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
|
|
index 73592431e1d6c..e55efc19bfd88 100644
|
|
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
|
|
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
|
|
@@ -50,6 +50,8 @@ namespace {
|
|
// Keep in sync with web_app_frame_toolbar_browsertest.cc
|
|
constexpr double kTitlePaddingWidthFraction = 0.1;
|
|
|
|
+constexpr int kResizeHandleHeight = 1;
|
|
+
|
|
// Empirical measurements of the traffic lights.
|
|
constexpr int kCaptionButtonsWidth = 52;
|
|
constexpr int kCaptionButtonsInsetsCatalinaOrOlder = 70;
|
|
@@ -225,7 +227,46 @@ void BrowserNonClientFrameViewMac::LayoutWebAppWindowTitle(
|
|
}
|
|
|
|
int BrowserNonClientFrameViewMac::GetTopInset(bool restored) const {
|
|
- return 0;
|
|
+ if (features::IsThorium2024()) {
|
|
+ if (!browser_view()->ShouldDrawTabStrip()) {
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
+ // Mac seems to reserve 1 DIP of the top inset as a resize handle.
|
|
+ const int kTabstripTopInset = 8;
|
|
+ int top_inset = kTabstripTopInset;
|
|
+ if (EverHasVisibleBackgroundTabShapes()) {
|
|
+ top_inset =
|
|
+ std::max(top_inset, BrowserNonClientFrameView::kMinimumDragHeight +
|
|
+ kResizeHandleHeight);
|
|
+ }
|
|
+
|
|
+ // Immersive fullscreen attaches the tab strip to the title bar, no need to
|
|
+ // calculate the y_offset below.
|
|
+ if (browser_view()->UsesImmersiveFullscreenMode()) {
|
|
+ return top_inset;
|
|
+ }
|
|
+
|
|
+ // Calculate the y offset for the tab strip because in fullscreen mode the tab
|
|
+ // strip may need to move under the slide down menu bar.
|
|
+ CGFloat y_offset = TopUIFullscreenYOffset();
|
|
+ if (y_offset > 0) {
|
|
+ // When menubar shows up, we need to update mouse tracking area.
|
|
+ NSWindow* window = GetWidget()->GetNativeWindow().GetNativeNSWindow();
|
|
+ NSRect content_bounds = [[window contentView] bounds];
|
|
+ // Backing bar tracking area uses native coordinates.
|
|
+ CGFloat tracking_height =
|
|
+ FullscreenBackingBarHeight() + top_inset + y_offset;
|
|
+ NSRect backing_bar_area =
|
|
+ NSMakeRect(0, NSMaxY(content_bounds) - tracking_height,
|
|
+ NSWidth(content_bounds), tracking_height);
|
|
+ [fullscreen_toolbar_controller_ updateToolbarFrame:backing_bar_area];
|
|
+ }
|
|
+
|
|
+ return y_offset + top_inset;
|
|
+ } else {
|
|
+ return 0;
|
|
+ }
|
|
}
|
|
|
|
void BrowserNonClientFrameViewMac::UpdateFullscreenTopUI() {
|
|
@@ -488,6 +529,21 @@ void BrowserNonClientFrameViewMac::PaintThemedFrame(gfx::Canvas* canvas) {
|
|
canvas->DrawImageInt(overlay, 0, 0);
|
|
}
|
|
|
|
+CGFloat BrowserNonClientFrameViewMac::FullscreenBackingBarHeight() const {
|
|
+ BrowserView* browser_view = this->browser_view();
|
|
+ DCHECK(browser_view->IsFullscreen());
|
|
+
|
|
+ CGFloat total_height = 0;
|
|
+ if (browser_view->ShouldDrawTabStrip()) {
|
|
+ total_height += browser_view->GetTabStripHeight();
|
|
+ }
|
|
+
|
|
+ if (browser_view->IsToolbarVisible())
|
|
+ total_height += browser_view->toolbar()->bounds().height();
|
|
+
|
|
+ return total_height;
|
|
+}
|
|
+
|
|
int BrowserNonClientFrameViewMac::TopUIFullscreenYOffset() const {
|
|
if (!browser_view()->GetTabStripVisible() ||
|
|
!browser_view()->IsFullscreen() ||
|
|
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
|
|
index ba129325c8700..fbfa68c2e71b1 100644
|
|
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
|
|
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
|
|
@@ -254,7 +254,9 @@ void OpaqueBrowserFrameView::LayoutWebAppWindowTitle(
|
|
}
|
|
|
|
int OpaqueBrowserFrameView::GetTopInset(bool restored) const {
|
|
- return layout_->NonClientTopHeight(restored);
|
|
+ return browser_view()->ShouldDrawTabStrip()
|
|
+ ? layout_->GetTabStripInsetsTop(restored)
|
|
+ : layout_->NonClientTopHeight(restored);
|
|
}
|
|
|
|
void OpaqueBrowserFrameView::UpdateThrobber(bool running) {
|
|
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
|
|
index 67b69d18a802e..f2189d01b206f 100644
|
|
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
|
|
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
|
|
@@ -78,7 +78,7 @@ gfx::Rect OpaqueBrowserFrameViewLayout::GetBoundsForTabStripRegion(
|
|
int total_width) const {
|
|
const int x = available_space_leading_x_;
|
|
const int available_width = available_space_trailing_x_ - x;
|
|
- return gfx::Rect(x, NonClientTopHeight(false), std::max(0, available_width),
|
|
+ return gfx::Rect(x, GetTabStripInsetsTop(false), std::max(0, available_width),
|
|
tabstrip_minimum_size.height());
|
|
}
|
|
|
|
@@ -181,6 +181,15 @@ int OpaqueBrowserFrameViewLayout::NonClientTopHeight(bool restored) const {
|
|
kContentEdgeShadowThickness;
|
|
}
|
|
|
|
+int OpaqueBrowserFrameViewLayout::GetTabStripInsetsTop(bool restored) const {
|
|
+ const int top = NonClientTopHeight(restored);
|
|
+ const bool start_at_top_of_frame = !restored &&
|
|
+ delegate_->IsFrameCondensed() &&
|
|
+ features::IsThorium2024();
|
|
+ return start_at_top_of_frame ? top
|
|
+ : (top + GetNonClientRestoredExtraThickness());
|
|
+}
|
|
+
|
|
gfx::Insets OpaqueBrowserFrameViewLayout::FrameEdgeInsets(bool restored) const {
|
|
return IsFrameEdgeVisible(restored) ? RestoredFrameEdgeInsets()
|
|
: gfx::Insets();
|
|
@@ -190,7 +199,12 @@ int OpaqueBrowserFrameViewLayout::DefaultCaptionButtonY(bool restored) const {
|
|
// Maximized buttons start at window top, since the window has no border. This
|
|
// offset is for the image (the actual clickable bounds extend all the way to
|
|
// the top to take Fitts' Law into account).
|
|
- return views::NonClientFrameView::kFrameShadowThickness;
|
|
+ const bool start_at_top_of_frame = !restored &&
|
|
+ delegate_->IsFrameCondensed() &&
|
|
+ features::IsThorium2024();
|
|
+ return start_at_top_of_frame
|
|
+ ? FrameBorderInsets(false).top()
|
|
+ : views::NonClientFrameView::kFrameShadowThickness;
|
|
}
|
|
|
|
int OpaqueBrowserFrameViewLayout::CaptionButtonY(views::FrameButton button_id,
|
|
@@ -236,6 +250,21 @@ int OpaqueBrowserFrameViewLayout::GetWindowCaptionSpacing(
|
|
return 0;
|
|
}
|
|
|
|
+int OpaqueBrowserFrameViewLayout::GetNonClientRestoredExtraThickness() const {
|
|
+ // In Refresh, the tabstrip controls its own top padding.
|
|
+ if (!features::IsThorium2024()) {
|
|
+ return 0;
|
|
+ }
|
|
+ // Besides the frame border, there's empty space atop the window in restored
|
|
+ // mode, to use to drag the window around.
|
|
+ int thickness = 6;
|
|
+ if (delegate_->EverHasVisibleBackgroundTabShapes()) {
|
|
+ thickness =
|
|
+ std::max(thickness, BrowserNonClientFrameView::kMinimumDragHeight);
|
|
+ }
|
|
+ return thickness;
|
|
+}
|
|
+
|
|
void OpaqueBrowserFrameViewLayout::SetWindowControlsOverlayEnabled(
|
|
bool enabled,
|
|
views::View* host) {
|
|
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h
|
|
index 707226e0e8c70..5e1a2b4dd9921 100644
|
|
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h
|
|
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h
|
|
@@ -89,6 +89,8 @@ class OpaqueBrowserFrameViewLayout : public views::LayoutManager {
|
|
// if the window was restored, regardless of its current state.
|
|
int NonClientTopHeight(bool restored) const;
|
|
|
|
+ int GetTabStripInsetsTop(bool restored) const;
|
|
+
|
|
// Returns the y-coordinate of the caption button when native frame buttons
|
|
// are disabled. If |restored| is true, acts as if the window is restored
|
|
// regardless of the real mode.
|
|
@@ -125,6 +127,9 @@ class OpaqueBrowserFrameViewLayout : public views::LayoutManager {
|
|
|
|
const gfx::Rect& client_view_bounds() const { return client_view_bounds_; }
|
|
|
|
+ // Returns the extra thickness of the area above the tabs.
|
|
+ int GetNonClientRestoredExtraThickness() const;
|
|
+
|
|
// Enables or disables WCO and updates child views accordingly.
|
|
void SetWindowControlsOverlayEnabled(bool enabled, views::View* host);
|
|
|
|
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..9b81a22dc946d 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),
|
|
+ 0);
|
|
|
|
gfx::Rect new_tab_button_new_bounds =
|
|
gfx::Rect(new_tab_button_new_position, new_tab_button_size);
|
|
@@ -504,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
|
|
@@ -530,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 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/tab_search_bubble_host.cc b/chrome/browser/ui/views/tab_search_bubble_host.cc
|
|
index fa14797259775..6031b27d539e6 100644
|
|
--- a/chrome/browser/ui/views/tab_search_bubble_host.cc
|
|
+++ b/chrome/browser/ui/views/tab_search_bubble_host.cc
|
|
@@ -202,7 +202,7 @@ bool TabSearchBubbleHost::ShowTabSearchBubble(
|
|
// Place the anchor similar to where the button would be in non-fullscreen
|
|
// mode.
|
|
const gfx::Rect bounds = button_->GetWidget()->GetWorkAreaBoundsInScreen();
|
|
- const int offset = GetLayoutConstant(TAB_STRIP_PADDING);
|
|
+ const int offset = GetLayoutConstant(TAB_INACTIVE_PADDING);
|
|
|
|
const int x = tabs::GetTabSearchTrailingTabstrip(profile_)
|
|
? bounds.right() - offset
|
|
diff --git a/chrome/browser/ui/views/tabs/tab_style_views.cc b/chrome/browser/ui/views/tabs/tab_style_views.cc
|
|
index 65676013fece9..476f9ae26f17e 100644
|
|
--- a/chrome/browser/ui/views/tabs/tab_style_views.cc
|
|
+++ b/chrome/browser/ui/views/tabs/tab_style_views.cc
|
|
@@ -18,6 +18,7 @@
|
|
#include "chrome/browser/ui/layout_constants.h"
|
|
#include "chrome/browser/ui/tabs/tab_style.h"
|
|
#include "chrome/browser/ui/tabs/tab_types.h"
|
|
+#include "chrome/browser/ui/thorium_2024.h"
|
|
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
|
|
#include "chrome/browser/ui/views/frame/browser_view.h"
|
|
#include "chrome/browser/ui/views/frame/top_container_background.h"
|
|
@@ -244,7 +245,8 @@ SkPath TabStyleViewsImpl::GetPath(TabStyle::PathType path_type,
|
|
// this. Detached tab shapes do not need to respect this.
|
|
if (path_type != TabStyle::PathType::kInteriorClip &&
|
|
path_type != TabStyle::PathType::kHitTest) {
|
|
- tab_height -= GetLayoutConstant(TAB_STRIP_PADDING) * scale;
|
|
+ // Keep this in Thorium
|
|
+ tab_height -= GetLayoutConstant(TAB_MARGIN) * scale;
|
|
tab_height -= GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP) * scale;
|
|
}
|
|
|
|
@@ -254,8 +256,10 @@ SkPath TabStyleViewsImpl::GetPath(TabStyle::PathType path_type,
|
|
}
|
|
|
|
int left = aligned_bounds.x() + extension_corner_radius;
|
|
- int top = aligned_bounds.y() + GetLayoutConstant(TAB_STRIP_PADDING) * scale;
|
|
+ // Keep this in Thorium
|
|
+ int top = aligned_bounds.y() + GetLayoutConstant(TAB_INACTIVE_PADDING) * scale;
|
|
int right = aligned_bounds.right() - extension_corner_radius;
|
|
+ // Keep this in Thorium
|
|
const int bottom = top + tab_height;
|
|
|
|
// For maximized and full screen windows, extend the tab hit test to the top
|
|
@@ -263,7 +267,8 @@ SkPath TabStyleViewsImpl::GetPath(TabStyle::PathType path_type,
|
|
// tabs by moving the mouse to the top of the screen.
|
|
if (path_type == TabStyle::PathType::kHitTest &&
|
|
tab()->controller()->IsFrameCondensed()) {
|
|
- top -= GetLayoutConstant(TAB_STRIP_PADDING) * scale;
|
|
+ // Keep this in Thorium
|
|
+ top -= GetLayoutConstant(TAB_MARGIN) * scale;
|
|
// Don't round the top corners to avoid creating dead space between tabs.
|
|
top_content_corner_radius = 0;
|
|
}
|
|
@@ -298,6 +303,13 @@ SkPath TabStyleViewsImpl::GetPath(TabStyle::PathType path_type,
|
|
}
|
|
}
|
|
|
|
+ if (features::IsThorium2024()) {
|
|
+ const int Th24StrokeOffset = 1;
|
|
+ top -= Th24StrokeOffset;
|
|
+ // Experimental int
|
|
+ //bottom -= tab()->controller()->Th24StrokeOffset();
|
|
+ }
|
|
+
|
|
// Radii are clockwise from top left.
|
|
const SkVector radii[4] = {
|
|
SkVector(top_content_corner_radius, top_content_corner_radius),
|
|
@@ -731,6 +743,11 @@ float TabStyleViewsImpl::GetSeparatorOpacity(bool for_layout,
|
|
const Tab* const adjacent_tab =
|
|
tab()->controller()->GetAdjacentTab(tab(), leading ? -1 : 1);
|
|
|
|
+ // The separator should never appear at the end of the tab strip.
|
|
+ //if (!adjacent_tab && !leading) {
|
|
+ //return 1.0f;
|
|
+ //}
|
|
+
|
|
const Tab* const left_tab = leading ? adjacent_tab : tab();
|
|
const Tab* const right_tab = leading ? tab() : adjacent_tab;
|
|
const bool adjacent_to_header =
|
|
@@ -965,6 +982,9 @@ void TabStyleViewsImpl::PaintTabBackgroundFill(
|
|
cc::PaintFlags flags;
|
|
flags.setAntiAlias(true);
|
|
flags.setColor(GetCurrentTabBackgroundColor(selection_state, hovered));
|
|
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("transparent-tabs") &&
|
|
+ selection_state != TabStyle::TabSelectionState::kActive)
|
|
+ flags.setAlphaf(0.7f);
|
|
canvas->DrawRect(gfx::ScaleToEnclosingRect(tab_->GetLocalBounds(), scale),
|
|
flags);
|
|
}
|
|
diff --git a/ui/base/ui_base_features.cc b/ui/base/ui_base_features.cc
|
|
index ed801f34141da..bc24e8c7dfbe9 100644
|
|
--- a/ui/base/ui_base_features.cc
|
|
+++ b/ui/base/ui_base_features.cc
|
|
@@ -511,6 +511,14 @@ bool IsLacrosColorManagementEnabled() {
|
|
return base::FeatureList::IsEnabled(kLacrosColorManagement);
|
|
}
|
|
|
|
+BASE_FEATURE(kThorium2024,
|
|
+ "Thorium2024",
|
|
+ base::FEATURE_DISABLED_BY_DEFAULT);
|
|
+
|
|
+bool IsThorium2024() {
|
|
+ return base::FeatureList::IsEnabled(kThorium2024);
|
|
+}
|
|
+
|
|
BASE_FEATURE(kBubbleMetricsApi,
|
|
"BubbleMetricsApi",
|
|
base::FEATURE_DISABLED_BY_DEFAULT);
|
|
diff --git a/ui/base/ui_base_features.h b/ui/base/ui_base_features.h
|
|
index 2232cc983adbc..1a2888799934e 100644
|
|
--- a/ui/base/ui_base_features.h
|
|
+++ b/ui/base/ui_base_features.h
|
|
@@ -228,6 +228,10 @@ COMPONENT_EXPORT(UI_BASE_FEATURES) BASE_DECLARE_FEATURE(kLacrosColorManagement);
|
|
COMPONENT_EXPORT(UI_BASE_FEATURES)
|
|
bool IsLacrosColorManagementEnabled();
|
|
|
|
+// Used to revert some stupid UI decisions for Cr23
|
|
+COMPONENT_EXPORT(UI_BASE_FEATURES) BASE_DECLARE_FEATURE(kThorium2024);
|
|
+COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsThorium2024();
|
|
+
|
|
COMPONENT_EXPORT(UI_BASE_FEATURES)
|
|
BASE_DECLARE_FEATURE(kBubbleMetricsApi);
|
|
|
|
diff --git a/ui/linux/linux_ui_factory.cc b/ui/linux/linux_ui_factory.cc
|
|
index d21456ab73faa..de14c868fcc26 100644
|
|
--- a/ui/linux/linux_ui_factory.cc
|
|
+++ b/ui/linux/linux_ui_factory.cc
|
|
@@ -175,7 +175,7 @@ SystemTheme GetDefaultSystemTheme() {
|
|
case base::nix::DESKTOP_ENVIRONMENT_PANTHEON:
|
|
case base::nix::DESKTOP_ENVIRONMENT_UNITY:
|
|
case base::nix::DESKTOP_ENVIRONMENT_XFCE:
|
|
- return SystemTheme::kGtk;
|
|
+ return SystemTheme::kDefault;
|
|
case base::nix::DESKTOP_ENVIRONMENT_KDE3:
|
|
case base::nix::DESKTOP_ENVIRONMENT_KDE4:
|
|
case base::nix::DESKTOP_ENVIRONMENT_KDE5:
|
|
@@ -183,7 +183,7 @@ SystemTheme GetDefaultSystemTheme() {
|
|
case base::nix::DESKTOP_ENVIRONMENT_UKUI:
|
|
case base::nix::DESKTOP_ENVIRONMENT_DEEPIN:
|
|
case base::nix::DESKTOP_ENVIRONMENT_LXQT:
|
|
- return SystemTheme::kQt;
|
|
+ return SystemTheme::kDefault;
|
|
case base::nix::DESKTOP_ENVIRONMENT_OTHER:
|
|
return SystemTheme::kDefault;
|
|
}
|
|
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..0929f0598d52b 100644
|
|
--- a/ui/views/controls/menu/menu_config_linux.cc
|
|
+++ b/ui/views/controls/menu/menu_config_linux.cc
|
|
@@ -4,12 +4,16 @@
|
|
|
|
#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 = corner_radius > 0;
|
|
+ arrow_to_edge_padding = features::IsThorium2024() ? 2 : 8;
|
|
+ separator_height = features::IsThorium2024() ? 6 : 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";
|