thorium-mirror/other/thorium-2024-ui.patch

3143 lines
130 KiB
Diff
Raw Normal View History

2024-11-12 23:55:35 -03:00
diff --git a/chrome/browser/extensions/api/messaging/launch_context_win.cc b/chrome/browser/extensions/api/messaging/launch_context_win.cc
index b103bbe61303d..469611cb36e7a 100644
--- a/chrome/browser/extensions/api/messaging/launch_context_win.cc
+++ b/chrome/browser/extensions/api/messaging/launch_context_win.cc
@@ -62,7 +62,7 @@ bool GetManifestPathWithFlags(HKEY root_key,
std::wstring* result) {
#if BUILDFLAG(CHROMIUM_BRANDING)
static constexpr wchar_t kChromiumNativeMessagingRegistryKey[] =
- L"SOFTWARE\\Chromium\\NativeMessagingHosts";
+ L"SOFTWARE\\Thorium\\NativeMessagingHosts";
// Try to read the path using the Chromium-specific registry for Chromium.
// If that fails, fallback to Chrome-specific registry key below.
2024-08-29 00:18:42 -04:00
diff --git a/chrome/browser/resources/downloads/item.html b/chrome/browser/resources/downloads/item.html
2024-11-12 23:55:35 -03:00
index eb515155212c9..0633e101be077 100644
2024-08-29 00:18:42 -04:00
--- a/chrome/browser/resources/downloads/item.html
+++ b/chrome/browser/resources/downloads/item.html
2024-10-27 16:34:01 -03:00
@@ -384,7 +384,7 @@
hidden="[[!shouldShowReferrerUrl_(data.displayReferrerUrl)]]">
<!-- Text populated dynamically -->
</div>
- <a id="url" hidden="[[showReferrerUrl_]]" target="_blank"
+ <a id="url" target="_blank"
on-click="onUrlClick_" focus-row-control
focus-type="url">[[getDisplayUrlStr_(data.displayUrl)]]</a>
</div>
2024-11-12 23:55:35 -03:00
@@ -430,9 +430,6 @@
<!-- Menu and/or quick action(s). -->
<div role="gridcell" id="action-icon-buttons">
<cr-icon-button id="more-actions" iron-icon="cr:more-vert"
- hidden="[[!computeShowActionMenu_(pauseOrResumeText_,
- isDangerous_, isReviewable_, showDeepScan_, showCancel_,
- showOpenAnyway_, data.state, data.retry, data.dangerType)]]"
class="dropdown-trigger" title="$i18n{moreActions}"
on-click="onMoreActionsClick_" aria-haspopup="menu"
focus-row-control focus-type="actionMenuButton">
diff --git a/chrome/browser/resources/pdf/manifest.json b/chrome/browser/resources/pdf/manifest.json
index f355f92ac2f37..e0b69081164fd 100644
--- a/chrome/browser/resources/pdf/manifest.json
+++ b/chrome/browser/resources/pdf/manifest.json
@@ -3,8 +3,8 @@
"manifest_version": 2,
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDN6hM0rsDYGbzQPQfOygqlRtQgKUXMfnSjhIBL7LnReAVBEd7ZmKtyN2qmSasMl4HZpMhVe2rPWVVwBDl6iyNE/Kok6E6v6V3vCLGsOpQAuuNVye/3QxzIldzG/jQAdWZiyXReRVapOhZtLjGfywCvlWq7Sl/e3sbc0vWybSDI2QIDAQAB",
"name": "<NAME>",
- "version": "1",
- "description": "",
+ "version": "1.0.1",
+ "description": "Internal Component Extension for rendering PDFs.",
"offline_enabled": true,
"incognito": "split",
"permissions": [
2024-10-03 08:24:53 -03:00
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index 916e1c043f3e5..9bc0ea94e459a 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -95,17 +95,6 @@ enum NewTabURLState {
NEW_TAB_URL_MAX
};
-const TemplateURL* GetDefaultSearchProviderTemplateURL(Profile* profile) {
- if (profile) {
- TemplateURLService* template_url_service =
- TemplateURLServiceFactory::GetForProfile(profile);
- if (template_url_service) {
- return template_url_service->GetDefaultSearchProvider();
- }
- }
- return nullptr;
-}
-
bool IsMatchingServiceWorker(const GURL& my_url, const GURL& document_url) {
// The origin should match.
if (!MatchesOrigin(my_url, document_url)) {
@@ -142,21 +131,6 @@ bool IsNTPOrRelatedURLHelper(const GURL& url, Profile* profile) {
IsMatchingServiceWorker(url, new_tab_url));
}
-bool IsURLAllowedForSupervisedUser(const GURL& url, Profile& profile) {
- if (!supervised_user::IsSubjectToParentalControls(*profile.GetPrefs())) {
- return true;
- }
- supervised_user::SupervisedUserService* supervised_user_service =
- SupervisedUserServiceFactory::GetForProfile(&profile);
- supervised_user::SupervisedUserURLFilter* url_filter =
- supervised_user_service->GetURLFilter();
- if (url_filter->GetFilteringBehaviorForURL(url) ==
- supervised_user::FilteringBehavior::kBlock) {
- return false;
- }
- return true;
-}
-
// Used to look up the URL to use for the New Tab page. Also tracks how we
// arrived at that URL so it can be logged with UMA.
struct NewTabURLDetails {
@@ -179,33 +153,9 @@ struct NewTabURLDetails {
const GURL local_url(default_is_google
? chrome::kChromeUINewTabPageURL
: chrome::kChromeUINewTabPageThirdPartyURL);
- if (default_is_google) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
- }
#endif
- const TemplateURL* template_url =
- GetDefaultSearchProviderTemplateURL(profile);
- if (!profile || !template_url) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_BAD);
- }
-
- GURL search_provider_url(template_url->new_tab_url_ref().ReplaceSearchTerms(
- TemplateURLRef::SearchTermsArgs(std::u16string()),
- UIThreadSearchTermsData()));
-
- if (!search_provider_url.is_valid()) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_NOT_SET);
- }
- if (!search_provider_url.SchemeIsCryptographic()) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_INSECURE);
- }
- if (!IsURLAllowedForSupervisedUser(search_provider_url,
- CHECK_DEREF(profile))) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_BLOCKED);
- }
-
- return NewTabURLDetails(search_provider_url, NEW_TAB_URL_VALID);
+ return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
}
const GURL url;
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index c54ec37e56ad7..05cdb64f42553 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -5189,6 +5189,8 @@ static_library("ui") {
"views/frame/top_container_view.cc",
"views/frame/top_container_view.h",
"views/frame/top_controls_slide_controller.h",
+ "views/frame/window_caption_util.cc",
+ "views/frame/window_caption_util.h",
"views/frame/web_contents_close_handler.cc",
"views/frame/web_contents_close_handler.h",
"views/frame/web_contents_close_handler_delegate.h",
@@ -5815,6 +5817,8 @@ static_library("ui") {
"views/toolbar/pinned_toolbar_button_status_indicator.h",
"views/toolbar/reload_button.cc",
"views/toolbar/reload_button.h",
+ "views/toolbar/restore_tab_button.cc",
+ "views/toolbar/restore_tab_button.h",
"views/toolbar/toolbar_action_hover_card_bubble_view.cc",
"views/toolbar/toolbar_action_hover_card_bubble_view.h",
"views/toolbar/toolbar_action_hover_card_controller.cc",
2024-10-03 08:24:53 -03:00
diff --git a/chrome/browser/ui/bookmarks/bookmark_utils.cc b/chrome/browser/ui/bookmarks/bookmark_utils.cc
index e7858be996ca8..c0b2695b6e00b 100644
--- a/chrome/browser/ui/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_utils.cc
@@ -318,8 +318,35 @@ ui::ImageModel GetBookmarkFolderIcon(
absl::variant<ui::ColorId, SkColor> color,
const ui::ColorProvider* color_provider) {
gfx::ImageSkia folder;
- folder =
- GetBookmarkFolderImageFromVectorIcon(icon_type, color, color_provider);
+ if (features::IsThorium2024()) {
+#if BUILDFLAG(IS_WIN)
+ // TODO(bsep): vectorize the Windows versions: crbug.com/564112
+ folder = *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ default_id);
+#elif BUILDFLAG(IS_MAC)
+ SkColor sk_color;
+ if (absl::holds_alternative<SkColor>(color)) {
+ sk_color = absl::get<SkColor>(color);
+ } else {
+ DCHECK(color_provider);
+ sk_color = color_provider->GetColor(absl::get<ui::ColorId>(color));
+ }
+ const int white_id = (icon_type == BookmarkFolderIconType::kNormal)
+ ? IDR_FOLDER_CLOSED_WHITE
+ : IDR_BOOKMARK_BAR_FOLDER_MANAGED_WHITE;
+ const int resource_id =
+ color_utils::IsDark(sk_color) ? default_id : white_id;
+ folder = *ui::ResourceBundle::GetSharedInstance()
+ .GetNativeImageNamed(resource_id)
+ .ToImageSkia();
+#else
+ folder = GetBookmarkFolderImageFromVectorIcon(icon_type, color,
+ color_provider);
+#endif
+ } else {
+ folder =
+ GetBookmarkFolderImageFromVectorIcon(icon_type, color, color_provider);
+ }
return gfx::ImageSkia(std::make_unique<RTLFlipSource>(folder),
folder.size());
};
2024-09-20 19:45:53 -03:00
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;
2024-10-03 08:24:53 -03:00
diff --git a/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc b/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc
index 71f9d6ad07da0..246532a09797a 100644
--- a/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc
+++ b/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc
@@ -133,10 +133,6 @@ std::optional<size_t> RecentlyUsedFoldersComboModel::GetDefaultIndex() const {
// TODO(pbos): Look at returning -1 here if there's no default index. Right
// now a lot of code in Combobox assumes an index within `items_` bounds.
auto it = base::ranges::find(items_, Item(parent_node_, Item::TYPE_NODE));
- if (it == items_.end()) {
- it = base::ranges::find(items_,
- Item(parent_node_, Item::TYPE_ALL_BOOKMARKS_NODE));
- }
return it == items_.end() ? 0 : static_cast<int>(it - items_.begin());
}
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 8837e8baf3025..1d95a1a3ddf46 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -1433,7 +1433,8 @@ void BrowserCommandController::InitCommandState() {
command_updater_.UpdateCommandEnabled(IDC_WINDOW_CLOSE_OTHER_TABS,
normal_window);
- const bool enable_tab_search_commands = browser_->is_type_normal();
+ const bool enable_tab_search_commands = browser_->is_type_normal() &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch("remove-tabsearch-button");
command_updater_.UpdateCommandEnabled(IDC_TAB_SEARCH,
enable_tab_search_commands);
command_updater_.UpdateCommandEnabled(IDC_TAB_SEARCH_CLOSE,
diff --git a/chrome/browser/ui/color/chrome_color_mixers.cc b/chrome/browser/ui/color/chrome_color_mixers.cc
index 9698e807b11df..8bb6a245caeba 100644
--- a/chrome/browser/ui/color/chrome_color_mixers.cc
+++ b/chrome/browser/ui/color/chrome_color_mixers.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/ui/color/omnibox_color_mixer.h"
#include "chrome/browser/ui/color/product_specifications_color_mixer.h"
#include "chrome/browser/ui/color/tab_strip_color_mixer.h"
+#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider_utils.h"
namespace {
@@ -59,20 +60,38 @@ void AddChromeColorMixers(ui::ColorProvider* provider,
chrome_color_provider_utils_callbacks;
ui::SetColorProviderUtilsCallbacks(
chrome_color_provider_utils_callbacks.get());
- AddChromeColorMixer(provider, key);
- AddNewTabPageColorMixer(provider, key);
- AddOmniboxColorMixer(provider, key);
- AddProductSpecificationsColorMixer(provider, key);
- AddTabStripColorMixer(provider, key);
-
- AddMaterialChromeColorMixer(provider, key);
- AddMaterialNewTabPageColorMixer(provider, key);
- AddMaterialOmniboxColorMixer(provider, key);
- AddMaterialSidePanelColorMixer(provider, key);
- AddMaterialTabStripColorMixer(provider, key);
-
- // Must be the last one in order to override other mixer colors.
- AddNativeChromeColorMixer(provider, key);
+
+ if (features::IsThorium2024()) {
+ AddMaterialChromeColorMixer(provider, key);
+ AddMaterialNewTabPageColorMixer(provider, key);
+ AddMaterialOmniboxColorMixer(provider, key);
+ AddMaterialSidePanelColorMixer(provider, key);
+ AddMaterialTabStripColorMixer(provider, key);
+
+ AddChromeColorMixer(provider, key);
+ AddNewTabPageColorMixer(provider, key);
+ AddOmniboxColorMixer(provider, key);
+ AddProductSpecificationsColorMixer(provider, key);
+ AddTabStripColorMixer(provider, key);
+
+ // Must be the last one in order to override other mixer colors.
+ AddNativeChromeColorMixer(provider, key);
+ } else {
+ AddChromeColorMixer(provider, key);
+ AddNewTabPageColorMixer(provider, key);
+ AddOmniboxColorMixer(provider, key);
+ AddProductSpecificationsColorMixer(provider, key);
+ AddTabStripColorMixer(provider, key);
+
+ AddMaterialChromeColorMixer(provider, key);
+ AddMaterialNewTabPageColorMixer(provider, key);
+ AddMaterialOmniboxColorMixer(provider, key);
+ AddMaterialSidePanelColorMixer(provider, key);
+ AddMaterialTabStripColorMixer(provider, key);
+
+ // Must be the last one in order to override other mixer colors.
+ AddNativeChromeColorMixer(provider, key);
+ }
if (key.custom_theme) {
key.custom_theme->AddColorMixers(provider, key);
diff --git a/chrome/browser/ui/color/tab_strip_color_mixer.cc b/chrome/browser/ui/color/tab_strip_color_mixer.cc
index 5d93fcf59adb9..9e253359c40a5 100644
--- a/chrome/browser/ui/color/tab_strip_color_mixer.cc
+++ b/chrome/browser/ui/color/tab_strip_color_mixer.cc
@@ -140,10 +140,7 @@ void AddTabStripColorMixer(ui::ColorProvider* provider,
// behavior. The main difference is that the tab hover color in GM2 depends on
// the tab width - narrower tabs have more opacity. We must chooses a single
// opacity, so we go with one towards the more opaque end of the GM2 range.
- mixer[kColorTabBackgroundInactiveHoverFrameActive] = {
- ui::AlphaBlend(kColorTabBackgroundActiveFrameActive,
- kColorTabBackgroundInactiveFrameActive,
- /* 40% opacity */ 0.4 * SK_AlphaOPAQUE)};
+ mixer[kColorTabBackgroundInactiveHoverFrameActive] = {ui::kColorSysStateHeaderHover};
mixer[kColorTabBackgroundInactiveHoverFrameInactive] = {
ui::AlphaBlend(kColorTabBackgroundActiveFrameInactive,
kColorTabBackgroundInactiveFrameInactive,
diff --git a/chrome/browser/ui/frame/window_frame_util.h b/chrome/browser/ui/frame/window_frame_util.h
index e4ccd7fab5421..0eadd6bdd8def 100644
--- a/chrome/browser/ui/frame/window_frame_util.h
+++ b/chrome/browser/ui/frame/window_frame_util.h
@@ -11,6 +11,8 @@ namespace gfx {
class Size;
}
+class Browser;
+
// Static-only class containing values and helper functions for frame classes
// that need to be accessible outside of /browser/ui/views.
class WindowFrameUtil {
2024-08-12 10:53:10 -04:00
diff --git a/chrome/browser/ui/layout_constants.cc b/chrome/browser/ui/layout_constants.cc
index ea5c2c05f5fa9..9efd5e6d241a6 100644
2024-08-12 10:53:10 -04:00
--- a/chrome/browser/ui/layout_constants.cc
+++ b/chrome/browser/ui/layout_constants.cc
2024-09-24 07:56:24 -03:00
@@ -7,6 +7,7 @@
2024-08-12 10:53:10 -04:00
#include "base/feature_list.h"
#include "base/notreached.h"
#include "build/build_config.h"
2024-08-14 23:30:11 -04:00
+#include "chrome/browser/ui/thorium_2024.h"
2024-09-24 07:56:24 -03:00
#include "chrome/browser/ui/tabs/features.h"
2024-08-14 23:30:11 -04:00
#include "chrome/browser/ui/ui_features.h"
#include "components/omnibox/common/omnibox_features.h"
2024-09-24 07:56:24 -03:00
@@ -22,20 +23,25 @@ int GetLayoutConstant(LayoutConstant constant) {
2024-08-23 18:57:48 -04:00
const bool touch_ui = ui::TouchUiController::Get()->touch_ui();
switch (constant) {
case APP_MENU_PROFILE_ROW_AVATAR_ICON_SIZE:
- return 24;
2024-09-01 14:15:48 -04:00
+ return features::IsThorium2024() ? 18 : 24;
2024-08-23 18:57:48 -04:00
case APP_MENU_MAXIMUM_CHARACTER_LENGTH:
return 30;
2024-08-12 10:53:10 -04:00
case BOOKMARK_BAR_HEIGHT: {
// The fixed margin ensures the bookmark buttons appear centered relative
// to the white space above and below.
2024-09-24 07:56:24 -03:00
- const int bookmark_bar_attached_vertical_margin = 6;
2024-09-24 23:18:15 -03:00
+ const int bookmark_bar_attached_vertical_margin = features::IsThorium2024() ? 3 : 6;
2024-08-12 10:53:10 -04:00
return GetLayoutConstant(BOOKMARK_BAR_BUTTON_HEIGHT) +
bookmark_bar_attached_vertical_margin;
}
2024-08-23 18:57:48 -04:00
- 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);
2024-09-24 23:18:15 -03:00
+ return features::IsThorium2024() ? 2 : GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
2024-08-23 18:57:48 -04:00
case BOOKMARK_BAR_BUTTON_IMAGE_LABEL_PADDING:
2024-09-24 07:56:24 -03:00
return 6;
2024-08-23 18:57:48 -04:00
case WEB_APP_MENU_BUTTON_SIZE:
@@ -72,7 +78,11 @@ int GetLayoutConstant(LayoutConstant constant) {
case LOCATION_BAR_TRAILING_DECORATION_INNER_PADDING:
return touch_ui ? 3 : 8;
case LOCATION_BAR_HEIGHT:
- return touch_ui ? 36 : 34;
+ if (features::IsThorium2024()) {
+ return touch_ui ? 34 : 30;
+ } else {
+ return touch_ui ? 36 : 34;
+ }
case LOCATION_BAR_ICON_SIZE:
return touch_ui ? 20 : 16;
case LOCATION_BAR_LEADING_ICON_SIZE:
@@ -85,15 +95,23 @@ int GetLayoutConstant(LayoutConstant constant) {
2024-09-20 19:45:14 -03:00
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;
+ return touch_ui ? 24 : 18;
2024-09-24 07:56:24 -03:00
case TAB_HEIGHT:
return 34 + GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP);
case TAB_STRIP_HEIGHT:
2024-08-12 10:53:10 -04:00
return GetLayoutConstant(TAB_HEIGHT) +
GetLayoutConstant(TAB_STRIP_PADDING);
case TAB_STRIP_PADDING:
2024-09-24 07:56:24 -03:00
- return 6;
2024-08-22 11:02:48 -04:00
+ return features::IsThorium2024() ? 0 : 6;
2024-08-16 23:32:34 -04:00
+ case TAB_MARGIN:
2024-09-20 19:45:14 -03:00
+ return features::IsThorium2024() ? 6 : 6;
2024-08-16 23:32:34 -04:00
+ case TAB_INACTIVE_PADDING:
2024-09-20 19:45:14 -03:00
+ return features::IsThorium2024() ? 3 : 6;
2024-08-17 08:28:28 -04:00
+ case TAB_SEARCH_PADDING:
2024-09-20 19:45:14 -03:00
+ return features::IsThorium2024() ? 3 : 6;
2024-08-12 10:53:10 -04:00
case TAB_SEPARATOR_HEIGHT:
2024-09-24 07:56:24 -03:00
return touch_ui ? 24 : 20;
case TAB_PRE_TITLE_PADDING:
@@ -108,13 +126,21 @@ int GetLayoutConstant(LayoutConstant constant) {
}
return 1;
case TOOLBAR_BUTTON_HEIGHT:
- return touch_ui ? 48 : 34;
+ if (features::IsThorium2024()) {
+ return touch_ui ? 46 : 30;
+ } else {
+ return touch_ui ? 48 : 34;
+ }
2024-08-20 15:26:49 -04:00
case TOOLBAR_DIVIDER_CORNER_RADIUS:
return 1;
case TOOLBAR_DIVIDER_HEIGHT:
- return touch_ui ? 20 : 16;
2024-08-22 11:02:48 -04:00
+ if (features::IsThorium2024()) {
+ return touch_ui ? 20 : 18;
2024-08-20 15:26:49 -04:00
+ } else {
+ return touch_ui ? 20 : 16;
+ }
case TOOLBAR_DIVIDER_SPACING:
- return 9;
2024-10-12 14:02:00 -03:00
+ return features::IsThorium2024() ? 7 : 9;
2024-08-20 15:26:49 -04:00
case TOOLBAR_DIVIDER_WIDTH:
return 2;
case TOOLBAR_ELEMENT_PADDING:
@@ -122,13 +148,17 @@ int GetLayoutConstant(LayoutConstant constant) {
2024-09-24 07:56:24 -03:00
case TOOLBAR_ICON_DEFAULT_MARGIN:
return touch_ui ? 0 : 2;
2024-08-16 23:32:34 -04:00
case TOOLBAR_STANDARD_SPACING:
2024-09-24 07:56:24 -03:00
- return touch_ui ? 12 : 9;
+ if (features::IsThorium2024()) {
+ return touch_ui ? 12 : 7;
2024-09-24 07:56:24 -03:00
+ } else {
+ return touch_ui ? 12 : 9;
+ }
2024-09-01 14:35:00 -04:00
case PAGE_INFO_ICON_SIZE:
2024-09-24 07:56:24 -03:00
return 20;
2024-08-16 23:32:34 -04:00
case DOWNLOAD_ICON_SIZE:
2024-09-24 07:56:24 -03:00
return 20;
2024-08-16 23:32:34 -04:00
case TOOLBAR_CORNER_RADIUS:
2024-08-17 08:28:28 -04:00
- return 8;
2024-09-01 14:35:00 -04:00
+ return 0;
2024-08-16 23:32:34 -04:00
default:
2024-08-17 08:28:28 -04:00
break;
}
@@ -146,7 +176,11 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
2024-09-24 23:18:15 -03:00
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,27 +195,36 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
2024-09-24 23:18:15 -03:00
}
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) {
+ if (touch_ui || features::IsThorium2024()) {
return GetLayoutInsets(TOOLBAR_BUTTON);
} else {
return gfx::Insets::TLBR(7, 4, 7, 6);
}
case AVATAR_CHIP_PADDING:
- if (touch_ui) {
+ if (touch_ui || features::IsThorium2024()) {
return GetLayoutInsets(TOOLBAR_BUTTON);
} else {
return gfx::Insets::TLBR(7, 10, 7, 4);
2024-09-24 23:18:15 -03:00
}
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();
2024-08-14 23:30:11 -04:00
diff --git a/chrome/browser/ui/layout_constants.h b/chrome/browser/ui/layout_constants.h
2024-09-24 07:56:24 -03:00
index a35795ee8cc11..60577ba01a5fd 100644
2024-08-14 23:30:11 -04:00
--- a/chrome/browser/ui/layout_constants.h
+++ b/chrome/browser/ui/layout_constants.h
2024-09-24 07:56:24 -03:00
@@ -123,9 +123,21 @@ enum LayoutConstant {
2024-08-14 23:30:11 -04:00
// detached tab, and on all sides of the controls padding.
TAB_STRIP_PADDING,
2024-08-16 23:32:34 -04:00
+ // For the tab margins
+ TAB_MARGIN,
+
+ // For inactive tab padding
+ TAB_INACTIVE_PADDING,
2024-08-14 23:30:11 -04:00
+
// The height of a separator in the tabstrip.
TAB_SEPARATOR_HEIGHT,
2024-08-17 08:28:28 -04:00
+ // Padding for the tab search button
+ TAB_SEARCH_PADDING,
2024-09-20 19:45:14 -03:00
+
+ // Offset y for new tab button
+ TAB_BUTTON_OFFSET,
2024-08-17 08:28:28 -04:00
+
// Padding before the tab title.
TAB_PRE_TITLE_PADDING,
2024-10-03 08:24:53 -03:00
diff --git a/chrome/browser/ui/status_bubble.h b/chrome/browser/ui/status_bubble.h
index 74a00df155806..00945e93c0afa 100644
--- a/chrome/browser/ui/status_bubble.h
+++ b/chrome/browser/ui/status_bubble.h
@@ -18,7 +18,7 @@ class GURL;
class StatusBubble {
public:
// On hover, expand status bubble to fit long URL after this delay.
- static const int kExpandHoverDelayMS = 1600;
2024-11-12 23:55:35 -03:00
+ static const int kExpandHoverDelayMS = 1;
2024-10-03 08:24:53 -03:00
virtual ~StatusBubble() {}
2024-08-22 15:23:09 -04:00
diff --git a/chrome/browser/ui/tabs/tab_menu_model.cc b/chrome/browser/ui/tabs/tab_menu_model.cc
index d2aae6af7306b..da6152848c9e4 100644
2024-08-22 15:23:09 -04:00
--- a/chrome/browser/ui/tabs/tab_menu_model.cc
+++ b/chrome/browser/ui/tabs/tab_menu_model.cc
2024-08-23 18:57:48 -04:00
@@ -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);
2024-08-22 15:23:09 -04:00
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
2024-10-03 16:13:49 -03:00
@@ -1296,6 +1296,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;
2024-10-03 16:13:49 -03:00
@@ -1397,6 +1398,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,
2024-08-12 10:53:10 -04:00
diff --git a/chrome/browser/ui/tabs/tab_style.cc b/chrome/browser/ui/tabs/tab_style.cc
2024-10-11 21:50:44 -03:00
index b32265fa04597..35e5182f22671 100644
2024-08-12 10:53:10 -04:00
--- a/chrome/browser/ui/tabs/tab_style.cc
+++ b/chrome/browser/ui/tabs/tab_style.cc
2024-09-24 07:56:24 -03:00
@@ -6,6 +6,7 @@
2024-08-14 23:30:11 -04:00
#include "chrome/browser/ui/layout_constants.h"
2024-09-24 07:56:24 -03:00
#include "chrome/browser/ui/tabs/features.h"
2024-08-16 23:32:34 -04:00
+#include "chrome/browser/ui/thorium_2024.h"
2024-08-14 23:30:11 -04:00
#include "chrome/browser/ui/ui_features.h"
#include "ui/base/ui_base_features.h"
2024-08-16 23:32:34 -04:00
#include "ui/color/color_provider.h"
2024-09-24 07:56:24 -03:00
@@ -16,13 +17,18 @@ namespace {
2024-08-14 23:30:11 -04:00
// Thickness in DIPs of the separator painted on the left and right edges of
2024-08-12 10:53:10 -04:00
// the tab.
2024-10-11 21:50:44 -03:00
+constexpr int kThoriumSeparatorThickness = 2;
2024-08-12 10:53:10 -04:00
constexpr int kChromeRefreshSeparatorThickness = 2;
2024-10-11 21:50:44 -03:00
+constexpr float kThoriumSeparatorHorizontalMargin = 0.0f;
2024-08-14 23:30:11 -04:00
constexpr int kChromeRefreshSeparatorHorizontalMargin = 2;
2024-08-12 10:53:10 -04:00
// TODO (crbug.com/1451400): This constant should be in LayoutConstants.
2024-08-14 23:30:11 -04:00
+constexpr int kThoriumSeparatorHeight = 20;
constexpr int kChromeRefreshSeparatorHeight = 16;
2024-08-12 10:53:10 -04:00
// The padding from the top of the tab to the content area.
2024-08-14 23:30:11 -04:00
+constexpr int kThoriumTabVerticalPadding = 9;
constexpr int kChromeRefreshTabVerticalPadding = 6;
2024-08-17 08:28:28 -04:00
+constexpr int kThoriumTabHorizontalPadding = 6;
2024-08-12 10:53:10 -04:00
constexpr int kChromeRefreshTabHorizontalPadding = 8;
2024-09-24 07:56:24 -03:00
class ChromeRefresh2023TabStyle : public TabStyle {
2024-10-03 08:24:53 -03:00
@@ -54,8 +60,28 @@ class ChromeRefresh2023TabStyle : public TabStyle {
TabStyle::~TabStyle() = default;
2024-09-24 07:56:24 -03:00
int ChromeRefresh2023TabStyle::GetStandardWidth() const {
+
+ const std::string custom_tab_width = base::CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII("custom-tab-width");
+ int kTabWidthValue;
+ if (custom_tab_width == "60") {
+ kTabWidthValue = 60;
+ } else if (custom_tab_width == "120") {
+ kTabWidthValue = 120;
2024-10-03 08:24:53 -03:00
+ } else if (custom_tab_width == "180") {
+ kTabWidthValue = 180;
+ } 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();
}
2024-10-03 08:24:53 -03:00
@@ -102,19 +128,42 @@ int ChromeRefresh2023TabStyle::GetMinimumInactiveWidth() const {
2024-08-14 23:30:11 -04:00
}
int ChromeRefresh2023TabStyle::GetTopCornerRadius() const {
- return 10;
2024-08-17 08:28:28 -04:00
+ static const bool rectangular_tabs =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
2024-08-22 11:02:48 -04:00
+ if (features::IsThorium2024() && !rectangular_tabs) {
2024-08-14 23:30:11 -04:00
+ return 8;
2024-08-22 11:02:48 -04:00
+ } else if ((rectangular_tabs && features::IsThorium2024()) || (rectangular_tabs && !features::IsThorium2024())) {
2024-10-11 19:33:00 -03:00
+ return 4;
2024-08-14 23:30:11 -04:00
+ } else {
+ return 10;
+ }
}
int ChromeRefresh2023TabStyle::GetBottomCornerRadius() const {
- return 12;
2024-08-17 08:28:28 -04:00
+ static const bool rectangular_tabs =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
2024-08-22 11:02:48 -04:00
+ if (features::IsThorium2024() && !rectangular_tabs) {
2024-08-17 08:28:28 -04:00
+ return 10;
2024-08-22 11:02:48 -04:00
+ } else if ((rectangular_tabs && features::IsThorium2024()) || (rectangular_tabs && !features::IsThorium2024())) {
2024-10-11 19:33:00 -03:00
+ return 4;
2024-08-14 23:30:11 -04:00
+ } else {
+ return 12;
+ }
}
int ChromeRefresh2023TabStyle::GetTabOverlap() const {
2024-09-24 23:18:15 -03:00
// The overlap removes the width and the margins of the separator.
2024-09-20 19:45:14 -03:00
- const float total_separator_width = GetSeparatorMargins().left() +
- GetSeparatorSize().width() +
- GetSeparatorMargins().right();
- return 2 * GetBottomCornerRadius() - total_separator_width;
+ if (features::IsThorium2024()) {
2024-09-24 23:18:15 -03:00
+ const float total_separator_width = GetSeparatorMargins().left() +
+ GetSeparatorSize().width() +
+ GetSeparatorMargins().right();
2024-09-20 19:45:14 -03:00
+ return 2 * GetBottomCornerRadius() - total_separator_width;
+ } else {
+ const float total_separator_width = GetSeparatorMargins().left() +
+ GetSeparatorSize().width() +
+ GetSeparatorMargins().right();
+ return 2 * GetBottomCornerRadius() - total_separator_width;
+ }
2024-08-14 23:30:11 -04:00
}
2024-09-24 07:56:24 -03:00
gfx::Size ChromeRefresh2023TabStyle::GetPreviewImageSize() const {
2024-10-03 08:24:53 -03:00
@@ -124,23 +173,43 @@ gfx::Size ChromeRefresh2023TabStyle::GetPreviewImageSize() const {
2024-09-24 07:56:24 -03:00
}
2024-08-14 23:30:11 -04:00
gfx::Size ChromeRefresh2023TabStyle::GetSeparatorSize() const {
- return gfx::Size(kChromeRefreshSeparatorThickness,
- kChromeRefreshSeparatorHeight);
2024-08-22 11:02:48 -04:00
+ if (features::IsThorium2024()) {
2024-08-14 23:30:11 -04:00
+ 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);
2024-08-22 11:02:48 -04:00
+ if (features::IsThorium2024()) {
2024-08-16 23:32:34 -04:00
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_INACTIVE_PADDING),
2024-08-14 23:30:11 -04:00
+ kThoriumSeparatorHorizontalMargin,
2024-08-16 23:32:34 -04:00
+ GetLayoutConstant(TAB_INACTIVE_PADDING),
2024-08-14 23:30:11 -04:00
+ kThoriumSeparatorHorizontalMargin);
+ } else {
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_STRIP_PADDING),
+ kChromeRefreshSeparatorHorizontalMargin,
+ GetLayoutConstant(TAB_STRIP_PADDING),
+ kChromeRefreshSeparatorHorizontalMargin);
+ }
}
int ChromeRefresh2023TabStyle::GetSeparatorCornerRadius() const {
2024-09-20 19:45:14 -03:00
- return GetSeparatorSize().width() / 2;
+ if (features::IsThorium2024()) {
+ return 0;
+ } else {
+ return GetSeparatorSize().width() / 2;
+ }
}
int ChromeRefresh2023TabStyle::GetDragHandleExtension(int height) const {
- return 6;
2024-09-20 19:45:53 -03:00
+ if (features::IsThorium2024()) {
2024-09-24 23:18:15 -03:00
+ return (height - GetSeparatorSize().height()) / 2 - 1;
2024-09-20 19:45:53 -03:00
+ } else {
+ return 6;
+ }
2024-09-20 19:45:14 -03:00
}
SkColor ChromeRefresh2023TabStyle::GetTabBackgroundColor(
2024-10-03 08:24:53 -03:00
@@ -177,11 +246,19 @@ SkColor ChromeRefresh2023TabStyle::GetTabBackgroundColor(
2024-09-24 07:56:24 -03:00
}
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 {
2024-09-01 15:48:46 -04:00
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_
2024-10-12 23:06:59 -03:00
diff --git a/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc b/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc
index 6a91493f7c2bc..fdeb2a4a0916e 100644
2024-10-12 23:06:59 -03:00
--- a/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc
+++ b/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc
@@ -49,6 +49,38 @@ const std::vector<LabInfo>& GetData() {
2024-10-12 23:06:59 -03:00
l10n_util::GetStringUTF16(IDS_TABS_SHRINK_TO_LARGE_WIDTH),
l10n_util::GetStringUTF16(IDS_TABS_DO_NOT_SHRINK)};
+ const char kThorium2024FlagId[] = "thorium-2024";
+ const std::u16string kThorium2024FlagName = u"Enable Thorium 2024 UI";
+ const std::u16string kThorium2024FlagDescription = u"Enable an experimental UI, which restores many parts of the pre-Chrome Refresh 2023 UI.";
2024-10-12 23:06:59 -03:00
+
+ lab_info.emplace_back(
+ kThorium2024FlagId,
+ kThorium2024FlagName,
+ kThorium2024FlagDescription,
+ "chrome-labs-thorium-2024", version_info::Channel::BETA);
+
+ const char kRestoreTabsFlagId[] = "restore-tab-button";
+ const std::u16string kRestoreTabsFlagName = u"Restore Tab Button";
+ const std::u16string kRestoreTabsFlagDescription = u"Enable a new toolbar button to restore your recently closed tabs.";
+
+ lab_info.emplace_back(
+ kRestoreTabsFlagId,
+ kRestoreTabsFlagName,
+ kRestoreTabsFlagDescription,
+ "chrome-labs-restore-tab-button", version_info::Channel::BETA);
+
+#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+ const char kMiddleScrollFlagId[] = "middle-click-autoscroll";
+ const std::u16string kMiddleScrollFlagName = u"Middle Click Autoscroll";
+ const std::u16string kMiddleScrollFlagDescription = u"Enables autoscrolling when the middle mouse button is pressed.";
+
+ lab_info.emplace_back(
+ kMiddleScrollFlagId,
+ kMiddleScrollFlagName,
+ kMiddleScrollFlagDescription,
+ "chrome-labs-middle-click-autoscroll", version_info::Channel::BETA);
+#endif
2024-10-12 23:06:59 -03:00
+
lab_info.emplace_back(
flag_descriptions::kScrollableTabStripFlagId,
l10n_util::GetStringUTF16(IDS_TAB_SCROLLING_EXPERIMENT_NAME),
diff --git a/chrome/browser/ui/view_ids.h b/chrome/browser/ui/view_ids.h
index fb9afeed5a60e..d40af6311e073 100644
--- a/chrome/browser/ui/view_ids.h
+++ b/chrome/browser/ui/view_ids.h
@@ -16,6 +16,7 @@ enum ViewID {
// Views which make up the skyline. These are used only
// on views.
+ VIEW_ID_TAB_SEARCH_BUTTON,
VIEW_ID_MINIMIZE_BUTTON,
VIEW_ID_MAXIMIZE_BUTTON,
VIEW_ID_RESTORE_BUTTON,
2024-09-24 23:18:15 -03:00
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);
2024-09-01 14:35:00 -04:00
diff --git a/chrome/browser/ui/views/chrome_layout_provider.cc b/chrome/browser/ui/views/chrome_layout_provider.cc
2024-09-24 23:18:15 -03:00
index 5291d09d2154f..c8cf8e0ad6037 100644
2024-09-01 14:35:00 -04:00
--- a/chrome/browser/ui/views/chrome_layout_provider.cc
+++ b/chrome/browser/ui/views/chrome_layout_provider.cc
2024-09-24 23:18:15 -03:00
@@ -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 {
2024-09-01 14:35:00 -04:00
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;
2024-09-17 01:11:38 -03:00
+ return features::IsThorium2024() ? 42 : 36 + 2 * 8;
2024-09-01 14:35:00 -04:00
case DISTANCE_PERMISSION_PROMPT_HORIZONTAL_ICON_LABEL_PADDING:
2024-09-24 07:56:24 -03:00
return 8;
case DISTANCE_RICH_HOVER_BUTTON_ICON_HORIZONTAL:
diff --git a/chrome/browser/ui/views/frame/browser_caption_button_container_win.cc b/chrome/browser/ui/views/frame/browser_caption_button_container_win.cc
index b4ed00fe214a9..cbd69f5565a61 100644
--- a/chrome/browser/ui/views/frame/browser_caption_button_container_win.cc
+++ b/chrome/browser/ui/views/frame/browser_caption_button_container_win.cc
@@ -10,6 +10,8 @@
#include "chrome/browser/ui/views/frame/browser_frame_view_win.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/windows_caption_button.h"
+#include "chrome/browser/ui/views/frame/window_caption_util.h"
+#include "chrome/browser/ui/views/frame/windows_tab_search_caption_button.h"
#include "chrome/browser/win/titlebar_config.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -66,6 +68,14 @@ BrowserCaptionButtonContainer::BrowserCaptionButtonContainer(
frame_view_,
VIEW_ID_CLOSE_BUTTON,
IDS_APP_ACCNAME_CLOSE))) {
+ if (WindowCaptionUtil::IsWindowsTabSearchCaptionButtonEnabled(
+ frame_view_->browser_view()->browser())) {
+ tab_search_button_ =
+ AddChildViewAt(std::make_unique<WindowsTabSearchCaptionButton>(
+ frame_view_, VIEW_ID_TAB_SEARCH_BUTTON,
+ l10n_util::GetStringUTF16(IDS_ACCNAME_TAB_SEARCH)),
+ 0);
+ }
// Layout is horizontal, with buttons placed at the trailing end of the view.
// This allows the container to expand to become a faux titlebar/drag handle.
auto* const layout = SetLayoutManager(std::make_unique<views::FlexLayout>());
@@ -91,6 +101,9 @@ int BrowserCaptionButtonContainer::NonClientHitTest(
const gfx::Point& point) const {
DCHECK(HitTestPoint(point))
<< "should only be called with a point inside this view's bounds";
+ if (tab_search_button_ && HitTestCaptionButton(tab_search_button_, point)) {
+ return HTCLIENT;
+ }
// BrowserView covers the frame view when Window Controls Overlay is enabled.
// The native window that encompasses Web Contents gets the mouse events meant
// for the caption buttons, so returning HTClient allows these buttons to be
@@ -132,6 +145,11 @@ void BrowserCaptionButtonContainer::OnWindowControlsOverlayEnabledChanged() {
UpdateButtonToolTipsForWindowControlsOverlay();
}
+TabSearchBubbleHost* BrowserCaptionButtonContainer::GetTabSearchBubbleHost() {
+ return tab_search_button_ ? tab_search_button_->tab_search_bubble_host()
+ : nullptr;
+}
+
void BrowserCaptionButtonContainer::OnThemeChanged() {
if (frame_view_->browser_view()->IsWindowControlsOverlayEnabled()) {
SetBackground(
@@ -141,6 +159,9 @@ void BrowserCaptionButtonContainer::OnThemeChanged() {
}
void BrowserCaptionButtonContainer::ResetWindowControls() {
+ if (tab_search_button_) {
+ tab_search_button_->SetState(views::Button::STATE_NORMAL);
+ }
minimize_button_->SetState(views::Button::STATE_NORMAL);
maximize_button_->SetState(views::Button::STATE_NORMAL);
restore_button_->SetState(views::Button::STATE_NORMAL);
diff --git a/chrome/browser/ui/views/frame/browser_caption_button_container_win.h b/chrome/browser/ui/views/frame/browser_caption_button_container_win.h
index bda5b2b0ab02d..a8dac38d7b61b 100644
--- a/chrome/browser/ui/views/frame/browser_caption_button_container_win.h
+++ b/chrome/browser/ui/views/frame/browser_caption_button_container_win.h
@@ -15,7 +15,9 @@
#include "ui/views/widget/widget_observer.h"
class BrowserFrameViewWin;
+class TabSearchBubbleHost;
class WindowsCaptionButton;
+class WindowsTabSearchCaptionButton;
// Provides a container for Windows caption buttons that can be moved between
// frame and browser window as needed. When extended horizontally, becomes a
@@ -38,6 +40,8 @@ class BrowserCaptionButtonContainer : public views::View,
void OnWindowControlsOverlayEnabledChanged();
+ TabSearchBubbleHost* GetTabSearchBubbleHost();
+
private:
friend class BrowserFrameViewWin;
@@ -64,6 +68,7 @@ class BrowserCaptionButtonContainer : public views::View,
void UpdateButtonToolTipsForWindowControlsOverlay();
const raw_ptr<BrowserFrameViewWin> frame_view_;
+ raw_ptr<WindowsTabSearchCaptionButton> tab_search_button_ = nullptr;
const raw_ptr<WindowsCaptionButton> minimize_button_;
const raw_ptr<WindowsCaptionButton> maximize_button_;
const raw_ptr<WindowsCaptionButton> restore_button_;
2024-09-24 23:18:15 -03:00
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..91d0c05d7de91 100644
2024-09-24 23:18:15 -03:00
--- a/chrome/browser/ui/views/frame/browser_frame_view_win.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_view_win.cc
@@ -253,6 +253,10 @@ void BrowserFrameViewWin::WindowControlsOverlayEnabledChanged() {
caption_button_container_->OnWindowControlsOverlayEnabledChanged();
}
+TabSearchBubbleHost* BrowserFrameViewWin::GetTabSearchBubbleHost() {
+ return caption_button_container_->GetTabSearchBubbleHost();
+}
+
void BrowserFrameViewWin::PaintAsActiveChanged() {
BrowserNonClientFrameView::PaintAsActiveChanged();
@@ -315,7 +319,9 @@ int BrowserFrameViewWin::NonClientHitTest(const gfx::Point& point) {
2024-09-24 23:18:15 -03:00
// 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)
2024-10-11 19:33:00 -03:00
+ : GetLayoutConstant(TAB_STRIP_PADDING);
2024-09-24 23:18:15 -03:00
const int window_component = GetHTComponentForFrame(
point, gfx::Insets::TLBR(top_border_thickness, 0, 0, 0),
@@ -495,7 +501,7 @@ int BrowserFrameViewWin::FrameTopBorderThickness(bool restored) const {
2024-09-24 23:18:15 -03:00
// 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;
2024-09-24 23:18:15 -03:00
return kTopResizeFrameArea;
}
@@ -555,6 +561,22 @@ int BrowserFrameViewWin::TopAreaHeight(bool restored) const {
2024-09-24 23:18:15 -03:00
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 = 8;
+ int thickness = kNonClientRestoredExtraThickness;
2024-09-24 23:18:15 -03:00
+ if (EverHasVisibleBackgroundTabShapes() && features::IsThorium2024()) {
+ thickness =
+ std::max(thickness, BrowserNonClientFrameView::kMinimumDragHeight);
+ return top + thickness;
+ }
+
// The tabstrip controls its own top padding.
return top;
}
@@ -803,17 +825,30 @@ void BrowserFrameViewWin::LayoutCaptionButtons() {
2024-09-24 23:18:15 -03:00
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_frame_view_win.h b/chrome/browser/ui/views/frame/browser_frame_view_win.h
index 27caea181a279..d3210e6c02922 100644
--- a/chrome/browser/ui/views/frame/browser_frame_view_win.h
+++ b/chrome/browser/ui/views/frame/browser_frame_view_win.h
@@ -17,6 +17,7 @@
#include "ui/views/window/non_client_view.h"
class BrowserView;
+class TabSearchBubbleHost;
class BrowserCaptionButtonContainer;
class BrowserFrameViewWin : public BrowserNonClientFrameView,
@@ -45,6 +46,7 @@ class BrowserFrameViewWin : public BrowserNonClientFrameView,
void UpdateThrobber(bool running) override;
gfx::Size GetMinimumSize() const override;
void WindowControlsOverlayEnabledChanged() override;
+ TabSearchBubbleHost* GetTabSearchBubbleHost() override;
// views::NonClientFrameView:
gfx::Rect GetBoundsForClientView() const override;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
index ec5bda762caff..7dd040ce66849 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
@@ -202,6 +202,10 @@ void BrowserNonClientFrameView::VisibilityChanged(views::View* starting_from,
OnProfileAvatarChanged(base::FilePath());
}
+TabSearchBubbleHost* BrowserNonClientFrameView::GetTabSearchBubbleHost() {
+ return nullptr;
+}
+
gfx::Insets BrowserNonClientFrameView::MirroredFrameBorderInsets() const {
NOTREACHED_NORETURN();
}
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
index c07d6f3561e45..93c1a2af8e4ae 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.h
@@ -13,6 +13,7 @@
#include "ui/views/window/non_client_view.h"
class BrowserView;
+class TabSearchBubbleHost;
// Type used for functions whose return values depend on the active state of
// the frame.
@@ -133,6 +134,10 @@ class BrowserNonClientFrameView : public views::NonClientFrameView,
using views::NonClientFrameView::ShouldPaintAsActive;
void VisibilityChanged(views::View* starting_from, bool is_visible) override;
+ // Gets the TabSearchBubbleHost if present in the NonClientFrameView. Can
+ // return null.
+ virtual TabSearchBubbleHost* GetTabSearchBubbleHost();
+
// Returns the insets from the edge of the native window to the client view in
// DIPs. The value is left-to-right even on RTL locales. That is,
// insets.left() will be on the left in screen coordinates.
2024-09-24 23:18:15 -03:00
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..c1451a07182a3 100644
2024-09-24 23:18:15 -03:00
--- 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();
@@ -346,6 +350,11 @@ SkColor BrowserNonClientFrameViewChromeOS::GetFrameColor(
return color.value_or(fallback_color);
}
+TabSearchBubbleHost*
+BrowserNonClientFrameViewChromeOS::GetTabSearchBubbleHost() {
+ return tab_search_bubble_host_;
+}
+
void BrowserNonClientFrameViewChromeOS::UpdateMinimumSize() {
gfx::Size current_min_size = GetMinimumSize();
if (last_minimum_size_ == current_min_size)
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.h
index b4ba647bea4eb..d19ddadcf2de6 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.h
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.h
@@ -69,6 +69,7 @@ class BrowserNonClientFrameViewChromeOS
bool CanUserExitFullscreen() const override;
SkColor GetCaptionColor(BrowserFrameActiveState active_state) const override;
SkColor GetFrameColor(BrowserFrameActiveState active_state) const override;
+ TabSearchBubbleHost* GetTabSearchBubbleHost() override;
void UpdateMinimumSize() override;
// views::NonClientFrameView:
@@ -237,6 +238,8 @@ class BrowserNonClientFrameViewChromeOS
raw_ptr<chromeos::FrameCaptionButtonContainerView> caption_button_container_ =
nullptr;
+ raw_ptr<TabSearchBubbleHost> tab_search_bubble_host_ = nullptr;
+
// For popups, the window icon.
raw_ptr<TabIconView> window_icon_ = nullptr;
2024-09-24 23:18:15 -03:00
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/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 41c6c06ccfb21..59c0b5493e350 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1161,6 +1161,10 @@ bool BrowserView::UsesImmersiveFullscreenTabbedMode() const {
#endif
TabSearchBubbleHost* BrowserView::GetTabSearchBubbleHost() {
+ if (auto* tab_search_host =
+ frame_->GetFrameView()->GetTabSearchBubbleHost()) {
+ return tab_search_host;
+ }
if (auto* tab_search_container =
tab_strip_region_view_->tab_search_container()) {
return tab_search_container->tab_search_button()->tab_search_bubble_host();
2024-09-24 23:18:15 -03:00
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);
2024-10-11 21:50:44 -03:00
+ return browser_view()->ShouldDrawTabStrip() && features::IsThorium2024()
2024-09-24 23:18:15 -03:00
+ ? 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..575f4b884791e 100644
2024-09-24 23:18:15 -03:00
--- 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.
+ const int thickness = 8;
2024-09-24 23:18:15 -03:00
+ 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);
2024-08-14 23:30:11 -04:00
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..f99be72b2b9f7 100644
2024-08-14 23:30:11 -04:00
--- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/commerce/product_specifications_button.h"
+#include "chrome/browser/ui/views/frame/window_caption_util.h"
#include "chrome/browser/ui/views/tab_search_bubble_host.h"
#include "chrome/browser/ui/views/tabs/new_tab_button.h"
#include "chrome/browser/ui/views/tabs/tab_drag_controller.h"
@@ -112,7 +113,8 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr<TabStrip> tab_strip)
2024-10-03 08:24:53 -03:00
// Add and configure the TabSearchContainer.
std::unique_ptr<TabSearchContainer> tab_search_container;
- if (browser && browser->is_type_normal()) {
+ if (browser && browser->is_type_normal() &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch("remove-tabsearch-button")) {
tab_search_container = std::make_unique<TabSearchContainer>(
tab_strip_->controller(), browser->tab_strip_model(),
render_tab_search_before_tab_strip_, this);
@@ -183,12 +185,15 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr<TabStrip> tab_strip)
}
if (ShouldShowNewTabButton(browser)) {
- std::unique_ptr<TabStripControlButton> tab_strip_control_button =
- std::make_unique<TabStripControlButton>(
- tab_strip_->controller(),
- base::BindRepeating(&TabStrip::NewTabButtonPressed,
- base::Unretained(tab_strip_)),
- vector_icons::kAddChromeRefreshIcon);
+ std::unique_ptr<TabStripControlButton> tab_strip_control_button =
+ std::make_unique<TabStripControlButton>(
+ tab_strip_->controller(),
+ base::BindRepeating(&TabStrip::NewTabButtonPressed,
+ base::Unretained(tab_strip_)),
+ features::IsThorium2024()
+ ? kAddIcon
+ : vector_icons::kAddChromeRefreshIcon
+ );
tab_strip_control_button->SetProperty(views::kElementIdentifierKey,
kNewTabButtonElementId);
@@ -201,12 +206,10 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr<TabStrip> tab_strip)
2024-10-03 08:24:53 -03:00
// TODO(crbug.com/40118868): Revisit the macro expression once build flag
// switch of lacros-chrome is complete.
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
// The New Tab Button can be middle-clicked on Linux.
new_tab_button_->SetTriggerableEventFlags(
new_tab_button_->GetTriggerableEventFlags() |
ui::EF_MIDDLE_MOUSE_BUTTON);
-#endif
}
reserved_grab_handle_space_ =
@@ -219,7 +222,9 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr<TabStrip> tab_strip)
SetProperty(views::kElementIdentifierKey, kTabStripRegionElementId);
- if (browser && tab_search_container && !render_tab_search_before_tab_strip_) {
+ if (browser && tab_search_container &&
+ !WindowCaptionUtil::IsWindowsTabSearchCaptionButtonEnabled(browser) &&
+ !render_tab_search_before_tab_strip_) {
if (product_specifications_button) {
product_specifications_button_ =
AddChildView(std::move(product_specifications_button));
@@ -227,7 +232,7 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr<TabStrip> tab_strip)
2024-09-24 07:56:24 -03:00
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)));
}
2024-08-17 08:28:28 -04:00
2024-09-24 07:56:24 -03:00
UpdateTabStripMargin();
@@ -365,22 +370,44 @@ void TabStripRegionView::Layout(PassKey) {
2024-10-11 19:33:00 -03:00
// The NTB needs to be layered on top of the tabstrip to achieve negative
// margins.
gfx::Size new_tab_button_size = new_tab_button_->GetPreferredSize();
+ int Th24XOffset;
+ if (features::IsThorium2024()) {
+ Th24XOffset = 4;
+ } else {
+ Th24XOffset = GetLayoutConstant(TAB_MARGIN);
+ }
// The y position is measured from the bottom of the tabstrip, and then
- // pading and button height are removed.
+ // padding and button height are removed.
2024-08-14 23:30:11 -04:00
gfx::Point new_tab_button_new_position =
gfx::Point(tab_strip_container_->bounds().right() -
TabStyle::Get()->GetBottomCornerRadius() +
- GetLayoutConstant(TAB_STRIP_PADDING),
2024-09-20 19:45:14 -03:00
- 0);
2024-10-11 19:33:00 -03:00
+ Th24XOffset,
+ GetLayoutConstant(TAB_BUTTON_OFFSET));
2024-08-14 23:30:11 -04:00
- gfx::Rect new_tab_button_new_bounds =
+ const gfx::Rect new_tab_button_new_bounds =
2024-09-20 19:45:14 -03:00
gfx::Rect(new_tab_button_new_position, new_tab_button_size);
// If the tabsearch button is before the tabstrip container, then manually
// set the bounds.
new_tab_button_->SetBoundsRect(new_tab_button_new_bounds);
}
+
+ if (tab_search_container_ && !render_tab_search_before_tab_strip_ && features::IsThorium2024()) {
+ gfx::Size tab_search_container_size = tab_search_container_->GetPreferredSize();
+ const int tab_search_container_width = tab_search_container_->GetPreferredSize().width();
+ gfx::Point tab_search_container_new_position =
+ gfx::Point(tab_search_container_->bounds().right() -
+ tab_search_container_width,
+ GetLayoutConstant(TAB_BUTTON_OFFSET));
+
+ const gfx::Rect tab_search_container_new_bounds =
+ gfx::Rect(tab_search_container_new_position, tab_search_container_size);
+
+ // If the tabsearch button is before the tabstrip container, then manually
+ // set the bounds.
+ tab_search_container_->SetBoundsRect(tab_search_container_new_bounds);
+ }
}
bool TabStripRegionView::CanDrop(const OSExchangeData& data) {
@@ -504,7 +531,7 @@ void TabStripRegionView::UpdateTabStripMargin() {
2024-08-17 08:28:28 -04:00
new_tab_button_->SetProperty(views::kViewIgnoredByLayoutKey, true);
2024-08-16 23:32:34 -04:00
2024-08-17 08:28:28 -04:00
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 +557,8 @@ void TabStripRegionView::UpdateTabStripMargin() {
2024-08-17 08:28:28 -04:00
// 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();
}
2024-08-16 23:32:34 -04:00
@@ -549,7 +576,7 @@ void TabStripRegionView::AdjustViewBoundsRect(View* view, int offset) {
2024-10-11 19:33:00 -03:00
const gfx::Size view_size = view->GetPreferredSize();
const int x =
tab_strip_container_->x() + TabStyle::Get()->GetBottomCornerRadius() -
- GetLayoutConstant(TAB_STRIP_PADDING) - view_size.width() - offset;
+ GetLayoutConstant(TAB_SEARCH_PADDING) - view_size.width() - offset;
const gfx::Rect new_bounds = gfx::Rect(gfx::Point(x, 0), view_size);
view->SetBoundsRect(new_bounds);
}
diff --git a/chrome/browser/ui/views/frame/windows_caption_button.cc b/chrome/browser/ui/views/frame/windows_caption_button.cc
index e993af9baa1ee..dd1c0880dac4a 100644
--- a/chrome/browser/ui/views/frame/windows_caption_button.cc
+++ b/chrome/browser/ui/views/frame/windows_caption_button.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/views/frame/browser_frame_view_win.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/tab_strip_region_view.h"
+#include "chrome/browser/ui/views/frame/window_caption_util.h"
#include "chrome/grit/theme_resources.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/theme_provider.h"
@@ -155,16 +156,22 @@ int WindowsCaptionButton::GetBetweenButtonSpacing() const {
int WindowsCaptionButton::GetButtonDisplayOrderIndex() const {
int button_display_order = 0;
+ const bool tab_search_enabled =
+ WindowCaptionUtil::IsWindowsTabSearchCaptionButtonEnabled(
+ frame_view_->browser_view()->browser());
switch (button_type_) {
- case VIEW_ID_MINIMIZE_BUTTON:
+ case VIEW_ID_TAB_SEARCH_BUTTON:
button_display_order = 0;
break;
+ case VIEW_ID_MINIMIZE_BUTTON:
+ button_display_order = 0 + (tab_search_enabled ? 1 : 0);
+ break;
case VIEW_ID_MAXIMIZE_BUTTON:
case VIEW_ID_RESTORE_BUTTON:
- button_display_order = 1;
+ button_display_order = 1 + (tab_search_enabled ? 1 : 0);
break;
case VIEW_ID_CLOSE_BUTTON:
- button_display_order = 2;
+ button_display_order = 2 + (tab_search_enabled ? 1 : 0);
break;
default:
NOTREACHED_NORETURN();
@@ -172,7 +179,7 @@ int WindowsCaptionButton::GetButtonDisplayOrderIndex() const {
// Reverse the ordering if we're in RTL mode
if (base::i18n::IsRTL()) {
- const int max_index = 2;
+ const int max_index = tab_search_enabled ? 3 : 2;
button_display_order = max_index - button_display_order;
}
@@ -240,6 +247,10 @@ void WindowsCaptionButton::PaintSymbol(gfx::Canvas* canvas) {
return;
}
+ case VIEW_ID_TAB_SEARCH_BUTTON:
+ icon_painter_->PaintTabSearchIcon(canvas, symbol_rect, flags);
+ return;
+
default:
NOTREACHED_NORETURN();
}
2024-10-03 08:24:53 -03:00
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 8ad0bd147a4c2..f347eb9a2ad24 100644
2024-10-03 08:24:53 -03:00
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -198,18 +198,23 @@ LocationBarView::LocationBarView(Browser* browser,
is_popup_mode_(is_popup_mode) {
set_suppress_default_focus_handling();
if (!is_popup_mode_) {
- views::FocusRing::Install(this);
- views::FocusRing::Get(this)->SetHasFocusPredicate(
- base::BindRepeating([](const View* view) {
- const auto* v = views::AsViewClass<LocationBarView>(view);
- CHECK(v);
- // Show focus ring when the Omnibox is visibly focused and the popup
- // is closed.
- return v->omnibox_view_->model()->is_caret_visible() &&
- !v->GetOmniboxPopupView()->IsOpen();
- }));
- views::FocusRing::Get(this)->SetOutsetFocusRingDisabled(true);
2024-10-03 08:24:53 -03:00
- views::InstallPillHighlightPathGenerator(this);
+ if (!features::IsThorium2024()) {
+ views::FocusRing::Install(this);
+ views::FocusRing::Get(this)->SetHasFocusPredicate(
+ base::BindRepeating([](const View* view) {
+ const auto* v = views::AsViewClass<LocationBarView>(view);
+ CHECK(v);
+ // Show focus ring when the Omnibox is visibly focused and the popup
+ // is closed.
+ return v->omnibox_view_->model()->is_caret_visible() &&
+ !v->GetOmniboxPopupView()->IsOpen();
+ }));
+ views::FocusRing::Get(this)->SetOutsetFocusRingDisabled(true);
+ }
2024-10-03 08:24:53 -03:00
+ static const bool classic_omnibox = base::CommandLine::ForCurrentProcess()->HasSwitch("classic-omnibox");
+ if (!classic_omnibox) {
+ views::InstallPillHighlightPathGenerator(this);
+ }
#if BUILDFLAG(OS_LEVEL_GEOLOCATION_PERMISSION_SUPPORTED)
if (features::IsOsLevelGeolocationPermissionSupportEnabled()) {
@@ -403,7 +408,7 @@ void LocationBarView::Init() {
}
params.icon_color = color_provider->GetColor(kColorPageActionIcon);
- params.between_icon_spacing = 8;
+ params.between_icon_spacing = features::IsThorium2024() ? 6 : 8;
params.font_list = &page_action_font_list;
params.browser = browser_;
params.command_updater = command_updater();
@@ -436,8 +441,13 @@ bool LocationBarView::IsInitialized() const {
2024-10-03 08:24:53 -03:00
}
int LocationBarView::GetBorderRadius() const {
- return ChromeLayoutProvider::Get()->GetCornerRadiusMetric(
- views::Emphasis::kMaximum, size());
+ static const bool classic_omnibox = base::CommandLine::ForCurrentProcess()->HasSwitch("classic-omnibox");
+ if (classic_omnibox) {
+ return 4;
+ } else {
+ return ChromeLayoutProvider::Get()->GetCornerRadiusMetric(
+ views::Emphasis::kMaximum, size());
+ }
}
std::unique_ptr<views::Background> LocationBarView::CreateRoundRectBackground(
@@ -1133,6 +1143,7 @@ gfx::Rect LocationBarView::GetLocalBoundsWithoutEndcaps() const {
void LocationBarView::RefreshBackground() {
const double opacity = hover_animation_.GetCurrentValue();
const bool is_caret_visible = omnibox_view_->model()->is_caret_visible();
+ const bool is_open = GetOmniboxPopupView()->IsOpen();
const bool input_in_progress =
omnibox_view_->model()->user_input_in_progress();
const bool high_contrast = GetNativeTheme()->UserHasContrastPreference();
@@ -1158,6 +1169,18 @@ void LocationBarView::RefreshBackground() {
2024-10-03 08:24:53 -03:00
}
SkColor border_color = SK_ColorTRANSPARENT;
+
+ static const bool classic_omnibox = base::CommandLine::ForCurrentProcess()->HasSwitch("classic-omnibox");
+ if (classic_omnibox && !is_caret_visible) {
+ border_color = color_provider->GetColor(kColorLocationBarBorderOnMismatch);
+ }
+
+ if (features::IsThorium2024()) {
+ if (is_caret_visible && !is_open) {
+ border_color = color_provider->GetColor(ui::kColorFocusableBorderFocused);
+ }
2024-10-03 08:24:53 -03:00
+ }
+
if (high_contrast) {
// High contrast schemes get a border stroke even on a rounded omnibox.
border_color =
2024-10-11 19:33:00 -03:00
diff --git a/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc b/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc
2024-10-27 16:34:01 -03:00
index a7072a79d61e9..2ed53a3e48336 100644
2024-10-11 19:33:00 -03:00
--- a/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc
2024-10-27 16:34:01 -03:00
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.h"
+#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
@@ -139,7 +140,15 @@ class OmniboxSuggestionRowButton : public views::MdTextButton {
2024-10-11 19:33:00 -03:00
SetImageLabelSpacing(8);
SetCustomPadding(ChromeLayoutProvider::Get()->GetInsetsMetric(
INSETS_OMNIBOX_PILL_BUTTON));
- SetCornerRadius(GetLayoutConstant(TOOLBAR_CORNER_RADIUS));
2024-10-27 16:34:01 -03:00
+ static const bool classic_omnibox = base::CommandLine::ForCurrentProcess()->HasSwitch("classic-omnibox");
+ int corner_radius;
+ if (classic_omnibox) {
+ corner_radius = 4;
+ } else {
+ corner_radius = 8;
+ }
+ static const int kCornerRadius = corner_radius;
+ SetCornerRadius(kCornerRadius);
2024-10-11 19:33:00 -03:00
auto* const ink_drop = views::InkDrop::Get(this);
SetAnimationDuration(base::TimeDelta());
diff --git a/chrome/browser/ui/views/omnibox/rounded_omnibox_results_frame.cc b/chrome/browser/ui/views/omnibox/rounded_omnibox_results_frame.cc
index 4bc8f9177f416..b6d49f5c07642 100644
2024-10-11 19:33:00 -03:00
--- a/chrome/browser/ui/views/omnibox/rounded_omnibox_results_frame.cc
+++ b/chrome/browser/ui/views/omnibox/rounded_omnibox_results_frame.cc
@@ -244,6 +244,7 @@ RoundedOmniboxResultsFrame::RoundedOmniboxResultsFrame(
views::BubbleBorder::Shadow::STANDARD_SHADOW);
border->SetCornerRadius(corner_radius);
border->set_md_shadow_elevation(kElevation);
+ if (features::IsThorium2024()) { border->set_draw_border_stroke(true); }
2024-10-11 19:33:00 -03:00
SetBorder(std::move(border));
AddChildView(contents_host_.get());
@@ -275,11 +276,22 @@ void RoundedOmniboxResultsFrame::OnBeforeWidgetInit(
// static
int RoundedOmniboxResultsFrame::GetNonResultSectionHeight() {
return GetLayoutConstant(LOCATION_BAR_HEIGHT) +
- GetLocationBarAlignmentInsets().height();
+ GetNonResultSectionInsets().height();
}
// static
gfx::Insets RoundedOmniboxResultsFrame::GetLocationBarAlignmentInsets() {
+ if (ui::TouchUiController::Get()->touch_ui()) {
+ return gfx::Insets::TLBR(6, 1, 5, 1);
+ }
+ if (features::IsThorium2024()) {
2024-11-12 23:55:35 -03:00
+ return gfx::Insets::VH(4, 6);
2024-10-11 19:33:00 -03:00
+ }
+ return gfx::Insets::VH(5, 6);
+}
+
+// static
+gfx::Insets RoundedOmniboxResultsFrame::GetNonResultSectionInsets() {
if (ui::TouchUiController::Get()->touch_ui()) {
return gfx::Insets::TLBR(6, 1, 5, 1);
}
diff --git a/chrome/browser/ui/views/omnibox/rounded_omnibox_results_frame.h b/chrome/browser/ui/views/omnibox/rounded_omnibox_results_frame.h
index d134918c8538e..7262833fbb715 100644
--- a/chrome/browser/ui/views/omnibox/rounded_omnibox_results_frame.h
+++ b/chrome/browser/ui/views/omnibox/rounded_omnibox_results_frame.h
@@ -35,6 +35,9 @@ class RoundedOmniboxResultsFrame : public views::View {
// How the Widget is aligned relative to the location bar.
static gfx::Insets GetLocationBarAlignmentInsets();
+ // How the text area of the Widget is aligned relative to the location bar.
+ static gfx::Insets GetNonResultSectionInsets();
+
// Returns the blur region taken up by the Omnibox popup shadows.
static gfx::Insets GetShadowInsets();
2024-09-20 19:45:53 -03:00
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
2024-09-24 07:56:24 -03:00
index 2ca8611118a21..e360e3afcdc9f 100644
2024-09-20 19:45:53 -03:00
--- 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"
2024-09-24 07:56:24 -03:00
@@ -32,7 +33,7 @@ SidePanelResizeHandle::SidePanelResizeHandle(SidePanel* side_panel)
2024-09-20 19:45:53 -03:00
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_close_button.cc b/chrome/browser/ui/views/tabs/tab_close_button.cc
index ac335a68f3fd0..8eef7a2f256c8 100644
--- a/chrome/browser/ui/views/tabs/tab_close_button.cc
+++ b/chrome/browser/ui/views/tabs/tab_close_button.cc
@@ -38,7 +38,7 @@
#endif
namespace {
-constexpr int kIconSize = 16;
+constexpr int kIconSize = 18;
constexpr gfx::Size kButtonSize = {28, 28};
} // namespace
2024-09-24 23:18:15 -03:00
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
2024-10-11 19:33:00 -03:00
diff --git a/chrome/browser/ui/views/tabs/tab_search_button.cc b/chrome/browser/ui/views/tabs/tab_search_button.cc
index a42855ead9dbe..ba8b4271de1d7 100644
2024-10-11 19:33:00 -03:00
--- a/chrome/browser/ui/views/tabs/tab_search_button.cc
+++ b/chrome/browser/ui/views/tabs/tab_search_button.cc
@@ -21,6 +21,7 @@
#include "ui/views/view_class_properties.h"
namespace {
+constexpr int kTh24CRTabSearchCornerRadius = 8;
constexpr int kCRTabSearchCornerRadius = 10;
constexpr int kCRTabSearchFlatCornerRadius = 4;
} // namespace
@@ -29,7 +30,9 @@ TabSearchButton::TabSearchButton(TabStripController* tab_strip_controller,
Edge flat_edge)
: TabStripControlButton(tab_strip_controller,
PressedCallback(),
- vector_icons::kExpandMoreIcon,
+ features::IsThorium2024()
+ ? vector_icons::kCaretDownIcon
+ : vector_icons::kExpandMoreIcon,
flat_edge),
tab_search_bubble_host_(std::make_unique<TabSearchBubbleHost>(
this,
@@ -42,9 +45,11 @@ TabSearchButton::TabSearchButton(TabStripController* tab_strip_controller,
SetForegroundFrameActiveColorId(kColorNewTabButtonForegroundFrameActive);
SetForegroundFrameInactiveColorId(kColorNewTabButtonForegroundFrameInactive);
- SetBackgroundFrameActiveColorId(kColorNewTabButtonCRBackgroundFrameActive);
- SetBackgroundFrameInactiveColorId(
- kColorNewTabButtonCRBackgroundFrameInactive);
+ if (!features::IsThorium2024()) {
+ SetBackgroundFrameActiveColorId(kColorNewTabButtonCRBackgroundFrameActive);
+ SetBackgroundFrameInactiveColorId(
+ kColorNewTabButtonCRBackgroundFrameInactive);
+ }
UpdateColors();
}
@@ -61,7 +66,15 @@ void TabSearchButton::NotifyClick(const ui::Event& event) {
2024-10-11 19:33:00 -03:00
}
int TabSearchButton::GetCornerRadius() const {
- return kCRTabSearchCornerRadius;
+ static const bool rectangular_tabs =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
+ if (rectangular_tabs) {
+ return kCRTabSearchFlatCornerRadius;
+ } else {
+ return features::IsThorium2024()
+ ? TabStripControlButton::kButtonSize.width() / 2
2024-10-11 19:33:00 -03:00
+ : kCRTabSearchCornerRadius;
+ }
}
int TabSearchButton::GetFlatCornerRadius() const {
2024-09-24 23:18:15 -03:00
diff --git a/chrome/browser/ui/views/tabs/tab_style_views.cc b/chrome/browser/ui/views/tabs/tab_style_views.cc
index 65676013fece9..379cc5b3e1c4b 100644
2024-09-24 23:18:15 -03:00
--- a/chrome/browser/ui/views/tabs/tab_style_views.cc
+++ b/chrome/browser/ui/views/tabs/tab_style_views.cc
@@ -7,10 +7,12 @@
#include <algorithm>
#include <utility>
+#include "base/command_line.h"
#include "base/i18n/rtl.h"
2024-10-27 16:34:01 -03:00
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/strcat.h"
+#include "build/build_config.h"
#include "cc/paint/paint_record.h"
#include "cc/paint/paint_shader.h"
#include "chrome/browser/themes/theme_properties.h"
@@ -18,6 +20,7 @@
2024-09-24 23:18:15 -03:00
#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"
@@ -39,6 +42,7 @@
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/views/controls/focus_ring.h"
+#include "ui/views/style/typography.h"
#include "ui/views/widget/widget.h"
namespace {
@@ -85,6 +89,7 @@ class TabStyleViewsImpl : public TabStyleViews {
float GetCurrentActiveOpacity() const override;
TabActive GetApparentActiveState() const override;
TabStyle::TabColors CalculateTargetColors() const override;
+ const gfx::FontList& GetFontList() const override;
void PaintTab(gfx::Canvas* canvas) const override;
void SetHoverLocation(const gfx::Point& location) override;
void ShowHover(TabStyle::ShowHoverStyle style) override;
@@ -190,6 +195,9 @@ class TabStyleViewsImpl : public TabStyleViews {
const raw_ptr<const Tab> tab_;
std::unique_ptr<GlowHoverController> hover_controller_;
+
+ gfx::FontList normal_font_;
+ gfx::FontList heavy_font_;
};
// TabStyleViewsImpl ----------------------------------------------------------
@@ -198,7 +206,11 @@ TabStyleViewsImpl::TabStyleViewsImpl(Tab* tab)
: tab_(tab),
hover_controller_((tab && gfx::Animation::ShouldRenderRichAnimation())
? new GlowHoverController(tab)
- : nullptr) {
+ : nullptr),
+ normal_font_(views::TypographyProvider::Get().GetFont(views::style::CONTEXT_LABEL,
+ views::style::STYLE_PRIMARY)),
+ heavy_font_(views::TypographyProvider::Get().GetFont(views::style::CONTEXT_BUTTON_MD,
+ views::style::STYLE_PRIMARY)) {
// `tab_` must not be nullptr.
CHECK(tab_);
// TODO(dfried): create a new STYLE_PROMINENT or similar to use instead of
@@ -244,7 +256,8 @@ SkPath TabStyleViewsImpl::GetPath(TabStyle::PathType path_type,
2024-09-24 23:18:15 -03:00
// 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,16 +267,19 @@ SkPath TabStyleViewsImpl::GetPath(TabStyle::PathType path_type,
2024-09-24 23:18:15 -03:00
}
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;
2024-10-11 19:33:00 -03:00
- const int bottom = top + tab_height;
2024-09-24 23:18:15 -03:00
+ // Keep this in Thorium
2024-10-11 19:33:00 -03:00
+ int bottom = top + tab_height;
2024-09-24 23:18:15 -03:00
// For maximized and full screen windows, extend the tab hit test to the top
2024-10-11 19:33:00 -03:00
// of the tab, encompassing the top padding. This makes it easy to click on
2024-09-24 23:18:15 -03:00
// 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 +314,21 @@ SkPath TabStyleViewsImpl::GetPath(TabStyle::PathType path_type,
2024-09-24 23:18:15 -03:00
}
}
2024-11-09 15:09:56 -03:00
+ #if BUILDFLAG(IS_LINUX)
2024-10-27 16:34:01 -03:00
+ if (features::IsThorium2024()) {
2024-11-09 15:09:56 -03:00
+ constexpr float Th24StrokeOffset = 1.0f;
+ top -= Th24StrokeOffset;
2024-10-11 21:55:14 -03:00
+ //bottom -= Th24StrokeOffset;
2024-09-24 23:18:15 -03:00
+ }
2024-10-27 16:34:01 -03:00
+ #else
+ VLOG(0) << "Th24StrokeOffset on Windows is imperfect";
+ if (features::IsThorium2024()) {
+ constexpr float Th24StrokeOffset = 1.0f;
+ top -= Th24StrokeOffset;
2024-10-27 16:34:01 -03:00
+ //bottom -= Th24StrokeOffset;
+ }
+ #endif
2024-09-24 23:18:15 -03:00
+
// Radii are clockwise from top left.
const SkVector radii[4] = {
SkVector(top_content_corner_radius, top_content_corner_radius),
@@ -581,6 +612,18 @@ TabStyle::TabColors TabStyleViewsImpl::CalculateTargetColors() const {
close_button_focus_ring_color};
}
+const gfx::FontList& TabStyleViewsImpl::GetFontList() const {
+ // Don't want to have to keep re-computing this value.
+ static const bool prominent_dark_mode_titles =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("prominent-active-tab-titles");
+
+ if (prominent_dark_mode_titles && tab_->IsActive()) {
+ return heavy_font_;
+ }
+
+ return normal_font_;
+}
+
void TabStyleViewsImpl::PaintTab(gfx::Canvas* canvas) const {
std::optional<int> active_tab_fill_id;
if (tab_->GetThemeProvider()->HasCustomImage(IDR_THEME_TOOLBAR)) {
@@ -731,6 +774,11 @@ float TabStyleViewsImpl::GetSeparatorOpacity(bool for_layout,
2024-09-24 23:18:15 -03:00
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 +1013,10 @@ void TabStyleViewsImpl::PaintTabBackgroundFill(
2024-09-24 23:18:15 -03:00
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(GetCurrentTabBackgroundColor(selection_state, hovered));
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("transparent-tabs") &&
2024-10-27 16:34:01 -03:00
+ selection_state != TabStyle::TabSelectionState::kActive) {
2024-09-24 23:18:15 -03:00
+ flags.setAlphaf(0.7f);
2024-10-27 16:34:01 -03:00
+ }
2024-09-24 23:18:15 -03:00
canvas->DrawRect(gfx::ScaleToEnclosingRect(tab_->GetLocalBounds(), scale),
flags);
}
diff --git a/chrome/browser/ui/views/tabs/tab_style_views.h b/chrome/browser/ui/views/tabs/tab_style_views.h
index 4160d9c4d503f..54ae85ef82a3e 100644
--- a/chrome/browser/ui/views/tabs/tab_style_views.h
+++ b/chrome/browser/ui/views/tabs/tab_style_views.h
@@ -48,6 +48,9 @@ class TabStyleViews {
TabStyle::RenderUnits render_units =
TabStyle::RenderUnits::kPixels) const = 0;
+ // Returns the appropriate fonts for the current theme and active state.
+ virtual const gfx::FontList& GetFontList() const = 0;
+
// Paints the tab.
virtual void PaintTab(gfx::Canvas* canvas) const = 0;
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc
index df6dffc7d04ec..e877b9dac6572 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -78,6 +78,7 @@
#include "chrome/browser/ui/views/toolbar/home_button.h"
#include "chrome/browser/ui/views/toolbar/pinned_toolbar_actions_container.h"
#include "chrome/browser/ui/views/toolbar/reload_button.h"
+#include "chrome/browser/ui/views/toolbar/restore_tab_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_controller.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
@@ -355,8 +356,12 @@ void ToolbarView::Init() {
std::unique_ptr<HomeButton> home = std::make_unique<HomeButton>(
base::BindRepeating(callback, browser_, IDC_HOME), prefs);
+ std::unique_ptr<RestoreTabButton> restore =
+ std::make_unique<RestoreTabButton>(browser_->command_controller());
+
std::unique_ptr<ExtensionsToolbarContainer> extensions_container;
std::unique_ptr<views::View> toolbar_divider;
+ std::unique_ptr<views::View> toolbar_divider2;
// Do not create the extensions or browser actions container if it is a guest
// profile (only regular and incognito profiles host extensions).
@@ -366,6 +371,9 @@ void ToolbarView::Init() {
toolbar_divider = std::make_unique<views::View>();
}
+ if (features::EnableRestoreTabButton()) {
+ toolbar_divider2 = std::make_unique<views::View>();
+ }
std::unique_ptr<media_router::CastToolbarButton> cast;
if (media_router::MediaRouterEnabled(browser_->profile()))
cast = media_router::CastToolbarButton::Create(browser_);
@@ -390,6 +398,15 @@ void ToolbarView::Init() {
reload_ = container_view_->AddChildView(std::move(reload));
home_ = container_view_->AddChildView(std::move(home));
+ if (features::EnableRestoreTabButton()) {
+ toolbar_divider2_ =
+ container_view_->AddChildView(std::move(toolbar_divider2));
+ toolbar_divider2_->SetPreferredSize(
+ gfx::Size(GetLayoutConstant(TOOLBAR_DIVIDER_WIDTH),
+ GetLayoutConstant(TOOLBAR_DIVIDER_HEIGHT)));
+ restore_ = container_view_->AddChildView(std::move(restore));
+ }
+
location_bar_ = container_view_->AddChildView(std::move(location_bar));
if (extensions_container) {
@@ -483,6 +500,18 @@ void ToolbarView::Init() {
browser_->profile()->IsGuestSession() ||
browser_->profile()->IsRegularProfile();
#endif
+
+ const std::string sab_value = base::CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII("show-avatar-button");
+ if (sab_value == "always") {
+ show_avatar_toolbar_button = true;
+ } else if (sab_value == "incognito-and-guest") {
+ show_avatar_toolbar_button = browser_->profile()->IsIncognitoProfile() ||
+ browser_->profile()->IsGuestSession();
+ } else if (sab_value == "never") {
+ show_avatar_toolbar_button = false;
+ }
+
avatar_->SetVisible(show_avatar_toolbar_button);
#if BUILDFLAG(ENABLE_WEBUI_TAB_STRIP)
@@ -998,6 +1027,12 @@ void ToolbarView::InitLayout() {
gfx::Insets::VH(0, GetLayoutConstant(TOOLBAR_DIVIDER_SPACING)));
}
+ if (toolbar_divider2_) {
+ toolbar_divider2_->SetProperty(
+ views::kMarginsKey,
+ gfx::Insets::VH(0, GetLayoutConstant(TOOLBAR_DIVIDER_SPACING)));
+ }
+
if (base::FeatureList::IsEnabled(features::kResponsiveToolbar)) {
constexpr int kToolbarFlexOrderStart = 1;
@@ -1058,15 +1093,21 @@ void ToolbarView::LayoutCommon() {
app_menu_button_->SetTrailingMargin(
extend_buttons_to_edge ? interior_margin.right() : 0);
+ const SkColor toolbar_extension_separator_color =
+ GetColorProvider()->GetColor(kColorToolbarExtensionSeparatorEnabled);
+
if (toolbar_divider_ && extensions_container_) {
views::ManualLayoutUtil(layout_manager_)
.SetViewHidden(toolbar_divider_, !extensions_container_->GetVisible());
- const SkColor toolbar_extension_separator_color =
- GetColorProvider()->GetColor(kColorToolbarExtensionSeparatorEnabled);
toolbar_divider_->SetBackground(views::CreateRoundedRectBackground(
toolbar_extension_separator_color,
GetLayoutConstant(TOOLBAR_DIVIDER_CORNER_RADIUS)));
}
+ if (toolbar_divider2_) {
+ toolbar_divider2_->SetBackground(views::CreateRoundedRectBackground(
+ toolbar_extension_separator_color,
+ GetLayoutConstant(TOOLBAR_DIVIDER_CORNER_RADIUS)));
+ }
// Cast button visibility is controlled externally.
}
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.h b/chrome/browser/ui/views/toolbar/toolbar_view.h
index cb361877682b9..ada0be249024e 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.h
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.h
@@ -54,6 +54,7 @@ class ExtensionsToolbarCoordinator;
class ManagementToolbarButton;
class MediaToolbarButtonView;
class ReloadButton;
+class RestoreTabButton;
class PinnedToolbarActionsContainer;
class ToolbarButton;
class AvatarToolbarButtonBrowserTest;
@@ -153,6 +154,7 @@ class ToolbarView : public views::AccessiblePaneView,
ToolbarButton* forward_button() const { return forward_; }
ExtensionsToolbarButton* GetExtensionsButton() const;
ReloadButton* reload_button() const { return reload_; }
+ RestoreTabButton* restore_tab_button() const { return restore_; }
LocationBarView* location_bar() const { return location_bar_; }
CustomTabBarView* custom_tab_bar() { return custom_tab_bar_; }
BatterySaverButton* battery_saver_button() const {
@@ -291,11 +293,13 @@ class ToolbarView : public views::AccessiblePaneView,
raw_ptr<ToolbarButton> back_ = nullptr;
raw_ptr<ToolbarButton> forward_ = nullptr;
raw_ptr<ReloadButton> reload_ = nullptr;
+ raw_ptr<RestoreTabButton> restore_ = nullptr;
raw_ptr<HomeButton> home_ = nullptr;
raw_ptr<CustomTabBarView> custom_tab_bar_ = nullptr;
raw_ptr<LocationBarView> location_bar_ = nullptr;
raw_ptr<ExtensionsToolbarContainer> extensions_container_ = nullptr;
raw_ptr<views::View> toolbar_divider_ = nullptr;
+ raw_ptr<views::View> toolbar_divider2_ = nullptr;
raw_ptr<ChromeLabsButton> chrome_labs_button_ = nullptr;
raw_ptr<BatterySaverButton> battery_saver_button_ = nullptr;
raw_ptr<PerformanceInterventionButton> performance_intervention_button_ =
2024-10-03 08:24:53 -03:00
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 39e7681c0c708..c73c08f328607 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -56,6 +56,7 @@
#include "chrome/browser/ui/webui/signin_internals_ui.h"
#include "chrome/browser/ui/webui/suggest_internals/suggest_internals_ui.h"
#include "chrome/browser/ui/webui/sync_internals/sync_internals_ui.h"
+#include "chrome/browser/ui/webui/thorium_webui.h"
#include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h"
#include "chrome/browser/ui/webui/usb_internals/usb_internals_ui.h"
#include "chrome/browser/ui/webui/user_actions/user_actions_ui.h"
@@ -777,6 +778,10 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<privacy_sandbox_internals::PrivacySandboxInternalsUI>;
}
+ if (url.host_piece() == chrome::kChromeUIEggsHost) {
+ return &NewWebUI<ThoriumWebUILoad>;
+ }
+
return nullptr;
}
diff --git a/chrome/browser/ui/webui/thorium_webui.h b/chrome/browser/ui/webui/thorium_webui.h
new file mode 100644
2024-10-03 12:17:22 -03:00
index 0000000000000..23fe24f51e93e
2024-10-03 08:24:53 -03:00
--- /dev/null
+++ b/chrome/browser/ui/webui/thorium_webui.h
2024-10-03 12:17:22 -03:00
@@ -0,0 +1,78 @@
2024-10-03 08:24:53 -03:00
+// Copyright 2024 Alex313031
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THORIUM_WEBUI_H_
+#define THORIUM_WEBUI_H_
+
+#include "base/memory/ref_counted_memory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/url_data_source.h"
+#include "content/public/browser/web_ui.h"
+#include "content/public/browser/web_ui_controller.h"
+#include "services/network/public/mojom/content_security_policy.mojom.h"
+
+class ThoriumDataSource : public content::URLDataSource {
+ public:
+ ThoriumDataSource() {}
+ ThoriumDataSource(const ThoriumDataSource&) = delete;
+ ThoriumDataSource& operator=(const ThoriumDataSource&) = delete;
+ std::string GetSource() override;
+ std::string GetMimeType(const GURL& url) override;
+ std::string GetContentSecurityPolicy(network::mojom::CSPDirectiveName directive) override;
+ void StartDataRequest(const GURL& url,
+ const content::WebContents::Getter& wc_getter,
+ GotDataCallback callback) override;
+};
+
+std::string ThoriumDataSource::GetSource() { return "eggs"; }
+std::string ThoriumDataSource::GetMimeType(const GURL& url) { return "text/html"; }
+std::string ThoriumDataSource::GetContentSecurityPolicy(network::mojom::CSPDirectiveName directive) {
+ if (directive == network::mojom::CSPDirectiveName::ScriptSrc)
+ return "script-src 'unsafe-inline'";
+ return std::string();
+}
+void ThoriumDataSource::StartDataRequest(const GURL& url,
+ const content::WebContents::Getter& wc_getter,
+ GotDataCallback callback) {
+ std::string source = R"(
2024-10-03 12:17:22 -03:00
+ <html>
+ <head>
+ <title>Thorium Easter Eggs</title>
+ <meta name="color-scheme" content="light dark">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="shortcut icon" type="image/x-icon" href="chrome://theme/current-channel-logo@2x">
2024-10-03 12:17:22 -03:00
+ <style>
+ @import url(chrome://resources/css/text_defaults_md.css);
+ body { text-align: center; align-content: center; max-width: 75%; margin: auto;}
+ img { max-width: 75%; height: auto; }
+ </style>
+ </head>
+ <body>
+ <h2><u>Thorium Easter Eggs WebUI Page</u></h3>
+ <hr>
+ <p>
+ <img src="chrome://theme/IDR_PRODUCT_THORIUM_ELEMENT">
+ <hr>
+ <img src="chrome://theme/IDR_PRODUCT_THORIUM_ATOMIC">
+ <img src="chrome://theme/IDR_PRODUCT_CHROMIUM_QUESTION">
+ <img src="chrome://theme/IDR_PRODUCT_THORIUM_GUY">
+ <img src="chrome://theme/IDR_PRODUCT_CHROMIUM_BLANK">
+ <img src="chrome://theme/IDR_PRODUCT_AI_CHROME">
+ </p>
+ </body>
+ </html>
2024-10-03 08:24:53 -03:00
+ )";
+ std::move(callback).Run(base::MakeRefCounted<base::RefCountedString>(std::move(source)));
+}
+
+class ThoriumWebUILoad : public content::WebUIController {
+ public:
+ ThoriumWebUILoad(content::WebUI* web_ui) : content::WebUIController(web_ui) {
+ content::URLDataSource::Add(Profile::FromWebUI(web_ui), std::make_unique<ThoriumDataSource>());
+ }
+ ThoriumWebUILoad(const ThoriumWebUILoad&) = delete;
+ ThoriumWebUILoad& operator=(const ThoriumWebUILoad&) = delete;
+};
+
+#endif // THORIUM_WEBUI_H_
2024-11-12 23:55:35 -03:00
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index 3c569bc610124..160d1bd4090a3 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -59,7 +59,7 @@ const base::FilePath::CharType kFilepathSinglePrefExtensions[] =
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
FILE_PATH_LITERAL("/usr/share/google-chrome/extensions");
#else
- FILE_PATH_LITERAL("/usr/share/chromium/extensions");
+ FILE_PATH_LITERAL("/usr/share/thorium/extensions");
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
@@ -573,8 +573,7 @@ bool PathProvider(int key, base::FilePath* result) {
return false;
}
- cur = cur.Append(FILE_PATH_LITERAL("Google"))
- .Append(FILE_PATH_LITERAL("Chrome"))
+ cur = cur.Append(FILE_PATH_LITERAL("Thorium"))
.Append(FILE_PATH_LITERAL("External Extensions"));
#else
if (!base::PathService::Get(base::DIR_MODULE, &cur)) {
@@ -607,7 +606,7 @@ bool PathProvider(int key, base::FilePath* result) {
FILE_PATH_LITERAL("/Library/Google/Chrome/NativeMessagingHosts"));
#else
cur = base::FilePath(FILE_PATH_LITERAL(
- "/Library/Application Support/Chromium/NativeMessagingHosts"));
+ "/Library/Application Support/Thorium/NativeMessagingHosts"));
#endif
#else // BUILDFLAG(IS_MAC)
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
@@ -615,7 +614,7 @@ bool PathProvider(int key, base::FilePath* result) {
FILE_PATH_LITERAL("/etc/opt/chrome/native-messaging-hosts"));
#else
cur = base::FilePath(
- FILE_PATH_LITERAL("/etc/chromium/native-messaging-hosts"));
+ FILE_PATH_LITERAL("/etc/thorium/native-messaging-hosts"));
#endif
#endif // !BUILDFLAG(IS_MAC)
break;
2024-10-03 08:24:53 -03:00
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc
index 248b6795e8cbe..488bade160e37 100644
--- a/chrome/common/webui_url_constants.cc
+++ b/chrome/common/webui_url_constants.cc
@@ -75,6 +75,7 @@ bool IsSystemWebUIHost(std::string_view host) {
// These hosts will also be suggested by BuiltinProvider.
base::span<const base::cstring_view> ChromeURLHosts() {
static constexpr auto kChromeURLHosts = std::to_array<base::cstring_view>({
+ kChromeUIEggsHost,
kChromeUIAboutHost,
kChromeUIAccessibilityHost,
#if !BUILDFLAG(IS_ANDROID)
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h
index 70e366e816db5..a727ed4aa725f 100644
--- a/chrome/common/webui_url_constants.h
+++ b/chrome/common/webui_url_constants.h
@@ -31,6 +31,8 @@ namespace chrome {
// Not all components have corresponding URLs and vice versa. Only add as
// needed.
// Please keep in alphabetical order, with OS/feature specific sections below.
+inline constexpr char kChromeUIEggsHost[] = "eggs";
+inline constexpr char kChromeUIEggsURL[] = "chrome://eggs/";
inline constexpr char kChromeUIAboutHost[] = "about";
inline constexpr char kChromeUIAboutURL[] = "chrome://about/";
inline constexpr char kChromeUIAccessCodeCastHost[] = "access-code-cast";
2024-10-05 08:35:55 -03:00
diff --git a/components/resources/search_engine_choice_scaled_resources.grdp b/components/resources/search_engine_choice_scaled_resources.grdp
index 87d186a04e66c..01beccd365540 100644
--- a/components/resources/search_engine_choice_scaled_resources.grdp
+++ b/components/resources/search_engine_choice_scaled_resources.grdp
@@ -6,6 +6,7 @@
<structure type="chrome_scaled_image" name="IDR_GOOGLE_COM_PNG" file="google_chrome/google_search_logo.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_AR_YAHOO_COM_PNG" file="search_engine_choice/yahoo_com.png" />
+ <structure type="chrome_scaled_image" name="IDR_ASK_COM_PNG" file="search_engine_choice/ask_com.png" />
<structure type="chrome_scaled_image" name="IDR_AT_YAHOO_COM_PNG" file="search_engine_choice/yahoo_com.png" />
<structure type="chrome_scaled_image" name="IDR_AU_YAHOO_COM_PNG" file="search_engine_choice/yahoo_com.png" />
<structure type="chrome_scaled_image" name="IDR_BING_COM_PNG" file="search_engine_choice/bing_com.png" />
2024-09-24 23:18:15 -03:00
diff --git a/ui/base/ui_base_features.cc b/ui/base/ui_base_features.cc
index ed801f34141da..60e3f3eefb8a0 100644
2024-09-24 23:18:15 -03:00
--- a/ui/base/ui_base_features.cc
+++ b/ui/base/ui_base_features.cc
@@ -511,6 +511,24 @@ bool IsLacrosColorManagementEnabled() {
2024-09-24 23:18:15 -03:00
return base::FeatureList::IsEnabled(kLacrosColorManagement);
}
+BASE_FEATURE(kThorium2024,
+ "Thorium2024",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+bool IsThorium2024() {
+ static const bool Th24flag =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("th24");
+ return base::FeatureList::IsEnabled(kThorium2024) || Th24flag;
+}
+
+BASE_FEATURE(kRestoreTabButton,
+ "RestoreTabButton",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+bool EnableRestoreTabButton() {
+ return base::FeatureList::IsEnabled(kRestoreTabButton);
2024-09-24 23:18:15 -03:00
+}
+
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..3b09b34a70769 100644
2024-09-24 23:18:15 -03:00
--- a/ui/base/ui_base_features.h
+++ b/ui/base/ui_base_features.h
@@ -228,6 +228,13 @@ COMPONENT_EXPORT(UI_BASE_FEATURES) BASE_DECLARE_FEATURE(kLacrosColorManagement);
2024-09-24 23:18:15 -03:00
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(kRestoreTabButton);
+COMPONENT_EXPORT(UI_BASE_FEATURES) bool EnableRestoreTabButton();
2024-09-24 23:18:15 -03:00
+
COMPONENT_EXPORT(UI_BASE_FEATURES)
BASE_DECLARE_FEATURE(kBubbleMetricsApi);
2024-09-27 22:24:54 -03:00
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;
}
2024-08-14 23:30:11 -04:00
diff --git a/ui/views/controls/menu/menu_config.cc b/ui/views/controls/menu/menu_config.cc
2024-09-24 07:56:24 -03:00
index 2f1525c8880d4..c7b6d0822ba32 100644
2024-08-14 23:30:11 -04:00
--- a/ui/views/controls/menu/menu_config.cc
+++ b/ui/views/controls/menu/menu_config.cc
2024-09-24 07:56:24 -03:00
@@ -5,6 +5,7 @@
2024-08-14 23:30:11 -04:00
#include "ui/views/controls/menu/menu_config.h"
#include "base/no_destructor.h"
2024-08-16 23:32:34 -04:00
+#include "chrome/browser/ui/thorium_2024.h"
2024-08-14 23:30:11 -04:00
#include "ui/base/ui_base_features.h"
#include "ui/views/controls/menu/menu_controller.h"
2024-08-16 23:32:34 -04:00
#include "ui/views/controls/menu/menu_item_view.h"
2024-09-24 07:56:24 -03:00
@@ -64,12 +65,12 @@ void MenuConfig::InitCommon() {
2024-08-14 23:30:11 -04:00
reserve_dedicated_arrow_column = false;
menu_horizontal_border_size = 0;
submenu_horizontal_overlap = 0;
- item_vertical_margin = 6;
2024-08-22 11:02:48 -04:00
+ item_vertical_margin = features::IsThorium2024() ? 4 : 6;
2024-08-14 23:30:11 -04:00
item_horizontal_border_padding = 12;
arrow_size = 16;
- separator_height = 17;
- separator_spacing_height = 4;
- use_outer_border = false;
2024-08-22 11:02:48 -04:00
+ separator_height = features::IsThorium2024() ? 11 : 17;
+ separator_spacing_height = features::IsThorium2024() ? 3 : 4;
+ use_outer_border = features::IsThorium2024() ? true : false;
2024-08-14 23:30:11 -04:00
}
// static
2024-10-27 16:34:01 -03:00
diff --git a/ui/views/controls/menu/menu_config.h b/ui/views/controls/menu/menu_config.h
index b087f25b78c94..415c96a2ba60b 100644
--- a/ui/views/controls/menu/menu_config.h
+++ b/ui/views/controls/menu/menu_config.h
@@ -167,7 +167,7 @@ struct VIEWS_EXPORT MenuConfig {
// Delay, in ms, between when menus are selected or moused over and the menu
// appears.
- int show_delay = 400;
+ int show_delay = 1;
// Radius of the rounded corners of the menu border. Must be >= 0.
int corner_radius = LayoutProvider::Get()->GetCornerRadiusMetric(
2024-09-01 14:35:00 -04:00
diff --git a/ui/views/controls/menu/menu_config_linux.cc b/ui/views/controls/menu/menu_config_linux.cc
index 09c03d1e87011..31fda3a23bbf5 100644
2024-09-01 14:35:00 -04:00
--- a/ui/views/controls/menu/menu_config_linux.cc
+++ b/ui/views/controls/menu/menu_config_linux.cc
2024-09-24 23:18:15 -03:00
@@ -4,12 +4,16 @@
2024-09-01 14:35:00 -04:00
#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 {
2024-09-06 19:37:25 -04:00
2024-09-01 14:35:00 -04:00
void MenuConfig::InitPlatform() {
2024-09-24 07:56:24 -03:00
- use_bubble_border = true;
2024-10-11 21:55:14 -03:00
+ use_bubble_border = features::IsThorium2024() ? false : corner_radius > 0;
2024-09-06 19:37:25 -04:00
+ arrow_to_edge_padding = features::IsThorium2024() ? 2 : 8;
+ separator_height = features::IsThorium2024() ? 7 : 17;
2024-09-01 14:35:00 -04:00
}
} // 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
2024-09-01 14:35:00 -04:00
// 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..9df79901422ee 100644
2024-09-01 14:35:00 -04:00
--- 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 {
@@ -21,10 +23,43 @@ void MenuConfig::InitPlatform() {
2024-10-27 16:34:01 -03:00
(SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &show_cues, 0) &&
2024-09-01 14:35:00 -04:00
show_cues == TRUE);
2024-10-27 16:34:01 -03:00
- SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &show_delay, 0);
2024-09-06 19:37:25 -04:00
- separator_upper_height = 5;
- separator_lower_height = 7;
2024-10-27 16:34:01 -03:00
+ //SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &show_delay, 0);
2024-11-09 15:09:56 -03:00
+ static const bool is_win11 = base::win::GetVersion() >= base::win::Version::WIN11;
2024-09-01 14:35:00 -04:00
+ use_outer_border = features::IsThorium2024() ? true : false;
+
+ if (features::IsThorium2024()) {
+ if (is_win11) {
2024-10-27 16:34:01 -03:00
+ corner_radius = 4;
+ arrow_to_edge_padding = 4;
2024-09-01 14:35:00 -04:00
+ menu_horizontal_border_size = 4;
+ submenu_horizontal_overlap = 1;
+ rounded_menu_vertical_border_size = 4;
2024-10-11 19:33:00 -03:00
+ item_horizontal_padding = 1;
2024-09-01 14:35:00 -04:00
+ between_item_vertical_padding = 2;
+ separator_height = 1;
+ separator_upper_height = 1;
+ separator_lower_height = 1;
+ item_corner_radius = 4;
2024-10-11 19:33:00 -03:00
+ use_outer_border = true;
2024-09-01 14:35:00 -04:00
+ } else {
2024-09-06 19:37:25 -04:00
+ corner_radius = 0;
+ arrow_to_edge_padding = 2;
2024-09-01 14:35:00 -04:00
+ 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 = 4;
+ separator_lower_height = 4;
2024-09-01 14:35:00 -04:00
+ use_outer_border = true;
+ }
2024-09-06 19:37:25 -04:00
+ } else {
+ separator_upper_height = 5;
+ separator_lower_height = 7;
2024-09-01 14:35:00 -04:00
+ }
use_bubble_border = corner_radius > 0;
}
2024-09-06 19:37:25 -04:00
2024-10-03 08:24:53 -03:00
diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc
index 3ed4ba49f5b4d..7a9b2a96f7c9a 100644
--- a/ui/views/controls/tree/tree_view.cc
+++ b/ui/views/controls/tree/tree_view.cc
@@ -19,6 +19,7 @@
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/ui_base_features.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/events/event.h"
@@ -96,12 +97,33 @@ TreeView::TreeView()
drawing_provider_(std::make_unique<TreeViewDrawingProvider>()) {
// Always focusable, even on Mac (consistent with NSOutlineView).
SetFocusBehavior(FocusBehavior::ALWAYS);
+#if BUILDFLAG(IS_MAC)
+ constexpr bool kUseMdIcons = true;
+#else
+ constexpr bool kUseMdIcons = false;
+#endif
+ if (features::IsThorium2024()) {
+ if (kUseMdIcons) {
+ closed_icon_ = open_icon_ = ui::ImageModel::FromVectorIcon(
+ vector_icons::kFolderIcon, ui::kColorIcon);
+ } else {
+ // TODO(ellyjones): if the pre-Harmony codepath goes away, merge
+ // closed_icon_ and open_icon_.
+ closed_icon_ = ui::ImageModel::FromImage(
+ ui::ResourceBundle::GetSharedInstance().GetImageNamed(
+ IDR_FOLDER_CLOSED));
+ open_icon_ = ui::ImageModel::FromImage(
+ ui::ResourceBundle::GetSharedInstance().GetImageNamed(IDR_FOLDER_OPEN));
+ }
+ text_offset_ = closed_icon_.Size().width() + kImagePadding + kImagePadding +
+ kArrowRegionSize;
+ } else {
+ folder_icon_ = ui::ImageModel::FromVectorIcon(
+ vector_icons::kFolderChromeRefreshIcon, ui::kColorIcon);
- folder_icon_ = ui::ImageModel::FromVectorIcon(
- vector_icons::kFolderChromeRefreshIcon, ui::kColorIcon);
-
- text_offset_ = folder_icon_.Size().width() + kImagePadding + kImagePadding +
- kArrowRegionSize;
+ text_offset_ = folder_icon_.Size().width() + kImagePadding + kImagePadding +
+ kArrowRegionSize;
+ }
}
TreeView::~TreeView() {
@@ -1174,21 +1196,43 @@ void TreeView::PaintNodeIcon(gfx::Canvas* canvas,
const gfx::Rect& bounds) {
std::optional<size_t> icon_index = model_->GetIconIndex(node->model_node());
int icon_x = kArrowRegionSize + kImagePadding;
- if (!icon_index.has_value()) {
- // Flip just the |bounds| region of |canvas|.
- gfx::ScopedCanvas scoped_canvas(canvas);
- canvas->Translate(gfx::Vector2d(bounds.x(), 0));
- scoped_canvas.FlipIfRTL(bounds.width());
- // Now paint the icon local to that flipped region.
- PaintRowIcon(canvas, folder_icon_.Rasterize(GetColorProvider()), icon_x,
- gfx::Rect(0, bounds.y(), bounds.width(), bounds.height()));
+ if (features::IsThorium2024()) {
+ if (!icon_index.has_value()) {
+ // Flip just the |bounds| region of |canvas|.
+ gfx::ScopedCanvas scoped_canvas(canvas);
+ canvas->Translate(gfx::Vector2d(bounds.x(), 0));
+ scoped_canvas.FlipIfRTL(bounds.width());
+ // Now paint the icon local to that flipped region.
+ PaintRowIcon(canvas,
+ (node->is_expanded() ? open_icon_ : closed_icon_)
+ .Rasterize(GetColorProvider()),
+ icon_x,
+ gfx::Rect(0, bounds.y(), bounds.width(), bounds.height()));
+ } else {
+ const gfx::ImageSkia& icon =
+ icons_[icon_index.value()].Rasterize(GetColorProvider());
+ icon_x += (open_icon_.Size().width() - icon.width()) / 2;
+ if (base::i18n::IsRTL())
+ icon_x = bounds.width() - icon_x - icon.width();
+ PaintRowIcon(canvas, icon, icon_x, bounds);
+ }
} else {
- const gfx::ImageSkia& icon =
- icons_[icon_index.value()].Rasterize(GetColorProvider());
- icon_x += (folder_icon_.Size().width() - icon.width()) / 2;
- if (base::i18n::IsRTL())
- icon_x = bounds.width() - icon_x - icon.width();
- PaintRowIcon(canvas, icon, icon_x, bounds);
+ if (!icon_index.has_value()) {
+ // Flip just the |bounds| region of |canvas|.
+ gfx::ScopedCanvas scoped_canvas(canvas);
+ canvas->Translate(gfx::Vector2d(bounds.x(), 0));
+ scoped_canvas.FlipIfRTL(bounds.width());
+ // Now paint the icon local to that flipped region.
+ PaintRowIcon(canvas, folder_icon_.Rasterize(GetColorProvider()), icon_x,
+ gfx::Rect(0, bounds.y(), bounds.width(), bounds.height()));
+ } else {
+ const gfx::ImageSkia& icon =
+ icons_[icon_index.value()].Rasterize(GetColorProvider());
+ icon_x += (folder_icon_.Size().width() - icon.width()) / 2;
+ if (base::i18n::IsRTL())
+ icon_x = bounds.width() - icon_x - icon.width();
+ PaintRowIcon(canvas, icon, icon_x, bounds);
+ }
}
}
diff --git a/ui/views/controls/tree/tree_view.h b/ui/views/controls/tree/tree_view.h
index 3a8a79eb69c32..f29814a4fc4b9 100644
--- a/ui/views/controls/tree/tree_view.h
+++ b/ui/views/controls/tree/tree_view.h
@@ -461,6 +461,10 @@ class VIEWS_EXPORT TreeView : public View,
// Default folder icon.
ui::ImageModel folder_icon_;
+ // Default icons for closed/open.
+ ui::ImageModel closed_icon_;
+ ui::ImageModel open_icon_;
+
// Icons from the model.
std::vector<ui::ImageModel> icons_;
2024-08-12 10:53:10 -04:00
diff --git a/ui/views/layout/layout_provider.cc b/ui/views/layout/layout_provider.cc
2024-10-11 19:33:00 -03:00
index 01301096ca466..e4854f99dad64 100644
2024-08-12 10:53:10 -04:00
--- a/ui/views/layout/layout_provider.cc
+++ b/ui/views/layout/layout_provider.cc
2024-08-16 23:32:34 -04:00
@@ -8,6 +8,7 @@
2024-08-12 10:53:10 -04:00
#include "base/containers/fixed_flat_map.h"
#include "base/logging.h"
2024-08-16 23:32:34 -04:00
+#include "chrome/browser/ui/thorium_2024.h"
2024-08-12 10:53:10 -04:00
#include "ui/base/ui_base_features.h"
2024-08-16 23:32:34 -04:00
#include "ui/gfx/font_list.h"
#include "ui/views/controls/focus_ring.h"
2024-10-03 08:24:53 -03:00
@@ -208,6 +209,48 @@ ShapeSysTokens GetShapeSysToken(ShapeContextTokens id) {
2024-08-16 23:32:34 -04:00
2024-08-17 08:28:28 -04:00
int LayoutProvider::GetCornerRadiusMetric(ShapeContextTokens id,
const gfx::Size& size) const {
+
2024-10-03 08:24:53 -03:00
+ static const bool classic_omnibox = base::CommandLine::ForCurrentProcess()->HasSwitch("classic-omnibox");
2024-08-22 11:02:48 -04:00
+ if (features::IsThorium2024()) {
2024-08-12 10:53:10 -04:00
+ switch (id) {
2024-08-16 23:32:34 -04:00
+ case ShapeContextTokens::kBadgeRadius:
2024-10-11 19:33:00 -03:00
+ return 4;
2024-08-16 23:32:34 -04:00
+ case ShapeContextTokens::kButtonRadius:
2024-09-01 14:35:00 -04:00
+ return 4;
2024-08-16 23:32:34 -04:00
+ case ShapeContextTokens::kComboboxRadius:
2024-10-11 19:33:00 -03:00
+ return 4;
2024-08-16 23:32:34 -04:00
+ case ShapeContextTokens::kDialogRadius:
2024-10-11 19:33:00 -03:00
+ return 4;
2024-08-16 23:32:34 -04:00
+ case ShapeContextTokens::kFindBarViewRadius:
2024-10-11 19:33:00 -03:00
+ return 4;
2024-08-12 10:53:10 -04:00
+ case ShapeContextTokens::kMenuRadius:
2024-08-16 23:32:34 -04:00
+ case ShapeContextTokens::kMenuAuxRadius:
2024-08-17 08:28:28 -04:00
+ return 0;
2024-08-16 23:32:34 -04:00
+ case ShapeContextTokens::kMenuTouchRadius:
2024-08-17 08:28:28 -04:00
+ return 8;
2024-10-03 08:24:53 -03:00
+ case ShapeContextTokens::kOmniboxExpandedRadius: {
+ if (classic_omnibox) {
+ return 4;
+ } else {
+ return 16;
+ }
+ }
+ case ShapeContextTokens::kTextfieldRadius: {
+ if (classic_omnibox) {
+ return 4;
+ } else {
+ return 8;
+ }
+ }
2024-08-16 23:32:34 -04:00
+ case ShapeContextTokens::kSidePanelContentRadius:
2024-08-17 08:28:28 -04:00
+ return 16;
+ case ShapeContextTokens::kSidePanelPageContentRadius:
+ return 8;
2024-08-16 23:32:34 -04:00
+ default:
+ return 0;
2024-08-12 10:53:10 -04:00
+ }
+ }
2024-08-16 23:32:34 -04:00
+
2024-09-24 07:56:24 -03:00
ShapeSysTokens token = GetShapeSysToken(id);
DCHECK_NE(token, ShapeSysTokens::kDefault)
<< "kDefault token means there is a missing mapping between shape tokens";
2024-10-27 16:34:01 -03:00
diff --git a/ui/views/metrics.cc b/ui/views/metrics.cc
index 75fc666dfbeb3..ee108f6a31c59 100644
--- a/ui/views/metrics.cc
+++ b/ui/views/metrics.cc
@@ -6,6 +6,6 @@
namespace views {
-const int kDefaultMenuShowDelay = 400;
+const int kDefaultMenuShowDelay = 1;
} // namespace views
diff --git a/ui/views/metrics_aura.cc b/ui/views/metrics_aura.cc
index c8a9260b6c6e6..129b06e148063 100644
--- a/ui/views/metrics_aura.cc
+++ b/ui/views/metrics_aura.cc
@@ -23,12 +23,7 @@ int GetDoubleClickInterval() {
int GetMenuShowDelay() {
#if BUILDFLAG(IS_WIN)
- static int delay = []() {
- DWORD show_delay;
- return SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &show_delay, 0)
- ? static_cast<int>(show_delay)
- : kDefaultMenuShowDelay;
- }();
+ static int delay = kDefaultMenuShowDelay;
return delay;
#else
return 0;
2024-10-11 19:33:00 -03:00
diff --git a/ui/webui/resources/cr_elements/md_select.css b/ui/webui/resources/cr_elements/md_select.css
index c6f72014e5f24..9032a51118467 100644
--- a/ui/webui/resources/cr_elements/md_select.css
+++ b/ui/webui/resources/cr_elements/md_select.css
@@ -23,7 +23,7 @@
background-size: var(--md-arrow-width);
border: solid 1px var(--color-combobox-container-outline,
var(--cr-fallback-color-neutral-outline));
- border-radius: 8px;
+ border-radius: 4px;
box-sizing: border-box;
color: var(--md-select-text-color);
cursor: pointer;
2024-10-03 08:24:53 -03:00
diff --git a/ui/webui/resources/cr_elements/cr_button/cr_button.css b/ui/webui/resources/cr_elements/cr_button/cr_button.css
index 69dc68d302b63..c0b974153be08 100644
--- a/ui/webui/resources/cr_elements/cr_button/cr_button.css
+++ b/ui/webui/resources/cr_elements/cr_button/cr_button.css
@@ -74,7 +74,7 @@
user-select: none;
-webkit-tap-highlight-color: transparent;
border: var(--cr-button-border, 1px solid var(--cr-button-border-color));
- border-radius: 100px;
+ border-radius: 4px;
background: var(--cr-button-background-color);
color: var(--cr-button-text-color);
font-weight: 500;
@@ -92,7 +92,7 @@
}
:host(.floating-button) {
- border-radius: 8px;
+ border-radius: 4px;
height: 40px;
transition: box-shadow 80ms linear;
}
diff --git a/ui/webui/resources/cr_elements/cr_toggle/cr_toggle.css b/ui/webui/resources/cr_elements/cr_toggle/cr_toggle.css
index c467dbadf8e14..d495dafcb45c4 100644
2024-10-03 08:24:53 -03:00
--- a/ui/webui/resources/cr_elements/cr_toggle/cr_toggle.css
+++ b/ui/webui/resources/cr_elements/cr_toggle/cr_toggle.css
@@ -17,7 +17,6 @@
var(--cr-fallback-color-on-primary));
--cr-toggle-checked-ripple-color: var(
--cr-active-neutral-on-subtle-background-color);
- --cr-toggle-ripple-diameter: 20px;
--cr-toggle-unchecked-bar-color:
var(--color-toggle-button-track-off,
var(--cr-fallback-color-surface-variant));
@@ -26,19 +25,16 @@
var(--cr-fallback-color-outline));
--cr-toggle-unchecked-ripple-color: var(
2024-10-03 08:24:53 -03:00
--cr-active-neutral-on-subtle-background-color);
- --cr-toggle-bar-border-color: var(--cr-toggle-unchecked-button-color);
- --cr-toggle-bar-border: 1px solid var(--cr-toggle-bar-border-color);
2024-10-03 08:24:53 -03:00
- --cr-toggle-bar-width: 26px;
- --cr-toggle-knob-diameter: 8px;
+ --cr-toggle-ripple-diameter: 34px;
+ --cr-toggle-knob-diameter: 16px;
2024-10-03 08:24:53 -03:00
-webkit-tap-highlight-color: transparent;
cursor: pointer;
display: block;
- height: fit-content;
- isolation: isolate;
- min-width: initial;
+ min-width: 34px;
outline: none;
+ height: fit-content;
position: relative;
- width: fit-content;
+ width: 34px;
}
@media (forced-colors: active) {
@@ -53,112 +49,61 @@
}
}
-:host(:active) {
- --cr-toggle-knob-diameter: 10px;
-}
-
-:host([checked]) {
- --cr-toggle-bar-border-color: var(--cr-toggle-checked-bar-color);
- --cr-toggle-knob-diameter: 12px;
-}
-
-:host([checked]:active) {
- --cr-toggle-knob-diameter: 14px;
+@media (prefers-color-scheme: dark) {
+ :host {
+ --cr-toggle-checked-bar-color: var(--google-blue-300);
+ --cr-toggle-checked-button-color: var(--google-blue-300);
+ --cr-toggle-checked-ripple-color:
+ rgba(var(--google-blue-300-rgb), .4);
+ --cr-toggle-unchecked-bar-color: var(--google-grey-500);
+ --cr-toggle-unchecked-button-color: var(--google-grey-300);
+ --cr-toggle-unchecked-ripple-color:
+ rgba(var(--google-grey-300-rgb), .4);
+ }
}
:host([disabled]) {
- --cr-toggle-checked-bar-color:
- var(--color-toggle-button-track-on-disabled,
- var(--cr-fallback-color-disabled-background));
- --cr-toggle-checked-button-color:
- var(--color-toggle-button-thumb-on-disabled, var(--cr-fallback-color-surface));
- --cr-toggle-unchecked-bar-color: transparent;
- --cr-toggle-unchecked-button-color:
- var(--color-toggle-button-thumb-off-disabled,
- var(--cr-fallback-color-disabled-foreground));
- --cr-toggle-bar-border-color: var(--cr-toggle-unchecked-button-color);
cursor: initial;
- opacity: 1;
+ opacity: var(--cr-disabled-opacity);
pointer-events: none;
}
-:host([checked][disabled]) {
- --cr-toggle-bar-border: none;
+:host(:hover) {
+ --cr-toggle-knob-diameter: 18px;
}
#bar {
background-color: var(--cr-toggle-unchecked-bar-color);
- border: var(--cr-toggle-bar-border);
- border-radius: 50px;
- box-sizing: border-box;
- display: block;
2024-10-03 08:24:53 -03:00
- height: 16px;
+ border-radius: 8px;
+ height: 12px;
2024-10-03 08:24:53 -03:00
left: 3px;
- opacity: 1;
- position: initial;
+ position: absolute;
top: 2px;
- transition: background-color linear 80ms;
- width: var(--cr-toggle-bar-width);
+ transition: background-color linear 180ms;
+ width: 30px;
z-index: 0;
}
:host([checked]) #bar {
background-color: var(--cr-toggle-checked-bar-color);
- opacity: 1;
-}
-
-:host(:focus-visible) #bar {
- outline: 2px solid var(--cr-toggle-checked-bar-color);
- outline-offset: 2px;
+ opacity: 0.5;
}
#knob {
- /* Distance between knob center to the edge of the control is the same
- for both checked and unchecked. */
- --cr-toggle-knob-center-edge-distance_: 8px;
-
- /* Direction for on/off states
- - +1 means 'off' to the left, 'on' to the right, used in LTR.
- - -1 means 'off' to the right, 'on' to the left, used in RTL. */
- --cr-toggle-knob-direction_: 1;
-
- /* Absolute distance from the center position to either left or
- right. */
- --cr-toggle-knob-travel-distance_: calc(
- 0.5 * var(--cr-toggle-bar-width) -
- var(--cr-toggle-knob-center-edge-distance_));
-
- /* Positions in the horizontal (x-axis) dimension that the knob can be
- in. The center position is only used for calculations, and is never
- presented to the user. */
- --cr-toggle-knob-position-center_: calc(
- 0.5 * var(--cr-toggle-bar-width) + -50%);
- --cr-toggle-knob-position-start_: calc(
- var(--cr-toggle-knob-position-center_) -
- var(--cr-toggle-knob-direction_) *
- var(--cr-toggle-knob-travel-distance_));
- --cr-toggle-knob-position-end_: calc(
- var(--cr-toggle-knob-position-center_) +
- var(--cr-toggle-knob-direction_) *
- var(--cr-toggle-knob-travel-distance_));
-
background-color: var(--cr-toggle-unchecked-button-color);
border-radius: 50%;
- box-shadow: none;
+ box-shadow: var(--cr-toggle-box-shadow, 0 1px 3px 0 rgba(0, 0, 0, .6));
display: block;
- height: var(--cr-toggle-knob-diameter);
- position: absolute;
- top: 50%;
- transform: translate(var(--cr-toggle-knob-position-start_), -50%);
- transition: transform linear 80ms, background-color linear 80ms,
- width linear 80ms, height linear 80ms;
- width: var(--cr-toggle-knob-diameter);
+ height: 16px;
+ position: relative;
+ transition: transform linear 180ms, background-color linear 180ms;
+ width: 16px;
z-index: 1;
}
:host([checked]) #knob {
background-color: var(--cr-toggle-checked-button-color);
- transform: translate(var(--cr-toggle-knob-position-end_), -50%);
+ transform: translate3d(20px, 0, 0);
}
:host-context([dir=rtl]) #knob {
@@ -167,25 +112,6 @@
--cr-toggle-knob-direction_: -1;
}
-:host([checked]:active) #knob,
-:host([checked]:hover) #knob {
- --cr-toggle-checked-button-color:
- var(--color-toggle-button-thumb-on-hover,
- var(--cr-fallback-color-primary-container));
-}
-
-:host(:hover) #knob::before {
- background-color: var(--cr-hover-on-subtle-background-color);
- border-radius: 50%;
- content: '';
- height: var(--cr-toggle-ripple-diameter);
- left: 50%;
- position: absolute;
- top: 50%;
- transform: translate(-50%, -50%);
- width: var(--cr-toggle-ripple-diameter);
-}
-
#ink {
--paper-ripple-opacity: 1;
color: var(--cr-toggle-unchecked-ripple-color);
@@ -196,7 +122,7 @@
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
- transition: color linear 80ms;
+ transition: color linear 180ms;
width: var(--cr-toggle-ripple-diameter);
}