diff --git a/base/BUILD.gn b/base/BUILD.gn
index 9247e9b3f4c92..c73f6fdd5e4f2 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -2532,6 +2532,7 @@ buildflag_header("debugging_buildflags") {
"ENABLE_ALLOCATION_STACK_TRACE_RECORDER=$build_allocation_stack_trace_recorder",
"ENABLE_ALLOCATION_TRACE_RECORDER_FULL_REPORTING=$build_allocation_trace_recorder_full_reporting",
"PRINT_UNSYMBOLIZED_STACK_TRACES=$print_unsymbolized_stack_traces",
+ "THORIUM_DEBUG=$thorium_debug",
]
}
diff --git a/base/check.cc b/base/check.cc
index bd63d5a88e34e..1bed253cb50ee 100644
--- a/base/check.cc
+++ b/base/check.cc
@@ -323,6 +323,7 @@ std::ostream& CheckError::stream() {
}
CheckError::~CheckError() {
+#if !BUILDFLAG(THORIUM_DEBUG)
// TODO(crbug.com/40254046): Consider splitting out CHECK from DCHECK so that
// the destructor can be marked [[noreturn]] and we don't need to check
// severity in the destructor.
@@ -340,6 +341,7 @@ CheckError::~CheckError() {
if (is_fatal) {
base::ImmediateCrash();
}
+#endif // !BUILDFLAG(THORIUM_DEBUG)
}
CheckError::CheckError(LogMessage* log_message) : log_message_(log_message) {}
diff --git a/base/debug/debug.gni b/base/debug/debug.gni
index 1d236d210a16f..b5059c81559ec 100644
--- a/base/debug/debug.gni
+++ b/base/debug/debug.gni
@@ -26,6 +26,13 @@ declare_args() {
# Even if it's disabled we still collect some data, i.e. total number of
# allocations. All other data will be set to a default value.
build_allocation_trace_recorder_full_reporting = false
+
+ # A special build flag for the Thorium debug builds.
+ #
+ # This enables stack traces in logs and non-fatalizes DCHECKs.
+ # Ultimately, it should help users collect necessary data for browser issues
+ # without setting up a dedicated debugger.
+ thorium_debug = is_debug
}
assert(!(build_allocation_stack_trace_recorder && is_fuchsia),
diff --git a/base/files/file_util_win.cc b/base/files/file_util_win.cc
index 7cda11126e61e..fe82b35a1a5d1 100644
--- a/base/files/file_util_win.cc
+++ b/base/files/file_util_win.cc
@@ -883,8 +883,9 @@ bool IsLink(const FilePath& file_path) {
}
bool GetFileInfo(const FilePath& file_path, File::Info* results) {
+#if !BUILDFLAG(THORIUM_DEBUG)
ScopedBlockingCall scoped_blocking_call(FROM_HERE, BlockingType::MAY_BLOCK);
-
+#endif
WIN32_FILE_ATTRIBUTE_DATA attr;
if (!GetFileAttributesEx(file_path.value().c_str(), GetFileExInfoStandard,
&attr)) {
diff --git a/base/logging.cc b/base/logging.cc
index 0d93ca4713624..98abb80818124 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -62,6 +62,7 @@
#include "build/chromeos_buildflags.h"
#include "third_party/abseil-cpp/absl/base/internal/raw_logging.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
+#include "ui/base/ui_base_features.h"
#if !BUILDFLAG(IS_NACL)
#include "base/auto_reset.h"
@@ -457,6 +458,7 @@ void WriteToFd(int fd, const char* data, size_t length) {
}
}
+#if !BUILDFLAG(THORIUM_DEBUG)
void SetLogFatalCrashKey(LogMessage* log_message) {
#if !BUILDFLAG(IS_NACL)
// In case of an out-of-memory condition, this code could be reentered when
@@ -477,6 +479,7 @@ void SetLogFatalCrashKey(LogMessage* log_message) {
#endif // !BUILDFLAG(IS_NACL)
}
+#endif
std::string BuildCrashString(const char* file,
int line,
@@ -586,8 +589,12 @@ int GetMinLogLevel() {
}
bool ShouldCreateLogMessage(int severity) {
- if (severity < g_min_log_level)
+ if (severity < g_min_log_level) {
return false;
+ }
+ if (IsVerbose()) {
+ return true;
+ }
// Return true here unless we know ~LogMessage won't do anything.
return g_logging_destination != LOG_NONE || g_log_message_handler ||
@@ -599,8 +606,12 @@ bool ShouldCreateLogMessage(int severity) {
// set, or only LOG_TO_FILE is set, since that is useful for local development
// and debugging.
bool ShouldLogToStderr(int severity) {
- if (g_logging_destination & LOG_TO_STDERR)
+ if (g_logging_destination & LOG_TO_STDERR) {
return true;
+ }
+ if (IsVerbose()) {
+ return true;
+ }
#if BUILDFLAG(IS_FUCHSIA)
// Fuchsia will persist data logged to stdio by a component, so do not emit
@@ -731,9 +742,11 @@ void LogMessage::Flush() {
// Don't let actions from this method affect the system error after returning.
base::ScopedClearLastError scoped_clear_last_error;
+#if !BUILDFLAG(THORIUM_DEBUG)
size_t stack_start = stream_.str().length();
+#endif
#if !defined(OFFICIAL_BUILD) && !BUILDFLAG(IS_NACL) && !defined(__UCLIBC__) && \
- !BUILDFLAG(IS_AIX)
+ !BUILDFLAG(IS_AIX) || BUILDFLAG(THORIUM_DEBUG)
// Include a stack trace on a fatal, unless a debugger is attached.
if (severity_ == LOGGING_FATAL && !base::debug::BeingDebugged()) {
base::debug::StackTrace stack_trace;
@@ -766,6 +779,7 @@ void LogMessage::Flush() {
std::string str_newline(stream_.str());
TraceLogMessage(file_, line_, str_newline.substr(message_start_));
+#if !BUILDFLAG(THORIUM_DEBUG)
// FATAL messages should always run the assert handler and crash, even if a
// message handler marks them as otherwise handled.
absl::Cleanup handle_fatal_message = [&] {
@@ -776,6 +790,7 @@ void LogMessage::Flush() {
if (severity_ == LOGGING_FATAL)
SetLogFatalCrashKey(this);
+#endif
// Give any log message handler first dibs on the message.
if (g_log_message_handler &&
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.
diff --git a/chrome/browser/resources/downloads/item.html.ts b/chrome/browser/resources/downloads/item.html.ts
index 1e0f2c895d708..64347e17d7e42 100644
--- a/chrome/browser/resources/downloads/item.html.ts
+++ b/chrome/browser/resources/downloads/item.html.ts
@@ -47,7 +47,7 @@ export function getHtml(this: DownloadsItemElement) {
?hidden="${!this.shouldShowReferrerUrl_()}">
- ${this.getDisplayUrlStr_()}
@@ -94,7 +94,6 @@ export function getHtml(this: DownloadsItemElement) {
focus-row-control focus-type="copyDownloadLink">
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": "",
- "version": "1",
- "description": "",
+ "version": "1.0.1",
+ "description": "Internal Component Extension for rendering PDFs.",
"offline_enabled": true,
"incognito": "split",
"permissions": [
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index 40c586fb4f715..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 (!profile.IsChild()) {
- 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 bc6e4008f2c5a..bd11ac01d442c 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -4430,6 +4430,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",
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 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(color)) {
+ sk_color = absl::get(color);
+ } else {
+ DCHECK(color_provider);
+ sk_color = color_provider->GetColor(absl::get(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(folder),
folder.size());
};
diff --git a/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc b/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc
index 64948595a4bc6..a568c893736ca 100644
--- a/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc
@@ -47,7 +47,7 @@ using bookmarks::BookmarkNode;
namespace chrome {
-size_t kNumBookmarkUrlsBeforePrompting = 15;
+size_t kNumBookmarkUrlsBeforePrompting = 50;
static BookmarkNavigationWrapper* g_nav_wrapper_test_instance = nullptr;
diff --git a/chrome/browser/ui/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 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(it - items_.begin());
}
diff --git a/chrome/browser/ui/browser_actions.cc b/chrome/browser/ui/browser_actions.cc
index d65691f1aa1a5..da4fff1f928f7 100644
--- a/chrome/browser/ui/browser_actions.cc
+++ b/chrome/browser/ui/browser_actions.cc
@@ -9,6 +9,7 @@
#include
#include "base/check_op.h"
+#include "base/command_line.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/profiles/profile.h"
@@ -410,6 +411,8 @@ void BrowserActions::InitializeBrowserActions() {
if (IsChromeLabsEnabled()) {
// TODO(b/354758327): Update `ShouldShowChromeLabsUI()` to not require
// `model` as a parameter, then use to set visibility of action item.
+ static const bool disable_thorium_icons =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("disable-thorium-icons");
root_action_item_->AddChild(
ChromeMenuAction(base::BindRepeating(
[](Browser* browser, actions::ActionItem* item,
@@ -418,7 +421,9 @@ void BrowserActions::InitializeBrowserActions() {
},
base::Unretained(browser)),
kActionShowChromeLabs, IDS_CHROMELABS,
- IDS_CHROMELABS, kScienceIcon)
+ IDS_CHROMELABS, disable_thorium_icons
+ ? kScienceIcon
+ : kScienceThoriumIcon)
.SetVisible(false)
.Build());
}
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 86af74569f013..1f9cc1696eda4 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -1423,7 +1423,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_mixer.cc b/chrome/browser/ui/color/chrome_color_mixer.cc
index 589c77c52175b..e408764fc6aae 100644
--- a/chrome/browser/ui/color/chrome_color_mixer.cc
+++ b/chrome/browser/ui/color/chrome_color_mixer.cc
@@ -748,8 +748,7 @@ void AddChromeColorMixer(ui::ColorProvider* provider,
ui::SetAlpha(kColorToolbarInkDrop, std::ceil(0.06f * 255.0f));
mixer[kColorAppMenuChipInkDropHover] = {kColorToolbarInkDropHover};
mixer[kColorAppMenuChipInkDropRipple] = {kColorToolbarInkDropRipple};
- mixer[kColorToolbarExtensionSeparatorEnabled] = {
- kColorTabBackgroundInactiveFrameActive};
+ mixer[kColorToolbarExtensionSeparatorEnabled] = {ui::kColorSysDivider};
mixer[kColorToolbarExtensionSeparatorDisabled] = {
kColorToolbarButtonIconInactive};
mixer[kColorToolbarSeparator] = {kColorToolbarSeparatorDefault};
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 9faa599b47cc1..d683ac878cb0e 100644
--- a/chrome/browser/ui/color/tab_strip_color_mixer.cc
+++ b/chrome/browser/ui/color/tab_strip_color_mixer.cc
@@ -136,10 +136,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 {
diff --git a/chrome/browser/ui/layout_constants.cc b/chrome/browser/ui/layout_constants.cc
index 87c4ee64068a6..9dd4397f0e88b 100644
--- a/chrome/browser/ui/layout_constants.cc
+++ b/chrome/browser/ui/layout_constants.cc
@@ -7,6 +7,7 @@
#include "base/feature_list.h"
#include "base/notreached.h"
#include "build/build_config.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "chrome/browser/ui/tabs/features.h"
#include "chrome/browser/ui/ui_features.h"
#include "components/omnibox/common/omnibox_features.h"
@@ -22,20 +23,25 @@ int GetLayoutConstant(LayoutConstant constant) {
const bool touch_ui = ui::TouchUiController::Get()->touch_ui();
switch (constant) {
case APP_MENU_PROFILE_ROW_AVATAR_ICON_SIZE:
- return 24;
+ return features::IsThorium2024() ? 18 : 24;
case APP_MENU_MAXIMUM_CHARACTER_LENGTH:
return 30;
case BOOKMARK_BAR_HEIGHT: {
// The fixed margin ensures the bookmark buttons appear centered relative
// to the white space above and below.
- const int bookmark_bar_attached_vertical_margin = 6;
+ const int bookmark_bar_attached_vertical_margin = features::IsThorium2024() ? 3 : 6;
return GetLayoutConstant(BOOKMARK_BAR_BUTTON_HEIGHT) +
bookmark_bar_attached_vertical_margin;
}
- case BOOKMARK_BAR_BUTTON_HEIGHT:
- return touch_ui ? 36 : 28;
+ case BOOKMARK_BAR_BUTTON_HEIGHT: {
+ if (features::IsThorium2024()) {
+ return touch_ui ? 34 : 26;
+ } else {
+ return touch_ui ? 36 : 28;
+ }
+ }
case BOOKMARK_BAR_BUTTON_PADDING:
- return GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
+ return features::IsThorium2024() ? 2 : GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
case BOOKMARK_BAR_BUTTON_IMAGE_LABEL_PADDING:
return 6;
case WEB_APP_MENU_BUTTON_SIZE:
@@ -68,11 +74,23 @@ int GetLayoutConstant(LayoutConstant constant) {
// here once we decide on a permutation.
NOTREACHED();
case LOCATION_BAR_TRAILING_DECORATION_EDGE_PADDING:
- return touch_ui ? 3 : 12;
+ if (features::IsThorium2024()) {
+ return touch_ui ? 3 : 5;
+ } else {
+ return touch_ui ? 3 : 12;
+ }
case LOCATION_BAR_TRAILING_DECORATION_INNER_PADDING:
- return touch_ui ? 3 : 8;
+ if (features::IsThorium2024()) {
+ return touch_ui ? 3 : 4;
+ } else {
+ 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 +103,23 @@ int GetLayoutConstant(LayoutConstant constant) {
return 16;
case TAB_ALERT_INDICATOR_ICON_WIDTH:
return touch_ui ? 12 : 16;
+ case TAB_BUTTON_OFFSET:
+ return features::IsThorium2024() ? -1 : 0;
case TAB_CLOSE_BUTTON_SIZE:
- return touch_ui ? 24 : 16;
+ return touch_ui ? 24 : 18;
case TAB_HEIGHT:
return 34 + GetLayoutConstant(TABSTRIP_TOOLBAR_OVERLAP);
case TAB_STRIP_HEIGHT:
return GetLayoutConstant(TAB_HEIGHT) +
GetLayoutConstant(TAB_STRIP_PADDING);
case TAB_STRIP_PADDING:
- return 6;
+ return features::IsThorium2024() ? 0 : 6;
+ case TAB_MARGIN:
+ return features::IsThorium2024() ? 6 : 6;
+ case TAB_INACTIVE_PADDING:
+ return features::IsThorium2024() ? 3 : 6;
+ case TAB_SEARCH_PADDING:
+ return features::IsThorium2024() ? 3 : 6;
case TAB_SEPARATOR_HEIGHT:
return touch_ui ? 24 : 20;
case TAB_PRE_TITLE_PADDING:
@@ -108,13 +134,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;
+ }
case TOOLBAR_DIVIDER_CORNER_RADIUS:
return 1;
case TOOLBAR_DIVIDER_HEIGHT:
- return touch_ui ? 20 : 16;
+ if (features::IsThorium2024()) {
+ return touch_ui ? 20 : 18;
+ } else {
+ return touch_ui ? 20 : 16;
+ }
case TOOLBAR_DIVIDER_SPACING:
- return 9;
+ return features::IsThorium2024() ? 7 : 9;
case TOOLBAR_DIVIDER_WIDTH:
return 2;
case TOOLBAR_ELEMENT_PADDING:
@@ -122,13 +156,17 @@ int GetLayoutConstant(LayoutConstant constant) {
case TOOLBAR_ICON_DEFAULT_MARGIN:
return touch_ui ? 0 : 2;
case TOOLBAR_STANDARD_SPACING:
- return touch_ui ? 12 : 9;
+ if (features::IsThorium2024()) {
+ return touch_ui ? 12 : 7;
+ } else {
+ return touch_ui ? 12 : 9;
+ }
case PAGE_INFO_ICON_SIZE:
return 20;
case DOWNLOAD_ICON_SIZE:
return 20;
case TOOLBAR_CORNER_RADIUS:
- return 8;
+ return 0;
default:
break;
}
@@ -146,7 +184,11 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
return gfx::Insets::VH(8, 20);
case LOCATION_BAR_ICON_INTERIOR_PADDING:
- return gfx::Insets::VH(2, 2);
+ if (features::IsThorium2024()) {
+ return touch_ui ? gfx::Insets::VH(5, 10) : gfx::Insets::VH(4, 8);
+ } else {
+ return gfx::Insets::VH(2, 2);
+ }
case LOCATION_BAR_PAGE_INFO_ICON_PADDING:
return touch_ui ? gfx::Insets::VH(5, 10) : gfx::Insets::VH(4, 4);
@@ -161,27 +203,36 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
}
case TOOLBAR_BUTTON:
- return gfx::Insets(touch_ui ? 12 : 7);
+ return gfx::Insets(touch_ui ? 12
+ : (features::IsThorium2024() ? 6 : 7));
case BROWSER_APP_MENU_CHIP_PADDING:
- if (touch_ui) {
+ 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);
}
case TOOLBAR_INTERIOR_MARGIN:
- return touch_ui ? gfx::Insets() : gfx::Insets::VH(6, 5);
+ if (features::IsThorium2024()) {
+ return touch_ui ? gfx::Insets() : gfx::Insets::VH(4, 6);
+ } else {
+ return touch_ui ? gfx::Insets() : gfx::Insets::VH(6, 5);
+ }
case WEBUI_TAB_STRIP_TOOLBAR_INTERIOR_MARGIN:
- return gfx::Insets::VH(4, 0);
+ if (features::IsThorium2024()) {
+ return gfx::Insets::VH(4, 6);
+ } else {
+ return gfx::Insets::VH(4, 0);
+ }
}
NOTREACHED_IN_MIGRATION();
return gfx::Insets();
diff --git a/chrome/browser/ui/layout_constants.h b/chrome/browser/ui/layout_constants.h
index a35795ee8cc11..60577ba01a5fd 100644
--- a/chrome/browser/ui/layout_constants.h
+++ b/chrome/browser/ui/layout_constants.h
@@ -123,9 +123,21 @@ enum LayoutConstant {
// detached tab, and on all sides of the controls padding.
TAB_STRIP_PADDING,
+ // For the tab margins
+ TAB_MARGIN,
+
+ // For inactive tab padding
+ TAB_INACTIVE_PADDING,
+
// The height of a separator in the tabstrip.
TAB_SEPARATOR_HEIGHT,
+ // Padding for the tab search button
+ TAB_SEARCH_PADDING,
+
+ // Offset y for new tab button
+ TAB_BUTTON_OFFSET,
+
// Padding before the tab title.
TAB_PRE_TITLE_PADDING,
diff --git a/chrome/browser/ui/status_bubble.h b/chrome/browser/ui/status_bubble.h
index 74a00df155806..c8e4a81911d80 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;
+ static const int kExpandHoverDelayMS = 1;
virtual ~StatusBubble() {}
diff --git a/chrome/browser/ui/tabs/tab_menu_model.cc b/chrome/browser/ui/tabs/tab_menu_model.cc
index fba81d1815359..88415257b897c 100644
--- a/chrome/browser/ui/tabs/tab_menu_model.cc
+++ b/chrome/browser/ui/tabs/tab_menu_model.cc
@@ -105,6 +105,10 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) {
AddItemWithStringId(TabStripModel::CommandNewTabToRight,
base::i18n::IsRTL() ? IDS_TAB_CXMENU_NEWTABTOLEFT
: IDS_TAB_CXMENU_NEWTABTORIGHT);
+ AddItemWithStringId(TabStripModel::CommandNewTabToLeft,
+ base::i18n::IsRTL() ? IDS_TAB_CXMENU_NEWTABTORIGHT
+ : IDS_TAB_CXMENU_NEWTABTOLEFT);
+ //AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
if (tab_strip->delegate()->SupportsReadLater()) {
AddItem(
TabStripModel::CommandAddToReadLater,
diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc
index 91513d4488166..4fa0ac198e9c6 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -1298,6 +1298,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;
@@ -1399,6 +1400,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 4d900c4a7f58c..8daa4634abeaf 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.h
+++ b/chrome/browser/ui/tabs/tab_strip_model.h
@@ -545,6 +545,7 @@ class TabStripModel : public TabGroupController {
// for entries in the 'Add to existing group' submenu.
enum ContextMenuCommand {
CommandFirst,
+ CommandNewTabToLeft,
CommandNewTabToRight,
CommandReload,
CommandDuplicate,
diff --git a/chrome/browser/ui/tabs/tab_style.cc b/chrome/browser/ui/tabs/tab_style.cc
index d48223986946d..9e5df278ea2b6 100644
--- a/chrome/browser/ui/tabs/tab_style.cc
+++ b/chrome/browser/ui/tabs/tab_style.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/features.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "chrome/browser/ui/ui_features.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider.h"
@@ -21,13 +22,18 @@ namespace {
// Thickness in DIPs of the separator painted on the left and right edges of
// the tab.
+constexpr int kThoriumSeparatorThickness = 2;
constexpr int kChromeRefreshSeparatorThickness = 2;
+constexpr float kThoriumSeparatorHorizontalMargin = 0.0f;
constexpr int kChromeRefreshSeparatorHorizontalMargin = 2;
// TODO (crbug.com/1451400): This constant should be in LayoutConstants.
+constexpr int kThoriumSeparatorHeight = 20;
constexpr int kChromeRefreshSeparatorHeight = 16;
// The padding from the top of the tab to the content area.
+constexpr int kThoriumTabVerticalPadding = 9;
constexpr int kChromeRefreshTabVerticalPadding = 6;
+constexpr int kThoriumTabHorizontalPadding = 6;
constexpr int kChromeRefreshTabHorizontalPadding = 8;
class ChromeRefresh2023TabStyle : public TabStyle {
@@ -59,8 +65,28 @@ class ChromeRefresh2023TabStyle : public TabStyle {
TabStyle::~TabStyle() = default;
int ChromeRefresh2023TabStyle::GetStandardWidth() const {
+
+ const std::string custom_tab_width = base::CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII("custom-tab-width");
+ int kTabWidthValue;
+ if (custom_tab_width == "60") {
+ kTabWidthValue = 60;
+ } else if (custom_tab_width == "120") {
+ kTabWidthValue = 120;
+ } 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();
}
@@ -107,19 +133,42 @@ int ChromeRefresh2023TabStyle::GetMinimumInactiveWidth() const {
}
int ChromeRefresh2023TabStyle::GetTopCornerRadius() const {
- return 10;
+ static const bool rectangular_tabs =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
+ if (features::IsThorium2024() && !rectangular_tabs) {
+ return 8;
+ } else if ((rectangular_tabs && features::IsThorium2024()) || (rectangular_tabs && !features::IsThorium2024())) {
+ return 4;
+ } else {
+ return 10;
+ }
}
int ChromeRefresh2023TabStyle::GetBottomCornerRadius() const {
- return 12;
+ static const bool rectangular_tabs =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
+ if (features::IsThorium2024() && !rectangular_tabs) {
+ return 10;
+ } else if ((rectangular_tabs && features::IsThorium2024()) || (rectangular_tabs && !features::IsThorium2024())) {
+ return 4;
+ } else {
+ return 12;
+ }
}
int ChromeRefresh2023TabStyle::GetTabOverlap() const {
// The overlap removes the width and the margins of the separator.
- const float total_separator_width = GetSeparatorMargins().left() +
- GetSeparatorSize().width() +
- GetSeparatorMargins().right();
- return 2 * GetBottomCornerRadius() - total_separator_width;
+ if (features::IsThorium2024()) {
+ const float total_separator_width = GetSeparatorMargins().left() +
+ GetSeparatorSize().width() +
+ GetSeparatorMargins().right();
+ return 2 * GetBottomCornerRadius() - total_separator_width;
+ } else {
+ const float total_separator_width = GetSeparatorMargins().left() +
+ GetSeparatorSize().width() +
+ GetSeparatorMargins().right();
+ return 2 * GetBottomCornerRadius() - total_separator_width;
+ }
}
gfx::Size ChromeRefresh2023TabStyle::GetPreviewImageSize() const {
@@ -129,23 +178,43 @@ gfx::Size ChromeRefresh2023TabStyle::GetPreviewImageSize() const {
}
gfx::Size ChromeRefresh2023TabStyle::GetSeparatorSize() const {
- return gfx::Size(kChromeRefreshSeparatorThickness,
- kChromeRefreshSeparatorHeight);
+ if (features::IsThorium2024()) {
+ return gfx::Size(kThoriumSeparatorThickness,
+ kThoriumSeparatorHeight);
+ } else {
+ return gfx::Size(kChromeRefreshSeparatorThickness,
+ kChromeRefreshSeparatorHeight);
+ }
}
gfx::Insets ChromeRefresh2023TabStyle::GetSeparatorMargins() const {
- return gfx::Insets::TLBR(GetLayoutConstant(TAB_STRIP_PADDING),
- kChromeRefreshSeparatorHorizontalMargin,
- GetLayoutConstant(TAB_STRIP_PADDING),
- kChromeRefreshSeparatorHorizontalMargin);
+ if (features::IsThorium2024()) {
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_INACTIVE_PADDING),
+ kThoriumSeparatorHorizontalMargin,
+ GetLayoutConstant(TAB_INACTIVE_PADDING),
+ kThoriumSeparatorHorizontalMargin);
+ } else {
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_STRIP_PADDING),
+ kChromeRefreshSeparatorHorizontalMargin,
+ GetLayoutConstant(TAB_STRIP_PADDING),
+ kChromeRefreshSeparatorHorizontalMargin);
+ }
}
int ChromeRefresh2023TabStyle::GetSeparatorCornerRadius() const {
- return GetSeparatorSize().width() / 2;
+ if (features::IsThorium2024()) {
+ return 0;
+ } else {
+ return GetSeparatorSize().width() / 2;
+ }
}
int ChromeRefresh2023TabStyle::GetDragHandleExtension(int height) const {
- return 6;
+ if (features::IsThorium2024()) {
+ return (height - GetSeparatorSize().height()) / 2 - 1;
+ } else {
+ return 6;
+ }
}
SkColor ChromeRefresh2023TabStyle::GetTabBackgroundColor(
@@ -182,11 +251,19 @@ SkColor ChromeRefresh2023TabStyle::GetTabBackgroundColor(
}
gfx::Insets ChromeRefresh2023TabStyle::GetContentsInsets() const {
- return gfx::Insets::TLBR(
- kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
- GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding,
- kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
- GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding);
+ if (features::IsThorium2024()) {
+ return gfx::Insets::TLBR(
+ kThoriumTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kThoriumTabHorizontalPadding,
+ kThoriumTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kThoriumTabHorizontalPadding);
+ } else {
+ return gfx::Insets::TLBR(
+ kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding,
+ kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding);
+ }
}
float ChromeRefresh2023TabStyle::GetSelectedTabOpacity() const {
diff --git a/chrome/browser/ui/thorium_2024.h b/chrome/browser/ui/thorium_2024.h
new file mode 100644
index 0000000000000..de40b42fcc722
--- /dev/null
+++ b/chrome/browser/ui/thorium_2024.h
@@ -0,0 +1,14 @@
+// Copyright 2024 Alex313031
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_THORIUM_2024_UI_H_
+#define CHROME_BROWSER_UI_THORIUM_2024_UI_H_
+
+#include "base/command_line.h"
+#include "ui/base/ui_base_features.h"
+
+// Blanking out until moving file to //ui/base
+//static const bool thor24 = features::IsThorium2024();
+
+#endif // CHROME_BROWSER_UI_THORIUM_2024_UI_H_
diff --git a/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc b/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc
index 6a91493f7c2bc..fdeb2a4a0916e 100644
--- 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& GetData() {
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.";
+
+ 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
+
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,
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index 9cecb25b41d3b..65fd377e98ae6 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -56,6 +56,7 @@
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_utils.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/tab_group_sync_service_proxy.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"
@@ -339,8 +340,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);
@@ -702,7 +703,7 @@ void BookmarkBarView::Layout(PassKey) {
}
int x = GetLeadingMargin();
- static constexpr int kBookmarkBarTrailingMargin = 8;
+ static const int kBookmarkBarTrailingMargin = features::IsThorium2024() ? 0 : 8;
int width = View::width() - x - kBookmarkBarTrailingMargin;
const int button_height = GetLayoutConstant(BOOKMARK_BAR_BUTTON_HEIGHT);
diff --git a/chrome/browser/ui/views/chrome_layout_provider.cc b/chrome/browser/ui/views/chrome_layout_provider.cc
index 9b189df8d8ffd..7c2ae3a3c94fa 100644
--- a/chrome/browser/ui/views/chrome_layout_provider.cc
+++ b/chrome/browser/ui/views/chrome_layout_provider.cc
@@ -7,6 +7,7 @@
#include
#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"
@@ -157,7 +158,7 @@ int ChromeLayoutProvider::GetDistanceMetric(int metric) const {
case DISTANCE_INFOBAR_HEIGHT:
// Spec says height of button should be 36dp, vertical padding on both
// top and bottom should be 8dp.
- return 36 + 2 * 8;
+ return features::IsThorium2024() ? 42 : 36 + 2 * 8;
case DISTANCE_PERMISSION_PROMPT_HORIZONTAL_ICON_LABEL_PADDING:
return 8;
case DISTANCE_RICH_HOVER_BUTTON_ICON_HORIZONTAL:
diff --git a/chrome/browser/ui/views/frame/browser_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(
+ 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());
@@ -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 frame_view_;
+ raw_ptr tab_search_button_ = nullptr;
const raw_ptr minimize_button_;
const raw_ptr maximize_button_;
const raw_ptr restore_button_;
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 84930758ab743..8b762a0c37582 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
@@ -74,5 +74,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 eabc844883aca..291633d064be4 100644
--- a/chrome/browser/ui/views/frame/browser_frame_view_win.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_view_win.cc
@@ -259,6 +259,10 @@ void BrowserFrameViewWin::WindowControlsOverlayEnabledChanged() {
caption_button_container_->OnWindowControlsOverlayEnabledChanged();
}
+TabSearchBubbleHost* BrowserFrameViewWin::GetTabSearchBubbleHost() {
+ return caption_button_container_->GetTabSearchBubbleHost();
+}
+
void BrowserFrameViewWin::PaintAsActiveChanged() {
BrowserNonClientFrameView::PaintAsActiveChanged();
@@ -321,7 +325,9 @@ int BrowserFrameViewWin::NonClientHitTest(const gfx::Point& point) {
// pixels at the end of the top and bottom edges trigger diagonal resizing.
constexpr int kResizeCornerWidth = 16;
- const int top_border_thickness = GetLayoutConstant(TAB_STRIP_PADDING);
+ const int top_border_thickness = features::IsThorium2024()
+ ? GetLayoutConstant(TAB_INACTIVE_PADDING)
+ : FrameTopBorderThickness(false);
const int window_component = GetHTComponentForFrame(
point, gfx::Insets::TLBR(top_border_thickness, 0, 0, 0),
@@ -501,7 +507,7 @@ int BrowserFrameViewWin::FrameTopBorderThickness(bool restored) const {
// default. When maximized, the OS sizes the window such that the border
// extends beyond the screen edges. In that case, we must return the
// default value.
- const int kTopResizeFrameArea = 0;
+ const int kTopResizeFrameArea = features::IsThorium2024() ? 5 : 0;
return kTopResizeFrameArea;
}
@@ -561,6 +567,22 @@ int BrowserFrameViewWin::TopAreaHeight(bool restored) const {
return top;
}
+ // In maximized mode, we do not add any additional thickness to the grab
+ // handle above the tabs; just return the frame thickness.
+ if (maximized) {
+ return top;
+ }
+
+ // Besides the frame border, there's empty space atop the window in restored
+ // mode, to use to drag the window around.
+ constexpr int kNonClientRestoredExtraThickness = 8;
+ int thickness = kNonClientRestoredExtraThickness;
+ if (EverHasVisibleBackgroundTabShapes() && features::IsThorium2024()) {
+ thickness =
+ std::max(thickness, BrowserNonClientFrameView::kMinimumDragHeight);
+ return top + thickness;
+ }
+
// The tabstrip controls its own top padding.
return top;
}
@@ -810,17 +832,30 @@ void BrowserFrameViewWin::LayoutCaptionButtons() {
const gfx::Size preferred_size =
caption_button_container_->GetPreferredSize();
+ int height = preferred_size.height();
+ // We use the standard caption bar height when maximized in tablet mode, which
+ // is smaller than our preferred button size.
+ if (IsWebUITabStrip() && IsMaximized()) {
+ height = std::min(height, TitlebarMaximizedVisualHeight());
+ }
+ if (!browser_view()->GetWebAppFrameToolbarPreferredSize().IsEmpty()) {
+ height = IsMaximized() ? TitlebarMaximizedVisualHeight()
+ : TitlebarHeight(false) - WindowTopY();
+ }
const int system_caption_buttons_width =
ShouldBrowserCustomDrawTitlebar(browser_view())
? 0
: width() - frame()->GetMinimizeButtonOffset();
+ height = features::IsThorium2024() ? std::min(GetFrameHeight(), height)
+ : GetFrameHeight();
+
caption_button_container_->SetBounds(
CaptionButtonsOnLeadingEdge()
? system_caption_buttons_width
: width() - system_caption_buttons_width - preferred_size.width(),
- WindowTopY(), preferred_size.width(), GetFrameHeight());
+ WindowTopY(), preferred_size.width(), height);
}
void BrowserFrameViewWin::LayoutClientView() {
diff --git a/chrome/browser/ui/views/frame/browser_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 3f1568d7a1c94..6483d1cbc5162 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::RestoredMirroredFrameBorderInsets()
const {
NOTREACHED();
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 2238e76440194..df37021bf766f 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.
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 63cc8cddfe04e..a0c81619fb666 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
@@ -283,7 +283,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();
@@ -349,6 +353,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 73458b42a53e7..1a602a719da5a 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:
@@ -236,6 +237,8 @@ class BrowserNonClientFrameViewChromeOS
raw_ptr caption_button_container_ =
nullptr;
+ raw_ptr tab_search_bubble_host_ = nullptr;
+
// For popups, the window icon.
raw_ptr window_icon_ = nullptr;
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 2caa04674d405..85c6d434c537b 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 kCaptionButtonsLeadingPadding = 20;
@@ -224,7 +226,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() {
@@ -485,6 +526,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 c3241e411d46d..2119bfe02bc32 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1239,6 +1239,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();
diff --git a/chrome/browser/ui/views/frame/browser_view_layout.cc b/chrome/browser/ui/views/frame/browser_view_layout.cc
index cb14b46b727ca..c6523a0985809 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout.cc
+++ b/chrome/browser/ui/views/frame/browser_view_layout.cc
@@ -606,7 +606,7 @@ int BrowserViewLayout::LayoutTabStripRegion(int top) {
// anything to the left of it, like the incognito avatar.
gfx::Rect tab_strip_region_bounds(
delegate_->GetBoundsForTabStripRegionInBrowserView());
- if (is_compact_mode_) {
+ if (is_compact_mode_ && !features::IsThorium2024()) {
constexpr int retain_some_padding = 2;
int height = GetLayoutConstant(TAB_STRIP_HEIGHT) -
GetLayoutConstant(TAB_STRIP_PADDING) + retain_some_padding;
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 4c5356d8f20f6..ccbe7a8ead81e 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -257,7 +257,9 @@ void OpaqueBrowserFrameView::LayoutWebAppWindowTitle(
}
int OpaqueBrowserFrameView::GetTopInset(bool restored) const {
- return layout_->NonClientTopHeight(restored);
+ return browser_view()->ShouldDrawTabStrip() && features::IsThorium2024()
+ ? 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 5c82d24686e9f..2e7d5d0bbf04e 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
@@ -78,7 +78,7 @@ gfx::Rect OpaqueBrowserFrameViewLayout::GetBoundsForTabStripRegion(
int total_width) const {
const int x = available_space_leading_x_;
const int available_width = available_space_trailing_x_ - x;
- return gfx::Rect(x, NonClientTopHeight(false), std::max(0, available_width),
+ return gfx::Rect(x, GetTabStripInsetsTop(false), std::max(0, available_width),
tabstrip_minimum_size.height());
}
@@ -181,6 +181,15 @@ int OpaqueBrowserFrameViewLayout::NonClientTopHeight(bool restored) const {
kContentEdgeShadowThickness;
}
+int OpaqueBrowserFrameViewLayout::GetTabStripInsetsTop(bool restored) const {
+ const int top = NonClientTopHeight(restored);
+ const bool start_at_top_of_frame = !restored &&
+ delegate_->IsFrameCondensed() &&
+ features::IsThorium2024();
+ return start_at_top_of_frame ? top
+ : (top + GetNonClientRestoredExtraThickness());
+}
+
gfx::Insets OpaqueBrowserFrameViewLayout::FrameEdgeInsets(bool restored) const {
return IsFrameEdgeVisible(restored) ? RestoredFrameEdgeInsets()
: gfx::Insets();
@@ -190,7 +199,12 @@ int OpaqueBrowserFrameViewLayout::DefaultCaptionButtonY(bool restored) const {
// Maximized buttons start at window top, since the window has no border. This
// offset is for the image (the actual clickable bounds extend all the way to
// the top to take Fitts' Law into account).
- return views::NonClientFrameView::kFrameShadowThickness;
+ const bool start_at_top_of_frame = !restored &&
+ delegate_->IsFrameCondensed() &&
+ features::IsThorium2024();
+ return start_at_top_of_frame
+ ? FrameBorderInsets(false).top()
+ : views::NonClientFrameView::kFrameShadowThickness;
}
int OpaqueBrowserFrameViewLayout::CaptionButtonY(views::FrameButton button_id,
@@ -236,6 +250,22 @@ 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.
+ constexpr int kNonClientRestoredExtraThickness = 8;
+ int thickness = kNonClientRestoredExtraThickness;
+ if (delegate_->EverHasVisibleBackgroundTabShapes()) {
+ thickness =
+ std::max(thickness, BrowserNonClientFrameView::kMinimumDragHeight);
+ }
+ return thickness;
+}
+
void OpaqueBrowserFrameViewLayout::SetWindowControlsOverlayEnabled(
bool enabled,
views::View* host) {
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h
index 707226e0e8c70..5e1a2b4dd9921 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h
@@ -89,6 +89,8 @@ class OpaqueBrowserFrameViewLayout : public views::LayoutManager {
// if the window was restored, regardless of its current state.
int NonClientTopHeight(bool restored) const;
+ int GetTabStripInsetsTop(bool restored) const;
+
// Returns the y-coordinate of the caption button when native frame buttons
// are disabled. If |restored| is true, acts as if the window is restored
// regardless of the real mode.
@@ -125,6 +127,9 @@ class OpaqueBrowserFrameViewLayout : public views::LayoutManager {
const gfx::Rect& client_view_bounds() const { return client_view_bounds_; }
+ // Returns the extra thickness of the area above the tabs.
+ int GetNonClientRestoredExtraThickness() const;
+
// Enables or disables WCO and updates child views accordingly.
void SetWindowControlsOverlayEnabled(bool enabled, views::View* host);
diff --git a/chrome/browser/ui/views/frame/tab_strip_region_view.cc b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
index e7660352853f2..e36d7b187168d 100644
--- a/chrome/browser/ui/views/frame/tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/tab_strip_region_view.cc
@@ -19,6 +19,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"
@@ -115,7 +116,8 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr tab_strip)
// Add and configure the TabSearchContainer.
std::unique_ptr 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(
tab_strip_->controller(), browser->tab_strip_model(),
render_tab_search_before_tab_strip_, this,
@@ -192,7 +194,10 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr tab_strip)
tab_strip_->controller(),
base::BindRepeating(&TabStrip::NewTabButtonPressed,
base::Unretained(tab_strip_)),
- vector_icons::kAddIcon);
+ features::IsThorium2024()
+ ? kAddIcon
+ : vector_icons::kAddIcon
+ );
tab_strip_control_button->SetProperty(views::kElementIdentifierKey,
kNewTabButtonElementId);
@@ -205,12 +210,10 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr tab_strip)
// 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_ =
@@ -223,7 +226,9 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr 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));
@@ -231,7 +236,7 @@ TabStripRegionView::TabStripRegionView(std::unique_ptr tab_strip)
tab_search_container_ = AddChildView(std::move(tab_search_container));
tab_search_container_->SetProperty(
views::kMarginsKey,
- gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_STRIP_PADDING)));
+ gfx::Insets::TLBR(0, 0, 0, GetLayoutConstant(TAB_SEARCH_PADDING)));
}
UpdateTabStripMargin();
@@ -369,27 +374,49 @@ void TabStripRegionView::Layout(PassKey) {
// 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
// padding and button height are removed.
int x = tab_strip_container_->bounds().right() -
TabStyle::Get()->GetBottomCornerRadius() +
- GetLayoutConstant(TAB_STRIP_PADDING);
+ Th24XOffset;
if (base::FeatureList::IsEnabled(features::kCompactMode)) {
if (profile_->GetPrefs()->GetBoolean(prefs::kCompactModeEnabled)) {
- x -= GetLayoutConstant(TAB_STRIP_PADDING);
+ x -= Th24XOffset;
}
}
- gfx::Point new_tab_button_new_position = gfx::Point(x, 0);
+ gfx::Point new_tab_button_new_position = gfx::Point(x, GetLayoutConstant(TAB_BUTTON_OFFSET));
- gfx::Rect new_tab_button_new_bounds =
+ const gfx::Rect new_tab_button_new_bounds =
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) {
@@ -519,7 +546,7 @@ void TabStripRegionView::UpdateTabStripMargin() {
new_tab_button_->SetProperty(views::kViewIgnoredByLayoutKey, true);
tab_strip_right_margin = new_tab_button_->GetPreferredSize().width() +
- GetLayoutConstant(TAB_STRIP_PADDING);
+ GetLayoutConstant(TAB_MARGIN);
}
// If the tab search button is before the tab strip, it also overlaps the
@@ -545,8 +572,8 @@ void TabStripRegionView::UpdateTabStripMargin() {
// should have 6 px of padding between it and the tab_search button (not
// including the corner radius).
tab_strip_left_margin = tab_strip_left_margin.value() +
- GetLayoutConstant(TAB_STRIP_PADDING) +
- GetLayoutConstant(TAB_STRIP_PADDING) -
+ GetLayoutConstant(TAB_INACTIVE_PADDING) +
+ GetLayoutConstant(TAB_INACTIVE_PADDING) -
TabStyle::Get()->GetBottomCornerRadius();
}
@@ -564,7 +591,7 @@ void TabStripRegionView::AdjustViewBoundsRect(View* view, int offset) {
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/window_caption_util.cc b/chrome/browser/ui/views/frame/window_caption_util.cc
new file mode 100644
index 0000000000000..04703d70ecf9b
--- /dev/null
+++ b/chrome/browser/ui/views/frame/window_caption_util.cc
@@ -0,0 +1,26 @@
+// Copyright 2024 The Chromium Authors and Alex313031
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/frame/window_caption_util.h"
+
+#include "build/build_config.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/thorium_2024.h"
+
+// static
+bool WindowCaptionUtil::IsWindowsTabSearchCaptionButtonEnabled(
+ const Browser* browser) {
+#if BUILDFLAG(IS_WIN)
+ static const bool remove_tabsearch_button =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("remove-tabsearch-button");
+ static const bool disable_caption_button =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("disable-caption-button");
+ static const bool left_aligned_tab_search_button =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("left-aligned-tab-search-button");
+ return features::IsThorium2024() && browser->is_type_normal() &&
+ !remove_tabsearch_button && !disable_caption_button && !left_aligned_tab_search_button;
+#else
+ return false;
+#endif // BUILDFLAG(IS_WIN)
+}
diff --git a/chrome/browser/ui/views/frame/window_caption_util.h b/chrome/browser/ui/views/frame/window_caption_util.h
new file mode 100644
index 0000000000000..92e166d7ca93c
--- /dev/null
+++ b/chrome/browser/ui/views/frame/window_caption_util.h
@@ -0,0 +1,21 @@
+// Copyright 2024 The Chromium Authors and Alex313031
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_WINDOW_CAPTION_UTIL_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_WINDOW_CAPTION_UTIL_H_
+
+class Browser;
+
+// Static-only class containing values and helper functions for frame classes
+// that need to be accessible outside of /browser/ui/views.
+class WindowCaptionUtil {
+ public:
+ // Returns true if the Windows caption button is enabled.
+ static bool IsWindowsTabSearchCaptionButtonEnabled(const Browser* browser);
+
+ private:
+ WindowCaptionUtil() {}
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_WINDOW_CAPTION_UTIL_H_
diff --git a/chrome/browser/ui/views/frame/windows_caption_button.cc b/chrome/browser/ui/views/frame/windows_caption_button.cc
index d8000f801d188..7f69dd091d42a 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();
@@ -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();
}
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 eca41f6f37b37..cb07f8510f298 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -199,18 +199,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(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);
- 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(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);
+ }
+ 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()) {
@@ -258,10 +263,16 @@ void LocationBarView::Init() {
const gfx::FontList& font_list = typography_provider.GetFont(
CONTEXT_OMNIBOX_PRIMARY, views::style::STYLE_PRIMARY);
- const gfx::FontList& omnibox_chip_font_list = typography_provider.GetFont(
- CONTEXT_OMNIBOX_PRIMARY, views::style::STYLE_BODY_4_EMPHASIS);
- const gfx::FontList& page_action_font_list = typography_provider.GetFont(
- CONTEXT_OMNIBOX_PRIMARY, views::style::STYLE_BODY_3_EMPHASIS);
+ const gfx::FontList& omnibox_chip_font_list =
+ features::IsThorium2024()
+ ? font_list
+ : typography_provider.GetFont(CONTEXT_OMNIBOX_PRIMARY,
+ views::style::STYLE_BODY_4_EMPHASIS);
+ const gfx::FontList& page_action_font_list =
+ features::IsThorium2024()
+ ? font_list
+ : typography_provider.GetFont(CONTEXT_OMNIBOX_PRIMARY,
+ views::style::STYLE_BODY_3_EMPHASIS);
auto location_icon_view =
std::make_unique(omnibox_chip_font_list, this, this);
@@ -400,12 +411,17 @@ void LocationBarView::Init() {
}
}
+ if (browser_) {
+ if (sharing_hub::HasPageAction(profile_, is_popup_mode_)) {
+ params.types_enabled.push_back(PageActionIconType::kSharingHub);
+ }
+ }
if (browser_ && !is_popup_mode_) {
params.types_enabled.push_back(PageActionIconType::kBookmarkStar);
}
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();
@@ -438,8 +454,13 @@ bool LocationBarView::IsInitialized() const {
}
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 LocationBarView::CreateRoundRectBackground(
@@ -703,7 +724,7 @@ void LocationBarView::Layout(PassKey) {
// The padding between the left edges of the location bar and the LHS icon
// (e.g. the page info icon, the google G icon, the selected suggestion icon,
// etc)
- int icon_left = 5;
+ int icon_left = features::IsThorium2024() ? 4 : 5;
// The padding between the LHS icon and the text.
int text_left = 8;
// Indentation to match the suggestion icons & texts.
@@ -738,7 +759,9 @@ void LocationBarView::Layout(PassKey) {
// positioned relative to them (e.g. the "bookmark added" bubble if the user
// hits ctrl-d).
const int vertical_padding =
- GetLayoutConstant(LOCATION_BAR_PAGE_INFO_ICON_VERTICAL_PADDING);
+ features::IsThorium2024()
+ ? 4
+ : GetLayoutConstant(LOCATION_BAR_PAGE_INFO_ICON_VERTICAL_PADDING);
const int trailing_decorations_edge_padding =
GetLayoutConstant(LOCATION_BAR_TRAILING_DECORATION_EDGE_PADDING);
@@ -1135,6 +1158,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();
@@ -1160,6 +1184,18 @@ void LocationBarView::RefreshBackground() {
}
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);
+ }
+ }
+
if (high_contrast) {
// High contrast schemes get a border stroke even on a rounded omnibox.
border_color =
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
index 5530486ee3bb3..352aacdbfe227 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc
@@ -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 {
SetImageLabelSpacing(8);
SetCustomPadding(ChromeLayoutProvider::Get()->GetInsetsMetric(
INSETS_OMNIBOX_PILL_BUTTON));
- SetCornerRadius(GetLayoutConstant(TOOLBAR_CORNER_RADIUS));
+ 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);
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..5a11b008a76bc 100644
--- 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); }
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()) {
+ return gfx::Insets::VH(4, 6);
+ }
+ 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();
diff --git a/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc b/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc
index e65fda1bf0161..4942eeab45861 100644
--- a/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc
+++ b/chrome/browser/ui/views/side_panel/side_panel_resize_area.cc
@@ -12,6 +12,7 @@
#include "ui/accessibility/mojom/ax_node_data.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
+#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/geometry/size.h"
@@ -32,7 +33,7 @@ SidePanelResizeHandle::SidePanelResizeHandle(SidePanel* side_panel)
SetCanProcessEventsWithinSubtree(false);
SetFocusBehavior(FocusBehavior::ALWAYS);
FocusRing::Install(this);
- if (lens::features::IsLensOverlayEnabled()) {
+ if (lens::features::IsLensOverlayEnabled() && !features::IsThorium2024()) {
const int resize_handle_left_margin = 2;
SetProperty(views::kMarginsKey,
gfx::Insets().set_left(resize_handle_left_margin));
diff --git a/chrome/browser/ui/views/tab_search_bubble_host.cc b/chrome/browser/ui/views/tab_search_bubble_host.cc
index fa14797259775..6031b27d539e6 100644
--- a/chrome/browser/ui/views/tab_search_bubble_host.cc
+++ b/chrome/browser/ui/views/tab_search_bubble_host.cc
@@ -202,7 +202,7 @@ bool TabSearchBubbleHost::ShowTabSearchBubble(
// Place the anchor similar to where the button would be in non-fullscreen
// mode.
const gfx::Rect bounds = button_->GetWidget()->GetWorkAreaBoundsInScreen();
- const int offset = GetLayoutConstant(TAB_STRIP_PADDING);
+ const int offset = GetLayoutConstant(TAB_INACTIVE_PADDING);
const int x = tabs::GetTabSearchTrailingTabstrip(profile_)
? bounds.right() - offset
diff --git a/chrome/browser/ui/views/tabs/tab_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
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
--- 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(
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) {
}
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
+ : kCRTabSearchCornerRadius;
+ }
}
int TabSearchButton::GetFlatCornerRadius() const {
diff --git a/chrome/browser/ui/views/tabs/tab_style_views.cc b/chrome/browser/ui/views/tabs/tab_style_views.cc
index 65676013fece9..d45fc4f3e1754 100644
--- 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
#include
+#include "base/command_line.h"
#include "base/i18n/rtl.h"
#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 @@
#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 tab_;
std::unique_ptr 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,
// 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,
}
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;
- const int bottom = top + tab_height;
+ // Keep this in Thorium
+ int bottom = top + tab_height;
// For maximized and full screen windows, extend the tab hit test to the top
// of the tab, encompassing the top padding. This makes it easy to click on
// 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,
}
}
+ #if BUILDFLAG(IS_LINUX)
+ if (features::IsThorium2024()) {
+ constexpr float Th24StrokeOffset = 1.0f;
+ top -= Th24StrokeOffset;
+ //bottom -= Th24StrokeOffset;
+ }
+ #else
+ VLOG(0) << "Th24StrokeOffset on Windows is imperfect";
+ if (features::IsThorium2024()) {
+ constexpr float Th24StrokeOffset = 1.0f;
+ top -= Th24StrokeOffset;
+ //bottom -= Th24StrokeOffset;
+ }
+ #endif
+
// 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 active_tab_fill_id;
if (tab_->GetThemeProvider()->HasCustomImage(IDR_THEME_TOOLBAR)) {
@@ -731,6 +774,11 @@ float TabStyleViewsImpl::GetSeparatorOpacity(bool for_layout,
const Tab* const adjacent_tab =
tab()->controller()->GetAdjacentTab(tab(), leading ? -1 : 1);
+ // The separator should never appear at the end of the tab strip.
+ //if (!adjacent_tab && !leading) {
+ //return 1.0f;
+ //}
+
const Tab* const left_tab = leading ? adjacent_tab : tab();
const Tab* const right_tab = leading ? tab() : adjacent_tab;
const bool adjacent_to_header =
@@ -965,6 +1013,10 @@ void TabStyleViewsImpl::PaintTabBackgroundFill(
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(GetCurrentTabBackgroundColor(selection_state, hovered));
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("transparent-tabs") &&
+ selection_state != TabStyle::TabSelectionState::kActive) {
+ flags.setAlphaf(0.7f);
+ }
canvas->DrawRect(gfx::ScaleToEnclosingRect(tab_->GetLocalBounds(), scale),
flags);
}
diff --git a/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/BUILD.gn b/chrome/browser/ui/views/toolbar/BUILD.gn
index e368f860ec9a7..b81b109035cdd 100644
--- a/chrome/browser/ui/views/toolbar/BUILD.gn
+++ b/chrome/browser/ui/views/toolbar/BUILD.gn
@@ -39,6 +39,8 @@ source_set("toolbar") {
"pinned_toolbar_button_status_indicator.h",
"reload_button.cc",
"reload_button.h",
+ "restore_tab_button.cc",
+ "restore_tab_button.h",
"toolbar_action_hover_card_bubble_view.cc",
"toolbar_action_hover_card_bubble_view.h",
"toolbar_action_hover_card_controller.cc",
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_bubble_view.cc b/chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_bubble_view.cc
index b071682471a32..94123478b7fab 100644
--- a/chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_bubble_view.cc
+++ b/chrome/browser/ui/views/toolbar/chrome_labs/chrome_labs_bubble_view.cc
@@ -112,7 +112,7 @@ ChromeLabsBubbleView::ChromeLabsBubbleView(views::Button* anchor_view,
SetLayoutManager(std::make_unique())
->SetOrientation(views::BoxLayout::Orientation::kVertical);
set_fixed_width(views::LayoutProvider::Get()->GetDistanceMetric(
- views::DISTANCE_BUBBLE_PREFERRED_WIDTH));
+ views::DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH));
set_margins(gfx::Insets(0));
SetEnableArrowKeyTraversal(true);
// Set `kDialog` to avoid the BubbleDialogDelegate returning a default of
@@ -124,7 +124,7 @@ ChromeLabsBubbleView::ChromeLabsBubbleView(views::Button* anchor_view,
// TODO(crbug.com/40797818): Currently basing this off what extension menu
// uses for sizing as suggested as an initial fix by UI. Discuss a more formal
// solution.
- constexpr int kMaxChromeLabsHeightDp = 448;
+ constexpr int kMaxChromeLabsHeightDp = 540;
auto scroll_view = std::make_unique(
views::ScrollView::ScrollWithLayers::kEnabled);
// TODO(elainechien): Check with UI whether we want to draw overflow
diff --git a/chrome/browser/ui/views/toolbar/restore_tab_button.cc b/chrome/browser/ui/views/toolbar/restore_tab_button.cc
new file mode 100644
index 0000000000000..d80d7b69ce583
--- /dev/null
+++ b/chrome/browser/ui/views/toolbar/restore_tab_button.cc
@@ -0,0 +1,70 @@
+// Copyright 2024 The Chromium Authors and Alex313031
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/toolbar/restore_tab_button.h"
+
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/strings/string_number_conversions.h"
+#include "chrome/app/chrome_command_ids.h"
+#include "chrome/browser/command_updater.h"
+#include "chrome/browser/external_protocol/external_protocol_handler.h"
+#include "chrome/browser/ui/browser.h"
+#include "components/vector_icons/vector_icons.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/views/accessibility/view_accessibility.h"
+#include "ui/views/controls/button/button_controller.h"
+
+RestoreTabButton::RestoreTabButton(CommandUpdater* command_updater)
+ : ToolbarButton(base::BindRepeating(&RestoreTabButton::ButtonPressed,
+ base::Unretained(this))),
+ command_updater_(command_updater) {
+
+ SetIcon();
+
+ constexpr char16_t RestoreTabAccessName[] = u"Restore Tab Button";
+ GetViewAccessibility().SetName(RestoreTabAccessName);
+ constexpr char16_t RestoreTabAccessToolTipName[] = u"Restore Tab";
+ SetTooltipText(RestoreTabAccessToolTipName);
+ button_controller()->set_notify_action(
+ views::ButtonController::NotifyAction::kOnPress);
+}
+
+RestoreTabButton::~RestoreTabButton() = default;
+
+void RestoreTabButton::ButtonPressed() {
+ ExternalProtocolHandler::PermitLaunchUrl();
+
+ int command;
+ // See chrome/app/chrome_command_ids.h for all possible commands
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch("button-command")) {
+ const std::string button_command =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("button-command");
+ command = base::StringToInt(button_command, &command);
+ LOG(ERROR) << command;
+ } else {
+ command = IDC_RESTORE_TAB;
+ }
+ const int command_to_exec = command;
+
+ ExecuteBrowserCommand(command_to_exec);
+}
+
+void RestoreTabButton::SetIcon() {
+ const gfx::VectorIcon& restore_icon =
+ vector_icons::kRestoreTabIcon;
+ SetVectorIcons(restore_icon, restore_icon);
+}
+
+void RestoreTabButton::ExecuteBrowserCommand(int command) {
+ if (!command_updater_) {
+ return;
+ }
+ command_updater_->ExecuteCommand(command);
+}
+
+BEGIN_METADATA(RestoreTabButton)
+END_METADATA
diff --git a/chrome/browser/ui/views/toolbar/restore_tab_button.h b/chrome/browser/ui/views/toolbar/restore_tab_button.h
new file mode 100644
index 0000000000000..43b9476bb127c
--- /dev/null
+++ b/chrome/browser/ui/views/toolbar/restore_tab_button.h
@@ -0,0 +1,31 @@
+// Copyright 2024 The Chromium Authors and Alex313031
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_RESTORE_TAB_BUTTON_H_
+#define CHROME_BROWSER_UI_VIEWS_TOOLBAR_RESTORE_TAB_BUTTON_H_
+
+#include "base/memory/raw_ptr.h"
+#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
+#include "ui/base/metadata/metadata_header_macros.h"
+
+class CommandUpdater;
+
+class RestoreTabButton : public ToolbarButton {
+ METADATA_HEADER(RestoreTabButton, ToolbarButton)
+
+ public:
+ explicit RestoreTabButton(CommandUpdater* command_updater);
+ RestoreTabButton(const RestoreTabButton&) = delete;
+ RestoreTabButton& operator=(const RestoreTabButton&) = delete;
+ ~RestoreTabButton() override;
+
+ private:
+ void SetIcon();
+ void ButtonPressed();
+ void ExecuteBrowserCommand(int command);
+
+ raw_ptr command_updater_;
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_RESTORE_TAB_BUTTON_H_
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc
index 577215577d9ac..3d63a1a714ef3 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -81,6 +81,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"
@@ -358,8 +359,12 @@ void ToolbarView::Init() {
std::unique_ptr home = std::make_unique(
base::BindRepeating(callback, browser_, IDC_HOME), prefs);
+ std::unique_ptr restore =
+ std::make_unique(browser_->command_controller());
+
std::unique_ptr extensions_container;
std::unique_ptr toolbar_divider;
+ std::unique_ptr toolbar_divider2;
// Do not create the extensions or browser actions container if it is a guest
// profile (only regular and incognito profiles host extensions).
@@ -369,6 +374,9 @@ void ToolbarView::Init() {
toolbar_divider = std::make_unique();
}
+ if (features::EnableRestoreTabButton()) {
+ toolbar_divider2 = std::make_unique();
+ }
std::unique_ptr cast;
if (media_router::MediaRouterEnabled(browser_->profile()))
cast = media_router::CastToolbarButton::Create(browser_);
@@ -393,6 +401,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) {
@@ -494,6 +511,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)
@@ -1004,6 +1033,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;
@@ -1076,15 +1111,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 1688062ae52ab..55dba3d1d4d45 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;
@@ -162,6 +163,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 {
@@ -298,11 +300,13 @@ class ToolbarView : public views::AccessiblePaneView,
raw_ptr back_ = nullptr;
raw_ptr forward_ = nullptr;
raw_ptr reload_ = nullptr;
+ raw_ptr restore_ = nullptr;
raw_ptr home_ = nullptr;
raw_ptr custom_tab_bar_ = nullptr;
raw_ptr location_bar_ = nullptr;
raw_ptr extensions_container_ = nullptr;
raw_ptr toolbar_divider_ = nullptr;
+ raw_ptr toolbar_divider2_ = nullptr;
raw_ptr chrome_labs_button_ = nullptr;
raw_ptr battery_saver_button_ = nullptr;
raw_ptr performance_intervention_button_ =
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 743fd86a35a10..e7679d12e2c8d 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -49,6 +49,7 @@
#include "chrome/browser/ui/webui/policy/policy_ui.h"
#include "chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_internals_ui.h"
#include "chrome/browser/ui/webui/suggest_internals/suggest_internals_ui.h"
+#include "chrome/browser/ui/webui/thorium_webui.h"
#include "chrome/browser/ui/webui/webui_util.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/chrome_features.h"
@@ -695,6 +696,10 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI;
}
+ if (url.host_piece() == chrome::kChromeUIEggsHost) {
+ return &NewWebUI;
+ }
+
return nullptr;
}
diff --git a/chrome/browser/ui/webui/thorium_webui.h b/chrome/browser/ui/webui/thorium_webui.h
new file mode 100644
index 0000000000000..897bacb966ca8
--- /dev/null
+++ b/chrome/browser/ui/webui/thorium_webui.h
@@ -0,0 +1,78 @@
+// 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"(
+
+
+ Thorium Easter Eggs
+
+
+
+
+
+
+ Thorium Easter Eggs WebUI Page
+
+
+
+
+
+
+
+
+
+
+
+
+ )";
+ std::move(callback).Run(base::MakeRefCounted(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());
+ }
+ ThoriumWebUILoad(const ThoriumWebUILoad&) = delete;
+ ThoriumWebUILoad& operator=(const ThoriumWebUILoad&) = delete;
+};
+
+#endif // THORIUM_WEBUI_H_
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;
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 ChromeURLHosts() {
static constexpr auto kChromeURLHosts = std::to_array({
+ kChromeUIEggsHost,
kChromeUIAboutHost,
kChromeUIAccessibilityHost,
#if !BUILDFLAG(IS_ANDROID)
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h
index d1a8dc8342177..a407f00138376 100644
--- a/chrome/common/webui_url_constants.h
+++ b/chrome/common/webui_url_constants.h
@@ -32,6 +32,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";
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 @@
+
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 9e5567aec56dc..0e3978ff8da39 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -3538,7 +3538,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
}
}
-#if BUILDFLAG(IS_WIN) && !defined(OFFICIAL_BUILD)
+#if BUILDFLAG(IS_WIN) && !defined(OFFICIAL_BUILD) || BUILDFLAG(THORIUM_DEBUG)
// Needed because we can't show the dialog from the sandbox. Don't pass
// --no-sandbox in official builds because that would bypass the bad_flgs
// prompt.
diff --git a/ui/base/ui_base_features.cc b/ui/base/ui_base_features.cc
index 595af68372edc..16dcfea0bc7d3 100644
--- a/ui/base/ui_base_features.cc
+++ b/ui/base/ui_base_features.cc
@@ -498,6 +498,30 @@ bool IsLacrosColorManagementEnabled() {
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);
+}
+
+bool IsVerbose() {
+ static const bool is_verbose =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("verbose");
+ return is_verbose;
+}
+
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 a5c3bb6349099..3944f157575c8 100644
--- a/ui/base/ui_base_features.h
+++ b/ui/base/ui_base_features.h
@@ -224,6 +224,15 @@ COMPONENT_EXPORT(UI_BASE_FEATURES) BASE_DECLARE_FEATURE(kLacrosColorManagement);
COMPONENT_EXPORT(UI_BASE_FEATURES)
bool IsLacrosColorManagementEnabled();
+// Used to revert some stupid UI decisions for Cr23
+COMPONENT_EXPORT(UI_BASE_FEATURES) BASE_DECLARE_FEATURE(kThorium2024);
+COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsThorium2024();
+
+COMPONENT_EXPORT(UI_BASE_FEATURES) BASE_DECLARE_FEATURE(kRestoreTabButton);
+COMPONENT_EXPORT(UI_BASE_FEATURES) bool EnableRestoreTabButton();
+
+COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsVerbose();
+
COMPONENT_EXPORT(UI_BASE_FEATURES)
BASE_DECLARE_FEATURE(kBubbleMetricsApi);
diff --git a/ui/linux/linux_ui_factory.cc b/ui/linux/linux_ui_factory.cc
index d21456ab73faa..de14c868fcc26 100644
--- a/ui/linux/linux_ui_factory.cc
+++ b/ui/linux/linux_ui_factory.cc
@@ -175,7 +175,7 @@ SystemTheme GetDefaultSystemTheme() {
case base::nix::DESKTOP_ENVIRONMENT_PANTHEON:
case base::nix::DESKTOP_ENVIRONMENT_UNITY:
case base::nix::DESKTOP_ENVIRONMENT_XFCE:
- return SystemTheme::kGtk;
+ return SystemTheme::kDefault;
case base::nix::DESKTOP_ENVIRONMENT_KDE3:
case base::nix::DESKTOP_ENVIRONMENT_KDE4:
case base::nix::DESKTOP_ENVIRONMENT_KDE5:
@@ -183,7 +183,7 @@ SystemTheme GetDefaultSystemTheme() {
case base::nix::DESKTOP_ENVIRONMENT_UKUI:
case base::nix::DESKTOP_ENVIRONMENT_DEEPIN:
case base::nix::DESKTOP_ENVIRONMENT_LXQT:
- return SystemTheme::kQt;
+ return SystemTheme::kDefault;
case base::nix::DESKTOP_ENVIRONMENT_OTHER:
return SystemTheme::kDefault;
}
diff --git a/ui/views/controls/menu/menu_config.cc b/ui/views/controls/menu/menu_config.cc
index cc2b21432f010..21cf9ba102902 100644
--- a/ui/views/controls/menu/menu_config.cc
+++ b/ui/views/controls/menu/menu_config.cc
@@ -6,6 +6,7 @@
#include "base/debug/dump_without_crashing.h"
#include "base/no_destructor.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "ui/base/ui_base_features.h"
#include "ui/views/controls/menu/menu_controller.h"
#include "ui/views/controls/menu/menu_item_view.h"
@@ -73,12 +74,12 @@ void MenuConfig::InitCommon() {
reserve_dedicated_arrow_column = false;
menu_horizontal_border_size = 0;
submenu_horizontal_overlap = 0;
- item_vertical_margin = 6;
+ item_vertical_margin = features::IsThorium2024() ? 4 : 6;
item_horizontal_border_padding = 12;
arrow_size = 16;
- separator_height = 17;
- separator_spacing_height = 4;
- use_outer_border = false;
+ separator_height = features::IsThorium2024() ? 11 : 17;
+ separator_spacing_height = features::IsThorium2024() ? 3 : 4;
+ use_outer_border = features::IsThorium2024() ? true : false;
}
// static
diff --git a/ui/views/controls/menu/menu_config.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(
diff --git a/ui/views/controls/menu/menu_config_linux.cc b/ui/views/controls/menu/menu_config_linux.cc
index 09c03d1e87011..31fda3a23bbf5 100644
--- a/ui/views/controls/menu/menu_config_linux.cc
+++ b/ui/views/controls/menu/menu_config_linux.cc
@@ -4,12 +4,16 @@
#include "ui/views/controls/menu/menu_config.h"
+#include "chrome/browser/ui/thorium_2024.h"
+#include "ui/base/ui_base_features.h"
#include "ui/ozone/public/ozone_platform.h"
namespace views {
void MenuConfig::InitPlatform() {
- use_bubble_border = true;
+ use_bubble_border = features::IsThorium2024() ? false : corner_radius > 0;
+ arrow_to_edge_padding = features::IsThorium2024() ? 2 : 8;
+ separator_height = features::IsThorium2024() ? 7 : 17;
}
} // namespace views
diff --git a/ui/views/controls/menu/menu_config_mac.mm b/ui/views/controls/menu/menu_config_mac.mm
index eabfb364890d3..c17ad57190ef1 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
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#import
+
+#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
--- a/ui/views/controls/menu/menu_config_win.cc
+++ b/ui/views/controls/menu/menu_config_win.cc
@@ -8,6 +8,8 @@
#include
+#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() {
(SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &show_cues, 0) &&
show_cues == TRUE);
- SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &show_delay, 0);
- separator_upper_height = 5;
- separator_lower_height = 7;
+ //SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &show_delay, 0);
+ static const bool is_win11 = base::win::GetVersion() >= base::win::Version::WIN11;
+ use_outer_border = features::IsThorium2024() ? true : false;
+
+ if (features::IsThorium2024()) {
+ if (is_win11) {
+ corner_radius = 4;
+ arrow_to_edge_padding = 4;
+ menu_horizontal_border_size = 4;
+ submenu_horizontal_overlap = 1;
+ rounded_menu_vertical_border_size = 4;
+ item_horizontal_padding = 1;
+ between_item_vertical_padding = 2;
+ separator_height = 1;
+ separator_upper_height = 1;
+ separator_lower_height = 1;
+ item_corner_radius = 4;
+ use_outer_border = true;
+ } else {
+ corner_radius = 0;
+ arrow_to_edge_padding = 2;
+ 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;
+ use_outer_border = true;
+ }
+ } else {
+ separator_upper_height = 5;
+ separator_lower_height = 7;
+ }
use_bubble_border = corner_radius > 0;
}
diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc
index b73bd71742381..0fb6d132bd762 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()) {
// 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;
+ }
GetViewAccessibility().SetRole(ax::mojom::Role::kTree);
GetViewAccessibility().SetIsVertical(true);
@@ -1201,21 +1223,43 @@ void TreeView::PaintNodeIcon(gfx::Canvas* canvas,
const gfx::Rect& bounds) {
std::optional 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 cfee7309a95c6..74108649ba65a 100644
--- a/ui/views/controls/tree/tree_view.h
+++ b/ui/views/controls/tree/tree_view.h
@@ -465,6 +465,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 icons_;
diff --git a/ui/views/layout/layout_provider.cc b/ui/views/layout/layout_provider.cc
index 2e4623d72bf80..f79efe3597b97 100644
--- a/ui/views/layout/layout_provider.cc
+++ b/ui/views/layout/layout_provider.cc
@@ -8,6 +8,7 @@
#include "base/containers/fixed_flat_map.h"
#include "base/logging.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/font_list.h"
#include "ui/views/controls/focus_ring.h"
@@ -214,6 +215,48 @@ ShapeSysTokens GetShapeSysToken(ShapeContextTokens id) {
int LayoutProvider::GetCornerRadiusMetric(ShapeContextTokens id,
const gfx::Size& size) const {
+
+ static const bool classic_omnibox = base::CommandLine::ForCurrentProcess()->HasSwitch("classic-omnibox");
+ if (features::IsThorium2024()) {
+ switch (id) {
+ case ShapeContextTokens::kBadgeRadius:
+ return 4;
+ case ShapeContextTokens::kButtonRadius:
+ return 4;
+ case ShapeContextTokens::kComboboxRadius:
+ return 4;
+ case ShapeContextTokens::kDialogRadius:
+ return 4;
+ case ShapeContextTokens::kFindBarViewRadius:
+ return 4;
+ case ShapeContextTokens::kMenuRadius:
+ case ShapeContextTokens::kMenuAuxRadius:
+ return 0;
+ case ShapeContextTokens::kMenuTouchRadius:
+ return 8;
+ case ShapeContextTokens::kOmniboxExpandedRadius: {
+ if (classic_omnibox) {
+ return 4;
+ } else {
+ return 16;
+ }
+ }
+ case ShapeContextTokens::kTextfieldRadius: {
+ if (classic_omnibox) {
+ return 4;
+ } else {
+ return 8;
+ }
+ }
+ case ShapeContextTokens::kSidePanelContentRadius:
+ return 16;
+ case ShapeContextTokens::kSidePanelPageContentRadius:
+ return 8;
+ default:
+ return 0;
+ }
+ }
+
ShapeSysTokens token = GetShapeSysToken(id);
DCHECK_NE(token, ShapeSysTokens::kDefault)
<< "kDefault token means there is a missing mapping between shape tokens";
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(show_delay)
- : kDefaultMenuShowDelay;
- }();
+ static int delay = kDefaultMenuShowDelay;
return delay;
#else
return 0;
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 81d33bf3c3f99..d427358823b24 100644
--- 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(
--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);
- --cr-toggle-bar-width: 26px;
- --cr-toggle-knob-diameter: 8px;
+ --cr-toggle-ripple-diameter: 34px;
+ --cr-toggle-knob-diameter: 16px;
-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) {
@@ -52,112 +48,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;
- height: 16px;
+ border-radius: 8px;
+ height: 12px;
left: 3px;
- opacity: 1;
- position: initial;
+ position: absolute;
top: 2px;
transition: background-color linear 80ms;
- width: var(--cr-toggle-bar-width);
+ 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 80ms, background-color linear 80ms;
+ 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 {
@@ -166,25 +111,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);
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;