From 090f5925beb872c0b13beb8321d1e0ea9d69fd85 Mon Sep 17 00:00:00 2001 From: Alexander Frick Date: Sat, 14 Dec 2024 22:44:12 -0600 Subject: [PATCH] .164 minor uprev and pre-final preparation fixes --- .gitignore | 1 + arm/build/config/compiler/BUILD.gn | 17 +- infra/THORIUM_DEV_BOOKMARKS.html | 408 +++--- infra/portable/THORIUM_SHELL.BAT | 2 +- other/thorium-2024-ui.patch | 2 +- setup.sh | 1 - src/build/config/compiler/BUILD.gn | 11 +- src/build/config/compiler/pgo/BUILD.gn | 190 --- src/build/config/compiler_opt.gni | 8 + src/build/config/win/BUILD.gn | 3 + src/chrome/browser/thorium_flag_entries.h | 6 +- src/chrome/browser/ui/views/tabs/tab.cc | 1251 ----------------- src/chrome/browser/ui/views/tabs/tab.h | 303 ---- .../views/toolbar/browser_app_menu_button.cc | 5 +- src/chrome/installer/mini_installer/BUILD.gn | 43 +- src/components/neterror/resources/offline.js | 22 +- upstream_version.sh | 2 +- version.sh | 2 +- 18 files changed, 302 insertions(+), 1975 deletions(-) delete mode 100644 src/build/config/compiler/pgo/BUILD.gn delete mode 100644 src/chrome/browser/ui/views/tabs/tab.cc delete mode 100644 src/chrome/browser/ui/views/tabs/tab.h diff --git a/.gitignore b/.gitignore index 19fab3b1..3eb00c48 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ API_KEYS.txt *.zip *.apk /release/ +/test/ mini_installer.exe thorium_mini_installer.exe thorium_SSE2_mini_installer.exe diff --git a/arm/build/config/compiler/BUILD.gn b/arm/build/config/compiler/BUILD.gn index 950f5e48..730fd0aa 100644 --- a/arm/build/config/compiler/BUILD.gn +++ b/arm/build/config/compiler/BUILD.gn @@ -554,7 +554,11 @@ config("compiler") { # TODO(crbug.com/345541122): investigate the fuchsia binary size increase. if (is_win) { - cflags += [ "/Zc:sizedDealloc" ] + if (is_debug) { + cflags += [ "/Zc:sizedDealloc-" ] + } else { + cflags += [ "/Zc:sizedDealloc" ] + } } else { cflags += [ "-fsized-deallocation" ] } @@ -846,7 +850,7 @@ config("compiler") { # TODO(crbug.com/40182783): investigate why this isn't effective on # arm32. if (!is_android || current_cpu == "arm64") { - cflags += [ "-fwhole-program-vtables" ] + cflags += [ "-fwhole-program-vtables", "-fstrict-vtable-pointers", ] if (toolchain_supports_rust_thin_lto) { # whole-program-vtables implies -fsplit-lto-unit, and Rust needs to match @@ -862,7 +866,7 @@ config("compiler") { } if (!is_win) { - ldflags += [ "-fwhole-program-vtables" ] + ldflags += [ "-fwhole-program-vtables", "-fstrict-vtable-pointers", ] } } @@ -1174,7 +1178,7 @@ config("libcxx_hardening") { # building with ThinLTO, no optimization is performed in the link step. config("thinlto_optimize_default") { if (!is_debug && use_thin_lto && is_a_target_toolchain) { - lto_opt_level = 3 + lto_opt_level = 2 if (is_win) { ldflags = [ "/opt:lldlto=" + lto_opt_level ] @@ -1209,9 +1213,10 @@ config("thinlto_optimize_default") { config("thinlto_optimize_max") { if (!is_debug && use_thin_lto && is_a_target_toolchain) { if (thin_lto_enable_optimizations) { - lto_opt_level = 3 + lto_opt_level = 2 } else { - lto_opt_level = 3 + # Alex313031 TODO: Set back to 3 when LLVM bug is fixed + lto_opt_level = 2 } if (is_win) { diff --git a/infra/THORIUM_DEV_BOOKMARKS.html b/infra/THORIUM_DEV_BOOKMARKS.html index b20bbe15..27105c01 100644 --- a/infra/THORIUM_DEV_BOOKMARKS.html +++ b/infra/THORIUM_DEV_BOOKMARKS.html @@ -13,234 +13,234 @@
Thorium Flags

THOR1

-

BUILD.gn - Chromium Code Search -
PGO BUILD.gn - Chromium Code Search -
BUILD.gn - Chromium Code Search -
BUILD.gn - Chromium Code Search -
arm.gni - Chromium Code Search -
chromium_strings.grd - Chromium Code Search -
settings_chromium_strings.grdp - Chromium Code Search -
settings_strings.grdp - Chromium Code Search -
shared_settings_strings.grdp - Chromium Code Search -
generated_resources.grd - Chromium Code Search -
app_management_strings.grdp - Chromium Code Search -
ffmpeg_options.gni - Chromium Code Search -
stats_reporting_controller.cc - Chromium Code Search -
background_mode_manager.cc - Chromium Code Search -
privacy_sandbox_settings_impl.cc - Chromium Code Search -
tracking_protection_prefs.cc - Chromium Code Search -
floc_id_provider_factory.cc - Chromium Code Search -
profile_network_context_service.cc - Chromium Code Search -
stub_resolver_config_reader.cc - Chromium Code Search -
browser_ui_prefs.cc - Chromium Code Search -
google_api_keys_infobar_delegate.cc - Chromium Code Search -
infobar_utils.cc - Chromium Code Search -
default_browser_prompt.cc - Chromium Code Search -
bad_flags_prompt.cc - Chromium Code Search -
installer/linux - Chromium Code Search -
BUILD.gn - Chromium Code Search -
chrome.release - Chromium Code Search -
mini_installer_constants.cc - Chromium Code Search -
mini_installer_exe_main.cc - Chromium Code Search -
mini_installer_exe_version.rc.version - Chromium Code Search -
util_constants.cc - Chromium Code Search -
download_features.cc - Chromium Code Search -
prepopulated_engines.json - Chromium Code Search -
search_engine_countries-inc.cc - Chromium Code Search +
BUILD.gn - Chromium Code Search +
PGO BUILD.gn - Chromium Code Search +
BUILD.gn - Chromium Code Search +
BUILD.gn - Chromium Code Search +
arm.gni - Chromium Code Search +
chromium_strings.grd - Chromium Code Search +
settings_chromium_strings.grdp - Chromium Code Search +
settings_strings.grdp - Chromium Code Search +
shared_settings_strings.grdp - Chromium Code Search +
generated_resources.grd - Chromium Code Search +
app_management_strings.grdp - Chromium Code Search +
ffmpeg_options.gni - Chromium Code Search +
stats_reporting_controller.cc - Chromium Code Search +
background_mode_manager.cc - Chromium Code Search +
privacy_sandbox_settings_impl.cc - Chromium Code Search +
tracking_protection_prefs.cc - Chromium Code Search +
floc_id_provider_factory.cc - Chromium Code Search +
profile_network_context_service.cc - Chromium Code Search +
stub_resolver_config_reader.cc - Chromium Code Search +
browser_ui_prefs.cc - Chromium Code Search +
google_api_keys_infobar_delegate.cc - Chromium Code Search +
infobar_utils.cc - Chromium Code Search +
default_browser_prompt.cc - Chromium Code Search +
bad_flags_prompt.cc - Chromium Code Search +
installer/linux - Chromium Code Search +
BUILD.gn - Chromium Code Search +
chrome.release - Chromium Code Search +
mini_installer_constants.cc - Chromium Code Search +
mini_installer_exe_main.cc - Chromium Code Search +
mini_installer_exe_version.rc.version - Chromium Code Search +
util_constants.cc - Chromium Code Search +
download_features.cc - Chromium Code Search +
prepopulated_engines.json - Chromium Code Search +
search_engine_countries-inc.cc - Chromium Code Search

THOR2

-

BUILD.gn - Chromium Code Search -
theme - Chromium Code Search -
theme_resources.grd - Chromium Code Search -
BUILD.gn - Chromium Code Search -
media_switches.cc - Chromium Code Search -
ffmpeg_glue.cc - Chromium Code Search -
ffmpeg_video_decoder.cc - Chromium Code Search -
ffmpeg_common.cc - Chromium Code Search -
vaapi_wrapper.cc - Chromium Code Search -
vaapi_wrapper.h - Chromium Code Search -
load_flags_list.h - Chromium Code Search -
dns_client.cc - Chromium Code Search -
dns_transaction.cc - Chromium Code Search -
url_request_http_job.cc - Chromium Code Search -
bpf_audio_policy_linux.cc - Chromium Code Search -
x11_util.cc - Chromium Code Search -
widevine_cdm_version.h - Chromium Code Search -
BUILD.gn - Chromium Code Search -
widevine.gni - Chromium Code Search -
cdm_registration.cc - Chromium Code Search -
components.css - Chromium Code Search -
incognito_marker.svg - Chromium Code Search -
icons - Chromium Code Search -
icon_tabs.svg - Chromium Code Search -
vector_icons - Chromium Code Search -
vector_icons - Chromium Code Search -
vector_icons - Chromium Code Search -
new_incognito_window.icon - Chromium Code Search +
BUILD.gn - Chromium Code Search +
theme - Chromium Code Search +
theme_resources.grd - Chromium Code Search +
BUILD.gn - Chromium Code Search +
media_switches.cc - Chromium Code Search +
ffmpeg_glue.cc - Chromium Code Search +
ffmpeg_video_decoder.cc - Chromium Code Search +
ffmpeg_common.cc - Chromium Code Search +
vaapi_wrapper.cc - Chromium Code Search +
vaapi_wrapper.h - Chromium Code Search +
load_flags_list.h - Chromium Code Search +
dns_client.cc - Chromium Code Search +
dns_transaction.cc - Chromium Code Search +
url_request_http_job.cc - Chromium Code Search +
bpf_audio_policy_linux.cc - Chromium Code Search +
x11_util.cc - Chromium Code Search +
widevine_cdm_version.h - Chromium Code Search +
BUILD.gn - Chromium Code Search +
widevine.gni - Chromium Code Search +
cdm_registration.cc - Chromium Code Search +
components.css - Chromium Code Search +
incognito_marker.svg - Chromium Code Search +
icons - Chromium Code Search +
icon_tabs.svg - Chromium Code Search +
vector_icons - Chromium Code Search +
vector_icons - Chromium Code Search +
vector_icons - Chromium Code Search +
new_incognito_window.icon - Chromium Code Search

THOR3

-

BUILD.gn - Chromium Code Search -
distilledpage.css - Chromium Code Search -
dom_distiller_features.cc - Chromium Code Search -
reload_button.cc - Chromium Code Search -
reload_button.h - Chromium Code Search -
features.cc - Chromium Code Search -
profile_shortcut_manager_win.cc - Chromium Code Search -
ui_chromeos_strings.grd - Chromium Code Search -
autofill_payments_strings.grdp - Chromium Code Search -
autofill_strings.grdp - Chromium Code Search -
components_chromium_strings.grd - Chromium Code Search -
components_settings_strings.grdp - Chromium Code Search -
error_page_strings.grdp - Chromium Code Search -
flags_strings.grdp - Chromium Code Search -
heavy_ad_intervention_strings.grdp - Chromium Code Search -
management_strings.grdp - Chromium Code Search -
new_or_sad_tab_strings.grdp - Chromium Code Search -
page_info_strings.grdp - Chromium Code Search -
reset_password_strings.grdp - Chromium Code Search -
security_interstitials_strings.grdp - Chromium Code Search -
ssl_errors_strings.grdp - Chromium Code Search -
ssl_errors_strings.grdp - Chromium Code Search -
chromium_install_modes.cc - Chromium Code Search -
user_data_dir_win_unittest.cc - Chromium Code Search -
chrome_paths_linux.cc - Chromium Code Search -
chrome_paths_mac.mm - Chromium Code Search -
ui_util.cc - Chromium Code Search -
ui_features.cc - Chromium Code Search -
features.cc - Chromium Code Search -
x509_util.cc - Chromium Code Search +
BUILD.gn - Chromium Code Search +
distilledpage.css - Chromium Code Search +
dom_distiller_features.cc - Chromium Code Search +
reload_button.cc - Chromium Code Search +
reload_button.h - Chromium Code Search +
features.cc - Chromium Code Search +
profile_shortcut_manager_win.cc - Chromium Code Search +
ui_chromeos_strings.grd - Chromium Code Search +
autofill_payments_strings.grdp - Chromium Code Search +
autofill_strings.grdp - Chromium Code Search +
components_chromium_strings.grd - Chromium Code Search +
components_settings_strings.grdp - Chromium Code Search +
error_page_strings.grdp - Chromium Code Search +
flags_strings.grdp - Chromium Code Search +
heavy_ad_intervention_strings.grdp - Chromium Code Search +
management_strings.grdp - Chromium Code Search +
new_or_sad_tab_strings.grdp - Chromium Code Search +
page_info_strings.grdp - Chromium Code Search +
reset_password_strings.grdp - Chromium Code Search +
security_interstitials_strings.grdp - Chromium Code Search +
ssl_errors_strings.grdp - Chromium Code Search +
ssl_errors_strings.grdp - Chromium Code Search +
chromium_install_modes.cc - Chromium Code Search +
user_data_dir_win_unittest.cc - Chromium Code Search +
chrome_paths_linux.cc - Chromium Code Search +
chrome_paths_mac.mm - Chromium Code Search +
ui_util.cc - Chromium Code Search +
ui_features.cc - Chromium Code Search +
features.cc - Chromium Code Search +
x509_util.cc - Chromium Code Search

THOR4

-

BUILD.gn - Chromium Code Search -
BUILD.gn - Chromium Code Search -
memory_details_linux.cc - Chromium Code Search -
chrome_proxy_main_win.cc - Chromium Code Search -
chrome_exe.ver - Chromium Code Search -
chrome_exe.vsprops - Chromium Code Search -
BUILD.gn - Chromium Code Search -
BUILD.gn - Chromium Code Search -
shell_main_delegate.cc - Chromium Code Search -
channel_info_posix.cc - Chromium Code Search -
shell_integration_linux.cc - Chromium Code Search -
launch_as_mojo_client_browsertest.cc - Chromium Code Search -
reorder-imports.py - Chromium Code Search -
vs_toolchain.py - Chromium Code Search -
install-build-deps.py - Chromium Code Search -
scheme_constants.cc - Chromium Code Search -
about_ui.cc - Chromium Code Search -
neterror - Chromium Code Search -
resources - Chromium Code Search -
flags_state.cc - Chromium Code Search -
shell_platform_delegate_views.cc - Chromium Code Search -
BUILD.gn - Chromium Code Search -
quiet_notification_permission_ui_state.cc - Chromium Code Search +
BUILD.gn - Chromium Code Search +
BUILD.gn - Chromium Code Search +
memory_details_linux.cc - Chromium Code Search +
chrome_proxy_main_win.cc - Chromium Code Search +
chrome_exe.ver - Chromium Code Search +
chrome_exe.vsprops - Chromium Code Search +
BUILD.gn - Chromium Code Search +
BUILD.gn - Chromium Code Search +
shell_main_delegate.cc - Chromium Code Search +
channel_info_posix.cc - Chromium Code Search +
shell_integration_linux.cc - Chromium Code Search +
launch_as_mojo_client_browsertest.cc - Chromium Code Search +
reorder-imports.py - Chromium Code Search +
vs_toolchain.py - Chromium Code Search +
install-build-deps.py - Chromium Code Search +
scheme_constants.cc - Chromium Code Search +
about_ui.cc - Chromium Code Search +
neterror - Chromium Code Search +
resources - Chromium Code Search +
flags_state.cc - Chromium Code Search +
shell_platform_delegate_views.cc - Chromium Code Search +
BUILD.gn - Chromium Code Search +
quiet_notification_permission_ui_state.cc - Chromium Code Search

THOR5

-

install_worker.cc - Chromium Code Search -
setup_util.cc - Chromium Code Search -
chrome_content_browser_client.cc - Chromium Code Search -
omnibox_view.cc - Chromium Code Search -
about_flags.cc - Chromium Code Search -
browser_commands.cc - Chromium Code Search -
offline_page_model.cc - Chromium Code Search -
url_schemes.cc - Chromium Code Search -
url_utils.cc - Chromium Code Search -
BUILD.gn - Chromium Code Search -
examples_window.cc - Chromium Code Search -
BUILD.gn - Chromium Code Search -
build.py - Chromium Code Search -
configure.ac - Chromium Code Search -
build_ffmpeg.py - Chromium Code Search -
bookmark_utils.cc - Chromium Code Search +
install_worker.cc - Chromium Code Search +
setup_util.cc - Chromium Code Search +
chrome_content_browser_client.cc - Chromium Code Search +
omnibox_view.cc - Chromium Code Search +
about_flags.cc - Chromium Code Search +
browser_commands.cc - Chromium Code Search +
offline_page_model.cc - Chromium Code Search +
url_schemes.cc - Chromium Code Search +
url_utils.cc - Chromium Code Search +
BUILD.gn - Chromium Code Search +
examples_window.cc - Chromium Code Search +
BUILD.gn - Chromium Code Search +
build.py - Chromium Code Search +
configure.ac - Chromium Code Search +
build_ffmpeg.py - Chromium Code Search +
bookmark_utils.cc - Chromium Code Search
BUILD.gn - Chromium Code Search -
runtime_enabled_features.json5 - Chromium Code Search -
audio_context.cc - Chromium Code Search -
images - Chromium Code Search -
chromeos_strings.grd - Chromium Code Search +
runtime_enabled_features.json5 - Chromium Code Search +
audio_context.cc - Chromium Code Search +
images - Chromium Code Search +
chromeos_strings.grd - Chromium Code Search

QUARANTINE_PATCH

-

base_file.cc - Chromium Code Search -
BUILD.gn - Chromium Code Search -
toolbar_view.cc - Chromium Code Search -
pepper_file_io_host.cc - Chromium Code Search -
pepper_file_io_host.h - Chromium Code Search -
file_system_access_safe_move_helper.cc - Chromium Code Search -
file_system_access_safe_move_helper.h - Chromium Code Search -
chrome_location_bar_model_delegate.cc - Chromium Code Search -
app_menu_model.cc - Chromium Code Search -
os_crypt_win.cc - Chromium Code Search -
os_crypt_linux.cc - Chromium Code Search -
dpapi_key_provider.cc - Chromium Code Search -
machine_id_provider_nonwin.cc - Chromium Code Search -
machine_id_provider_win.cc - Chromium Code Search -
device_id_win.cc - Chromium Code Search -
tracked_split_preference.cc - Chromium Code Search -
accelerator_table.cc - Chromium Code Search -
browser.cc - Chromium Code Search -
browser.h - Chromium Code Search +
base_file.cc - Chromium Code Search +
BUILD.gn - Chromium Code Search +
toolbar_view.cc - Chromium Code Search +
pepper_file_io_host.cc - Chromium Code Search +
pepper_file_io_host.h - Chromium Code Search +
file_system_access_safe_move_helper.cc - Chromium Code Search +
file_system_access_safe_move_helper.h - Chromium Code Search +
chrome_location_bar_model_delegate.cc - Chromium Code Search +
app_menu_model.cc - Chromium Code Search +
os_crypt_win.cc - Chromium Code Search +
os_crypt_linux.cc - Chromium Code Search +
dpapi_key_provider.cc - Chromium Code Search +
machine_id_provider_nonwin.cc - Chromium Code Search +
machine_id_provider_win.cc - Chromium Code Search +
device_id_win.cc - Chromium Code Search +
tracked_split_preference.cc - Chromium Code Search +
accelerator_table.cc - Chromium Code Search +
browser.cc - Chromium Code Search +
browser.h - Chromium Code Search

Android

-

java - Chromium Code Search -
BUILD.gn - Chromium Code Search -
chrome_public_apk_tmpl.gni - Chromium Code Search -
android_chrome_strings.grd - Chromium Code Search -
native_theme_gtk.cc - Chromium Code Search -
about_version.html - Chromium Code Search -
supported_types.cc - Chromium Code Search -
variations_service.cc - Chromium Code Search -
BUILD.gn - Chromium Code Search -
media_options.gni - Chromium Code Search -
ignores.txt - Chromium Code Search +
java - Chromium Code Search +
BUILD.gn - Chromium Code Search +
chrome_public_apk_tmpl.gni - Chromium Code Search +
android_chrome_strings.grd - Chromium Code Search +
native_theme_gtk.cc - Chromium Code Search +
about_version.html - Chromium Code Search +
supported_types.cc - Chromium Code Search +
variations_service.cc - Chromium Code Search +
BUILD.gn - Chromium Code Search +
media_options.gni - Chromium Code Search +
ignores.txt - Chromium Code Search

Th24

-

tab.cc - Chromium Code Search -
tab.h - Chromium Code Search -
tab_strip.cc - Chromium Code Search -
tab_style_views.cc - Chromium Code Search -
tab_style_views.h - Chromium Code Search -
tab_strip_model.cc - Chromium Code Search -
tab_strip_model.h - Chromium Code Search -
history_backend.cc - Chromium Code Search -
browser_root_view.h - Chromium Code Search -
browser_root_view.cc - Chromium Code Search -
new_tab_page_feed_v2_expandable_header.xml - Chromium Code Search -
new_tab_page_multi_feed_header.xml - Chromium Code Search -
pref_names.cc - Chromium Code Search -
theme_helper_win.cc - Chromium Code Search -
obsolete_system_linux.cc - Chromium Code Search -
insecure_download_blocking.cc - Chromium Code Search -
download_target_determiner.cc - Chromium Code Search -
feature_promo_controller.cc - Chromium Code Search -
gpu_pre_sandbox_hook_linux.cc - Chromium Code Search -
download_bubble_prefs.cc - Chromium Code Search -
accelerators.cc - Chromium Code Search -
whats_new_util.cc - Chromium Code Search -
chrome_download_manager_delegate.cc - Chromium Code Search -
libaom - Chromium Code Search -
libvpx - Chromium Code Search -
xnnpack - Chromium Code Search -
extension_prefs.cc - Chromium Code Search -
extension.cc - Chromium Code Search -
tab_strip_prefs.cc - Chromium Code Search +
tab.cc - Chromium Code Search +
tab.h - Chromium Code Search +
tab_strip.cc - Chromium Code Search +
tab_style_views.cc - Chromium Code Search +
tab_style_views.h - Chromium Code Search +
tab_strip_model.cc - Chromium Code Search +
tab_strip_model.h - Chromium Code Search +
history_backend.cc - Chromium Code Search +
browser_root_view.h - Chromium Code Search +
browser_root_view.cc - Chromium Code Search +
new_tab_page_feed_v2_expandable_header.xml - Chromium Code Search +
new_tab_page_multi_feed_header.xml - Chromium Code Search +
pref_names.cc - Chromium Code Search +
theme_helper_win.cc - Chromium Code Search +
obsolete_system_linux.cc - Chromium Code Search +
insecure_download_blocking.cc - Chromium Code Search +
download_target_determiner.cc - Chromium Code Search +
feature_promo_controller.cc - Chromium Code Search +
gpu_pre_sandbox_hook_linux.cc - Chromium Code Search +
download_bubble_prefs.cc - Chromium Code Search +
accelerators.cc - Chromium Code Search +
whats_new_util.cc - Chromium Code Search +
chrome_download_manager_delegate.cc - Chromium Code Search +
libaom - Chromium Code Search +
libvpx - Chromium Code Search +
xnnpack - Chromium Code Search +
extension_prefs.cc - Chromium Code Search +
extension.cc - Chromium Code Search +
tab_strip_prefs.cc - Chromium Code Search

VectorIcons

-

BUILD.gn - Chromium Code Search -
BUILD.gn - Chromium Code Search -
browser_app_menu_button.cc - Chromium Code Search -
chrome_labs_button.cc - Chromium Code Search -
home_button.cc - Chromium Code Search -
side_panel_toolbar_button.cc - Chromium Code Search -
ui_base_features.cc - Chromium Code Search -
ui_base_features.h - Chromium Code Search -
extension_management_internal.h - Chromium Code Search -
allowlist.cc - Chromium Code Search +
BUILD.gn - Chromium Code Search +
BUILD.gn - Chromium Code Search +
browser_app_menu_button.cc - Chromium Code Search +
chrome_labs_button.cc - Chromium Code Search +
home_button.cc - Chromium Code Search +
side_panel_toolbar_button.cc - Chromium Code Search +
ui_base_features.cc - Chromium Code Search +
ui_base_features.h - Chromium Code Search +
extension_management_internal.h - Chromium Code Search +
allowlist.cc - Chromium Code Search

Chromium Code Search diff --git a/infra/portable/THORIUM_SHELL.BAT b/infra/portable/THORIUM_SHELL.BAT index 7aafe416..bf752e97 100644 --- a/infra/portable/THORIUM_SHELL.BAT +++ b/infra/portable/THORIUM_SHELL.BAT @@ -1 +1 @@ -START "" "%cd%\BIN\130.0.6723.158\thorium_shell.exe" --user-data-dir="%~dp0%\USER_DATA\thorium_shell" --allow-outdated-plugins --disable-logging --disable-breakpad --enable-experimental-web-platform-features --disable-encryption --disable-machine-id +START "" "%cd%\BIN\130.0.6723.164\thorium_shell.exe" --user-data-dir="%~dp0%\USER_DATA\thorium_shell" --allow-outdated-plugins --disable-logging --disable-breakpad --enable-experimental-web-platform-features --disable-encryption --disable-machine-id diff --git a/other/thorium-2024-ui.patch b/other/thorium-2024-ui.patch index 8b495bd2..90bf6930 100644 --- a/other/thorium-2024-ui.patch +++ b/other/thorium-2024-ui.patch @@ -3901,7 +3901,7 @@ index 81bd9ac032b1f..da73d1d14d456 100644 std::max(control_elements_container_->GetPreferredSize({}).width() - - kComboboxArrowPaddingWidth, + (features::IsThorium2024() -+ ? kComboboxArrowPaddingWidth ++ ? 8 + : kComboboxArrowPaddingWidth), 0))); } diff --git a/setup.sh b/setup.sh index 0a305725..aa2ebb26 100755 --- a/setup.sh +++ b/setup.sh @@ -1,5 +1,4 @@ #!/bin/bash -#!/bin/bash # Copyright (c) 2024 Alex313031. diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn index 17ce19c0..730fd0aa 100644 --- a/src/build/config/compiler/BUILD.gn +++ b/src/build/config/compiler/BUILD.gn @@ -850,7 +850,7 @@ config("compiler") { # TODO(crbug.com/40182783): investigate why this isn't effective on # arm32. if (!is_android || current_cpu == "arm64") { - cflags += [ "-fwhole-program-vtables" ] + cflags += [ "-fwhole-program-vtables", "-fstrict-vtable-pointers", ] if (toolchain_supports_rust_thin_lto) { # whole-program-vtables implies -fsplit-lto-unit, and Rust needs to match @@ -866,7 +866,7 @@ config("compiler") { } if (!is_win) { - ldflags += [ "-fwhole-program-vtables" ] + ldflags += [ "-fwhole-program-vtables", "-fstrict-vtable-pointers", ] } } @@ -1178,7 +1178,7 @@ config("libcxx_hardening") { # building with ThinLTO, no optimization is performed in the link step. config("thinlto_optimize_default") { if (!is_debug && use_thin_lto && is_a_target_toolchain) { - lto_opt_level = 3 + lto_opt_level = 2 if (is_win) { ldflags = [ "/opt:lldlto=" + lto_opt_level ] @@ -1213,9 +1213,10 @@ config("thinlto_optimize_default") { config("thinlto_optimize_max") { if (!is_debug && use_thin_lto && is_a_target_toolchain) { if (thin_lto_enable_optimizations) { - lto_opt_level = 3 + lto_opt_level = 2 } else { - lto_opt_level = 3 + # Alex313031 TODO: Set back to 3 when LLVM bug is fixed + lto_opt_level = 2 } if (is_win) { diff --git a/src/build/config/compiler/pgo/BUILD.gn b/src/build/config/compiler/pgo/BUILD.gn deleted file mode 100644 index 792f5eb2..00000000 --- a/src/build/config/compiler/pgo/BUILD.gn +++ /dev/null @@ -1,190 +0,0 @@ -# Copyright 2024 The Chromium Authors, RobRich999, and Alex313031 -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//build/config/chromeos/ui_mode.gni") -import("//build/config/clang/clang.gni") -import("//build/config/compiler_opt.gni") -import("//build/config/compiler/compiler.gni") -import("//build/config/compiler/pgo/pgo.gni") -import("//build/config/features.gni") -import("//build/toolchain/toolchain.gni") - -# Configuration that enables PGO instrumentation. -config("pgo_instrumentation_flags") { - visibility = [ ":default_pgo_flags" ] - - # Only add flags when chrome_pgo_phase == 1, so that variables we would use - # are not required to be defined when we're not actually using PGO. - if (chrome_pgo_phase == 1 && is_clang && !is_nacl && is_a_target_toolchain) { - cflags = [ "-fprofile-generate" ] - if (temporal_pgo_profile) { - cflags += [ - "-mllvm", - "-pgo-temporal-instrumentation", - ] - } - if (!is_win) { - # Windows directly calls link.exe instead of the compiler driver when - # linking, and embeds the path to the profile runtime library as - # dependent library into each object file. - ldflags = [ "-fprofile-generate" ] - } - } -} - -# Configuration that enables optimization using profile data. -config("pgo_optimization_flags") { - visibility = [ ":default_pgo_flags" ] - - # Only add flags when chrome_pgo_phase == 2, so that variables we would use - # are not required to be defined when we're not actually using PGO. - if (chrome_pgo_phase == 2 && is_clang && !is_nacl && is_a_target_toolchain) { - _pgo_target = "" - - # There are txt files used by //tools/update_pgo_profiles.py to decide which - # profiles to use, adding them as inputs so that analyzer recognizes the - # dependencies. - inputs = [] - - if (is_win) { - if (target_cpu == "arm64") { - _pgo_target = "win-arm64" - } else if (target_cpu == "x64") { - _pgo_target = "win64" - } else { - _pgo_target = "win32" - } - } else if (is_mac) { - if (target_cpu == "arm64") { - _pgo_target = "mac-arm" - } else { - _pgo_target = "mac" - } - } else if (is_linux) { - _pgo_target = "linux" - } else if (is_chromeos_lacros) { - if (target_cpu == "arm") { - # We don't have the arm device to train arm pgo data. So Lacros arm - # would use arm64 profile. - _pgo_target = "lacros-arm64" - } else if (target_cpu == "arm64") { - _pgo_target = "lacros-arm64" - } else { - _pgo_target = "lacros64" - } - } else if (is_android) { - # Use |current_cpu| and not |target_cpu|; for Android we may built both. - if (current_cpu == "arm64") { - _pgo_target = "android-arm64" - } else { - _pgo_target = "android-arm32" - } - } else if (is_fuchsia) { - if (target_cpu == "arm64") { - _pgo_target = "mac-arm" - } else { - _pgo_target = "mac" - } - } else if (is_ios && use_blink) { - if (target_cpu == "arm64") { - _pgo_target = "mac-arm" - } else { - _pgo_target = "mac" - } - } - - if (_pgo_target == "win-arm64") { - inputs = [ "//chrome/build/win-arm64.pgo.txt" ] - } else if (_pgo_target == "win64") { - inputs = [ "//chrome/build/win64.pgo.txt" ] - } else if (_pgo_target == "win32") { - inputs = [ "//chrome/build/win32.pgo.txt" ] - } else if (_pgo_target == "mac-arm") { - inputs = [ "//chrome/build/mac-arm.pgo.txt" ] - } else if (_pgo_target == "mac") { - inputs = [ "//chrome/build/mac.pgo.txt" ] - } else if (_pgo_target == "linux") { - inputs = [ "//chrome/build/linux.pgo.txt" ] - } else if (_pgo_target == "lacros64") { - inputs = [ "//chrome/build/lacros64.pgo.txt" ] - } else if (_pgo_target == "lacros-arm") { - inputs = [ "//chrome/build/lacros-arm.pgo.txt" ] - } else if (_pgo_target == "lacros-arm64") { - inputs = [ "//chrome/build/lacros-arm64.pgo.txt" ] - } else if (_pgo_target == "android-arm32") { - inputs = [ "//chrome/build/android-arm32.pgo.txt" ] - } else if (_pgo_target == "android-arm64") { - inputs = [ "//chrome/build/android-arm64.pgo.txt" ] - } - - if (_pgo_target != "" && pgo_data_path == "") { - pgo_data_path = exec_script("//tools/update_pgo_profiles.py", - [ - "--target", - _pgo_target, - "get_profile_path", - ], - "value") - } - assert(pgo_data_path != "", - "Please set pgo_data_path to point at the profile data") - cflags = [ - "-fprofile-use=" + rebase_path(pgo_data_path, root_build_dir), - - # It's possible to have some profile data legitimately missing, - # and at least some profile data always ends up being considered - # out of date, so make sure we don't error for those cases. - "-Wno-profile-instr-unprofiled", - "-Wno-profile-instr-out-of-date", - - # Some hashing conflict results in a lot of warning like this when doing - # a PGO build: - # warning: foo.cc: Function control flow change detected (hash mismatch) - # [-Wbackend-plugin] - # See https://crbug.com/978401 - "-Wno-backend-plugin", - ] - - # Enable basic block layout based on the extended TSP problem. This aims to - # improve icache utilization and reduce the binary size. - if (use_thin_lto) { - if (current_cpu == "x64" || current_cpu == "x86") { - if (is_win) { - ldflags = [ "-mllvm:-enable-ext-tsp-block-placement=1" ] - } else if (is_linux) { - ldflags = [ - "-Wl,-mllvm,-enable-ext-tsp-block-placement=1", - "-Wl,-mllvm,-enable-split-machine-functions" - ] - } else { - ldflags = [ "-Wl,-mllvm,-enable-ext-tsp-block-placement=1" ] - } - } else { - if (is_win) { - ldflags = [ "-mllvm:-enable-ext-tsp-block-placement=1" ] - } else { - ldflags = [ "-Wl,-mllvm,-enable-ext-tsp-block-placement=1" ] - } - } - } else { - cflags += [ - "-mllvm", - "-enable-ext-tsp-block-placement=1", - ] - } - } -} - -# Applies flags necessary when profile-guided optimization is used. -# Flags are only added if PGO is enabled, so that this config is safe to -# include by default. -config("default_pgo_flags") { - if (chrome_pgo_phase == 0) { - # Nothing. This config should be a no-op when chrome_pgo_phase == 0. - } else if (chrome_pgo_phase == 1) { - configs = [ ":pgo_instrumentation_flags" ] - } else if (chrome_pgo_phase == 2) { - configs = [ ":pgo_optimization_flags" ] - } -} diff --git a/src/build/config/compiler_opt.gni b/src/build/config/compiler_opt.gni index 80208b2d..b51e400a 100644 --- a/src/build/config/compiler_opt.gni +++ b/src/build/config/compiler_opt.gni @@ -27,6 +27,14 @@ declare_args() { # would want to turn on use_sse3, use_sse41, use_sse42 too. For AVX2 # you would add use_avx, etc. + # SSE2 + # Normal x64 compiler baseline, present since Willamette (Original + # 2001 Pentium 4) and AMD SledgeHammer (1st Gen. Opteron) and + # the Athlon 64. Big step from MMX, x87, and SSE (i.e. SSE1) + # Baseline requirement to run Windows since update KB4103718 + # for Windows 7 SP1/Server 2008 R2 SP1/Home Server 2011. + use_sse2 = current_cpu == "x86" + # SSE3 # Normal Chromium baseline, present since Prescott (2004 Pentium 4) # and AMD SanDiego (2nd Gen. Opteron). diff --git a/src/build/config/win/BUILD.gn b/src/build/config/win/BUILD.gn index 2c8bca8c..d913f105 100644 --- a/src/build/config/win/BUILD.gn +++ b/src/build/config/win/BUILD.gn @@ -157,6 +157,7 @@ config("compiler") { cflags += [ "-msse4.2", "/clang:-msse4.2", + # "/arch:SSE4.2", ] } if (use_avx) { @@ -167,6 +168,7 @@ config("compiler") { "/clang:-mpclmul", "/clang:-maes", "/clang:-mavx", + # "/arch:AVX", ] } if (use_avx2) { @@ -182,6 +184,7 @@ config("compiler") { "/clang:-mlzcnt", "/clang:-mbmi2", "/clang:-ffp-contract=fast", + # "/arch:AVX2", # "/fp:fast", ] } diff --git a/src/chrome/browser/thorium_flag_entries.h b/src/chrome/browser/thorium_flag_entries.h index 60624808..5399ef42 100644 --- a/src/chrome/browser/thorium_flag_entries.h +++ b/src/chrome/browser/thorium_flag_entries.h @@ -141,10 +141,10 @@ kOsAll, SINGLE_VALUE_TYPE("allow-insecure-downloads")}, #if !BUILDFLAG(IS_ANDROID) - {"disable-download-bubble", - "Disable Download Bubble", + {"download-shelf", + "Restore Download Shelf", "When enabled, the traditional download shelf is used instead of the download bubble in the toolbar. Thorium flag", - kOsDesktop, SINGLE_VALUE_TYPE("disable-download-bubble")}, + kOsDesktop, FEATURE_VALUE_TYPE(features::kDownloadShelf)}, #endif // BUILDFLAG(IS_ANDROID) {"show-avatar-button", diff --git a/src/chrome/browser/ui/views/tabs/tab.cc b/src/chrome/browser/ui/views/tabs/tab.cc deleted file mode 100644 index 3103949f..00000000 --- a/src/chrome/browser/ui/views/tabs/tab.cc +++ /dev/null @@ -1,1251 +0,0 @@ -// Copyright 2024 The Chromium Authors, Alex313031, and gz83 -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(crbug.com/40285824): Remove this and convert code to safer constructs. -#pragma allow_unsafe_buffers -#endif - -#include "chrome/browser/ui/views/tabs/tab.h" - -#include - -#include -#include -#include -#include - -#include "base/command_line.h" -#include "base/debug/alias.h" -#include "base/functional/bind.h" -#include "base/i18n/rtl.h" -#include "base/memory/raw_ptr.h" -#include "base/metrics/user_metrics.h" -#include "base/numerics/safe_conversions.h" -#include "base/scoped_observation.h" -#include "base/strings/utf_string_conversions.h" -#include "base/time/time.h" -#include "build/build_config.h" -#include "cc/paint/paint_flags.h" -#include "cc/paint/paint_recorder.h" -#include "cc/paint/paint_shader.h" -#include "chrome/browser/themes/theme_properties.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_element_identifiers.h" -#include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/browser/ui/layout_constants.h" -#include "chrome/browser/ui/tab_contents/core_tab_helper.h" -#include "chrome/browser/ui/tabs/tab_style.h" -#include "chrome/browser/ui/tabs/tab_utils.h" -#include "chrome/browser/ui/ui_features.h" -#include "chrome/browser/ui/view_ids.h" -#include "chrome/browser/ui/views/chrome_layout_provider.h" -#include "chrome/browser/ui/views/frame/browser_view.h" -#include "chrome/browser/ui/views/tabs/alert_indicator_button.h" -#include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" -#include "chrome/browser/ui/views/tabs/tab_close_button.h" -#include "chrome/browser/ui/views/tabs/tab_drag_controller.h" -#include "chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.h" -#include "chrome/browser/ui/views/tabs/tab_icon.h" -#include "chrome/browser/ui/views/tabs/tab_slot_controller.h" -#include "chrome/browser/ui/views/tabs/tab_slot_view.h" -#include "chrome/browser/ui/views/tabs/tab_strip.h" -#include "chrome/browser/ui/views/tabs/tab_strip_layout.h" -#include "chrome/browser/ui/views/tabs/tab_style_views.h" -#include "chrome/common/chrome_features.h" -#include "chrome/grit/generated_resources.h" -#include "chrome/grit/theme_resources.h" -#include "components/grit/components_scaled_resources.h" -#include "components/tab_groups/tab_group_color.h" -#include "components/tab_groups/tab_group_visual_data.h" -#include "third_party/skia/include/core/SkPath.h" -#include "third_party/skia/include/effects/SkGradientShader.h" -#include "third_party/skia/include/pathops/SkPathOps.h" -#include "ui/accessibility/ax_enums.mojom.h" -#include "ui/accessibility/ax_node_data.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/metadata/metadata_impl_macros.h" -#include "ui/base/models/list_selection_model.h" -#include "ui/base/pointer/touch_ui_controller.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/theme_provider.h" -#include "ui/base/ui_base_features.h" -#include "ui/compositor/clip_recorder.h" -#include "ui/compositor/compositor.h" -#include "ui/gfx/animation/tween.h" -#include "ui/gfx/canvas.h" -#include "ui/gfx/color_palette.h" -#include "ui/gfx/favicon_size.h" -#include "ui/gfx/geometry/rect_conversions.h" -#include "ui/gfx/geometry/skia_conversions.h" -#include "ui/gfx/paint_vector_icon.h" -#include "ui/gfx/scoped_canvas.h" -#include "ui/resources/grit/ui_resources.h" -#include "ui/views/accessibility/view_accessibility.h" -#include "ui/views/border.h" -#include "ui/views/controls/button/image_button.h" -#include "ui/views/controls/focus_ring.h" -#include "ui/views/controls/highlight_path_generator.h" -#include "ui/views/controls/label.h" -#include "ui/views/rect_based_targeting_utils.h" -#include "ui/views/view.h" -#include "ui/views/view_class_properties.h" -#include "ui/views/view_targeter.h" -#include "ui/views/widget/tooltip_manager.h" -#include "ui/views/widget/widget.h" -#include "ui/views/window/non_client_view.h" - -#if BUILDFLAG(IS_WIN) -#include "ui/views/win/pen_event_handler_util.h" -#endif - -#if defined(USE_AURA) -#include "ui/aura/env.h" -#endif - -using base::UserMetricsAction; -namespace { - -// When a non-pinned tab becomes a pinned tab the width of the tab animates. If -// the width of a pinned tab is at least kPinnedTabExtraWidthToRenderAsNormal -// larger than the desired pinned tab width then the tab is rendered as a normal -// tab. This is done to avoid having the title immediately disappear when -// transitioning a tab from normal to pinned tab. -constexpr int kPinnedTabExtraWidthToRenderAsNormal = 30; - -// Additional padding of close button to the right of the tab -// indicator when `extra_alert_indicator_padding_` is true. -constexpr int kTabAlertIndicatorCloseButtonPaddingAdjustmentTouchUI = 8; -constexpr int kTabAlertIndicatorCloseButtonPaddingAdjustmentTh24 = 6; -constexpr int kTabAlertIndicatorCloseButtonPaddingAdjustment = 4; -constexpr int kExtraLeftPaddingToBalanceCloseButtonPadding = 2; - -// When the DiscardRingImprovements feature is enabled, increase the radius of -// the discard ring by this amount if there is enough space. -constexpr int kIncreasedDiscardIndicatorRadiusDp = 2; - -bool g_show_hover_card_on_mouse_hover = true; - -// Helper functions ------------------------------------------------------------ - -// Returns the coordinate for an object of size |item_size| centered in a region -// of size |size|, biasing towards placing any extra space ahead of the object. -int Center(int size, int item_size) { - int extra_space = size - item_size; - // Integer division below truncates, thus effectively "rounding toward zero"; - // to always place extra space ahead of the object, we want to round towards - // positive infinity, which means we need to bias the division only when the - // size difference is positive. (Adding one unconditionally will stack with - // the truncation if |extra_space| is negative, resulting in off-by-one - // errors.) - if (extra_space > 0) { - ++extra_space; - } - return extra_space / 2; -} - -class TabStyleHighlightPathGenerator : public views::HighlightPathGenerator { - public: - explicit TabStyleHighlightPathGenerator(TabStyleViews* tab_style_views) - : tab_style_views_(tab_style_views) {} - TabStyleHighlightPathGenerator(const TabStyleHighlightPathGenerator&) = - delete; - TabStyleHighlightPathGenerator& operator=( - const TabStyleHighlightPathGenerator&) = delete; - - // views::HighlightPathGenerator: - SkPath GetHighlightPath(const views::View* view) override { - return tab_style_views_->GetPath(TabStyle::PathType::kHighlight, 1.0); - } - - private: - const raw_ptr tab_style_views_; -}; - -} // namespace - -// Helper class that observes the tab's close button. -class Tab::TabCloseButtonObserver : public views::ViewObserver { - public: - explicit TabCloseButtonObserver(Tab* tab, - views::View* close_button, - TabSlotController* controller) - : tab_(tab), close_button_(close_button), controller_(controller) { - DCHECK(close_button_); - tab_close_button_observation_.Observe(close_button_.get()); - } - TabCloseButtonObserver(const TabCloseButtonObserver&) = delete; - TabCloseButtonObserver& operator=(const TabCloseButtonObserver&) = delete; - - ~TabCloseButtonObserver() override { - DCHECK(tab_close_button_observation_.IsObserving()); - tab_close_button_observation_.Reset(); - } - - private: - void OnViewFocused(views::View* observed_view) override { - controller_->UpdateHoverCard( - tab_, TabSlotController::HoverCardUpdateType::kFocus); - } - - void OnViewBlurred(views::View* observed_view) override { - // Only hide hover card if not keyboard navigating. - if (!controller_->IsFocusInTabs()) { - controller_->UpdateHoverCard( - nullptr, TabSlotController::HoverCardUpdateType::kFocus); - } - } - - base::ScopedObservation - tab_close_button_observation_{this}; - - raw_ptr tab_; - raw_ptr close_button_; - raw_ptr controller_; -}; - -// Tab ------------------------------------------------------------------------- - -// static -void Tab::SetShowHoverCardOnMouseHoverForTesting(bool value) { - g_show_hover_card_on_mouse_hover = value; -} - -Tab::Tab(TabSlotController* controller) - : controller_(controller), - title_(new views::Label()), - title_animation_(this) { - DCHECK(controller); - - tab_style_views_ = TabStyleViews::CreateForTab(this); - - // So we get don't get enter/exit on children and don't prematurely stop the - // hover. - SetNotifyEnterExitOnChild(true); - - SetID(VIEW_ID_TAB); - - // This will cause calls to GetContentsBounds to return only the rectangle - // inside the tab shape, rather than to its extents. - SetBorder(views::CreateEmptyBorder(tab_style_views()->GetContentsInsets())); - - title_->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); - title_->SetElideBehavior(gfx::FADE_TAIL); - title_->SetHandlesTooltips(false); - title_->SetAutoColorReadabilityEnabled(false); - title_->SetText(CoreTabHelper::GetDefaultTitle()); - title_->SetFontList(tab_style_views_->GetFontList()); - title_->SetBackgroundColor(SK_ColorTRANSPARENT); - // |title_| paints on top of an opaque region (the tab background) of a - // non-opaque layer (the tabstrip's layer), which cannot currently be detected - // by the subpixel-rendering opacity check. - // TODO(crbug.com/40725997): Improve the check so that this case doen't - // need a manual suppression by detecting cases where the text is painted onto - // onto opaque parts of a not-entirely-opaque layer. - title_->SetSkipSubpixelRenderingOpacityCheck(true); - - AddChildView(title_.get()); - - SetEventTargeter(std::make_unique(this)); - - icon_ = AddChildView(std::make_unique()); - - alert_indicator_button_ = - AddChildView(std::make_unique(this)); - - // Unretained is safe here because this class outlives its close button, and - // the controller outlives this Tab. - close_button_ = AddChildView(std::make_unique( - base::BindRepeating(&Tab::CloseButtonPressed, base::Unretained(this)), - base::BindRepeating(&TabSlotController::OnMouseEventInTab, - base::Unretained(controller_)))); - close_button_->SetHasInkDropActionOnClick(true); - -#if BUILDFLAG(IS_CHROMEOS_ASH) - showing_close_button_ = !controller_->IsLockedForOnTask(); - close_button_->SetVisible(showing_close_button_); -#endif - - tab_close_button_observer_ = std::make_unique( - this, close_button_, controller_); - - title_animation_.SetDuration(base::Milliseconds(100)); - - // Enable keyboard focus. - SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); - views::FocusRing::Install(this); - views::HighlightPathGenerator::Install( - this, - std::make_unique(tab_style_views())); - - SetProperty(views::kElementIdentifierKey, kTabElementId); - - GetViewAccessibility().SetRole(ax::mojom::Role::kTab); -} - -Tab::~Tab() { - // Observer must be unregistered before child views are destroyed. - tab_close_button_observer_.reset(); - if (controller_->HoverCardIsShowingForTab(this)) { - controller_->UpdateHoverCard( - nullptr, TabSlotController::HoverCardUpdateType::kTabRemoved); - } -} - -void Tab::AnimationEnded(const gfx::Animation* animation) { - DCHECK_EQ(animation, &title_animation_); - title_->SetBoundsRect(target_title_bounds_); -} - -void Tab::AnimationProgressed(const gfx::Animation* animation) { - DCHECK_EQ(animation, &title_animation_); - title_->SetBoundsRect(gfx::Tween::RectValueBetween( - gfx::Tween::CalculateValue(gfx::Tween::FAST_OUT_SLOW_IN, - animation->GetCurrentValue()), - start_title_bounds_, target_title_bounds_)); -} - -bool Tab::GetHitTestMask(SkPath* mask) const { - // When the window is maximized we don't want to shave off the edges or top - // shadow of the tab, such that the user can click anywhere along the top - // edge of the screen to select a tab. Ditto for immersive fullscreen. - *mask = tab_style_views()->GetPath( - TabStyle::PathType::kHitTest, - GetWidget()->GetCompositor()->device_scale_factor(), - /* force_active */ false, TabStyle::RenderUnits::kDips); - return true; -} - -void Tab::Layout(PassKey) { - const gfx::Rect contents_rect = GetContentsBounds(); - - const bool was_showing_icon = showing_icon_; - UpdateIconVisibility(); - - int start = contents_rect.x(); - - if (extra_padding_before_content_ && features::IsThorium2024()) { - start += kExtraLeftPaddingToBalanceCloseButtonPadding; - } - - // The bounds for the favicon will include extra width for the attention - // indicator, but visually it will be smaller at kFaviconSize wide. - gfx::Rect favicon_bounds(start, contents_rect.y(), 0, 0); - if (showing_icon_) { - // Height should go to the bottom of the tab for the crashed tab animation - // to pop out of the bottom in Thorium 2024 UI. - favicon_bounds.set_y(contents_rect.y() + - Center(features::IsThorium2024() - ? contents_rect.height() - : gfx::kFaviconSize, - gfx::kFaviconSize)); - if (center_icon_) { - // When centering the favicon, the favicon is allowed to escape the normal - // contents rect. - favicon_bounds.set_x(Center(width(), gfx::kFaviconSize)); - } else { - MaybeAdjustLeftForPinnedTab(&favicon_bounds, gfx::kFaviconSize); - } - icon_->EnlargeDiscardIndicatorRadius( - controller()->GetInactiveTabWidth() - - 2 * tab_style()->GetBottomCornerRadius() >= - gfx::kFaviconSize + 2 * kIncreasedDiscardIndicatorRadiusDp - ? kIncreasedDiscardIndicatorRadiusDp - : 0); - - // Add space for insets outside the favicon bounds. - favicon_bounds.Inset(-icon_->GetInsets()); - favicon_bounds.set_size(icon_->GetPreferredSize()); - } - icon_->SetBoundsRect(favicon_bounds); - icon_->SetVisible(showing_icon_); - - const int after_title_padding = GetLayoutConstant(TAB_AFTER_TITLE_PADDING); - - int close_x = contents_rect.right(); - if (showing_close_button_) { - // The visible size is the button's hover shape size. The actual size - // includes the border insets for the button. - const int close_button_visible_size = - GetLayoutConstant(TAB_CLOSE_BUTTON_SIZE); - const gfx::Size close_button_actual_size = - close_button_->GetPreferredSize(); - - // The close button is vertically centered in the contents_rect. - const int top = - contents_rect.y() + - Center(contents_rect.height(), close_button_actual_size.height()); - - // The visible part of the close button should be placed against the - // right of the contents rect unless the tab is so small that it would - // overflow the left side of the contents_rect, in that case it will be - // placed in the middle of the tab. - const int visible_left = - std::max(close_x - close_button_visible_size, - Center(width(), close_button_visible_size)); - - // Offset the new bounds rect by the extra padding in the close button. - const int non_visible_left_padding = - (close_button_actual_size.width() - close_button_visible_size) / 2; - - close_button_->SetBoundsRect( - {gfx::Point(visible_left - non_visible_left_padding, top), - close_button_actual_size}); - close_x = visible_left - after_title_padding; - } - close_button_->SetVisible(showing_close_button_); - - if (showing_alert_indicator_) { - int right = contents_rect.right(); - if (showing_close_button_) { - right = close_x; - if (extra_alert_indicator_padding_) { - right -= ui::TouchUiController::Get()->touch_ui() - ? kTabAlertIndicatorCloseButtonPaddingAdjustmentTouchUI - : (features::IsThorium2024() - ? kTabAlertIndicatorCloseButtonPaddingAdjustmentTh24 - : kTabAlertIndicatorCloseButtonPaddingAdjustment); - } - } - const gfx::Size image_size = alert_indicator_button_->GetPreferredSize(); - gfx::Rect bounds( - std::max(contents_rect.x(), right - image_size.width()), - contents_rect.y() + Center(contents_rect.height(), image_size.height()), - image_size.width(), image_size.height()); - if (center_icon_) { - // When centering the alert icon, it is allowed to escape the normal - // contents rect. - bounds.set_x(Center(width(), bounds.width())); - } else { - MaybeAdjustLeftForPinnedTab(&bounds, bounds.width()); - } - alert_indicator_button_->SetBoundsRect(bounds); - } - alert_indicator_button_->SetVisible(showing_alert_indicator_); - - // Size the title to fill the remaining width and use all available height. - bool show_title = ShouldRenderAsNormalTab(); - if (show_title) { - int title_left = start; - if (showing_icon_) { - // When computing the spacing from the favicon, don't count the actual - // icon view width (which will include extra room for the alert - // indicator), but rather the normal favicon width which is what it will - // look like. - const int after_favicon = favicon_bounds.x() + icon_->GetInsets().left() + - gfx::kFaviconSize + - GetLayoutConstant(TAB_PRE_TITLE_PADDING); - title_left = std::max(title_left, after_favicon); - } - int title_right = contents_rect.right(); - if (showing_alert_indicator_) { - title_right = alert_indicator_button_->x() - after_title_padding; - } else if (showing_close_button_) { - // Allow the title to overlay the close button's empty border padding. - title_right = close_x - after_title_padding; - } - const int title_width = std::max(title_right - title_left, 0); - // The Label will automatically center the font's cap height within the - // provided vertical space. - const gfx::Rect title_bounds(title_left, contents_rect.y(), title_width, - contents_rect.height()); - show_title = title_width > 0; - - if (title_bounds != target_title_bounds_) { - target_title_bounds_ = title_bounds; - if (was_showing_icon == showing_icon_ || title_->bounds().IsEmpty() || - title_bounds.IsEmpty()) { - title_animation_.Stop(); - title_->SetBoundsRect(title_bounds); - } else if (!title_animation_.is_animating()) { - start_title_bounds_ = title_->bounds(); - title_animation_.Start(); - } - } - } - title_->SetVisible(show_title); - - if (auto* focus_ring = views::FocusRing::Get(this); focus_ring) { - focus_ring->DeprecatedLayoutImmediately(); - } -} - -bool Tab::OnKeyPressed(const ui::KeyEvent& event) { - if (event.key_code() == ui::VKEY_RETURN && !IsSelected()) { - controller_->SelectTab(this, event); - return true; - } - - constexpr int kModifiedFlag = -#if BUILDFLAG(IS_MAC) - ui::EF_COMMAND_DOWN; -#else - ui::EF_CONTROL_DOWN; -#endif - - if (event.type() == ui::EventType::kKeyPressed && - (event.flags() & kModifiedFlag)) { - const bool is_right = event.key_code() == ui::VKEY_RIGHT; - const bool is_left = event.key_code() == ui::VKEY_LEFT; - if (is_right || is_left) { - const bool is_rtl = base::i18n::IsRTL(); - const bool is_next = (is_right && !is_rtl) || (is_left && is_rtl); - if (event.flags() & ui::EF_SHIFT_DOWN) { - if (is_next) { - controller()->MoveTabLast(this); - } else { - controller()->MoveTabFirst(this); - } - } else if (is_next) { - controller()->ShiftTabNext(this); - } else { - controller()->ShiftTabPrevious(this); - } - return true; - } - } - - return false; -} - -bool Tab::OnKeyReleased(const ui::KeyEvent& event) { - if (event.key_code() == ui::VKEY_SPACE && !IsSelected()) { - controller_->SelectTab(this, event); - return true; - } - return false; -} - -namespace { -bool IsSelectionModifierDown(const ui::MouseEvent& event) { -#if BUILDFLAG(IS_MAC) - return event.IsCommandDown(); -#else - return event.IsControlDown(); -#endif -} -} // namespace - -bool Tab::OnMousePressed(const ui::MouseEvent& event) { - controller_->UpdateHoverCard(nullptr, - TabSlotController::HoverCardUpdateType::kEvent); - controller_->OnMouseEventInTab(this, event); - - // Allow a right click from touch to drag, which corresponds to a long click. - if (event.IsOnlyLeftMouseButton() || - (event.IsOnlyRightMouseButton() && event.flags() & ui::EF_FROM_TOUCH)) { - ui::ListSelectionModel original_selection; - original_selection = controller_->GetSelectionModel(); - // Changing the selection may cause our bounds to change. If that happens - // the location of the event may no longer be valid. Create a copy of the - // event in the parents coordinate, which won't change, and recreate an - // event after changing so the coordinates are correct. - ui::MouseEvent event_in_parent(event, static_cast(this), parent()); - if (event.IsShiftDown() && IsSelectionModifierDown(event)) { - controller_->AddSelectionFromAnchorTo(this); - } else if (event.IsShiftDown()) { - controller_->ExtendSelectionTo(this); - } else if (IsSelectionModifierDown(event)) { - controller_->ToggleSelected(this); - if (!IsSelected()) { - // Don't allow dragging non-selected tabs. - return false; - } - } else if (!IsSelected()) { - controller_->SelectTab(this, event); - base::RecordAction(UserMetricsAction("SwitchTab_Click")); - } - ui::MouseEvent cloned_event(event_in_parent, parent(), - static_cast(this)); - - if (!closing()) { - controller_->MaybeStartDrag(this, cloned_event, original_selection); - } - } - return true; -} - -bool Tab::OnMouseDragged(const ui::MouseEvent& event) { - // TODO: ensure ignoring return value is ok. - std::ignore = controller_->ContinueDrag(this, event); - return true; -} - -void Tab::OnMouseReleased(const ui::MouseEvent& event) { - controller_->OnMouseEventInTab(this, event); - - // Notify the drag helper that we're done with any potential drag operations. - // Clean up the drag helper, which is re-created on the next mouse press. - // In some cases, ending the drag will schedule the tab for destruction; if - // so, bail immediately, since our members are already dead and we shouldn't - // do anything else except drop the tab where it is. - if (controller_->EndDrag(END_DRAG_COMPLETE)) { - return; - } - - // Close tab on double click, mirror of IsOnlyMiddleMouseButton - // Based on gz83's work. - // if (base::CommandLine::ForCurrentProcess()->HasSwitch("double-click-close-tab")) { - // if (event.IsOnlyLeftMouseButton() && event.GetClickCount() == 2) { - // if (HitTestPoint(event.location())) { - // controller_->CloseTab(this, CLOSE_TAB_FROM_MOUSE); - // } - // } - // } else if (closing_) { - // We're animating closed and a middle mouse button was pushed on us but - // we don't contain the mouse anymore. We assume the user is clicking - // quicker than the animation and we should close the tab that falls under - // the mouse. - // gfx::Point location_in_parent = event.location(); - // ConvertPointToTarget(this, parent(), &location_in_parent); - // Tab* closest_tab = controller_->GetTabAt(location_in_parent); - // if (closest_tab) - // controller_->CloseTab(closest_tab, CLOSE_TAB_FROM_MOUSE); - // } - - // Close tab on middle click, but only if the button is released over the tab - // (normal windows behavior is to discard presses of a UI element where the - // releases happen off the element). - if (event.IsOnlyMiddleMouseButton() || - // Close tab on double click, mirror of IsOnlyMiddleMouseButton - // Based on gz83's work. - ((event.IsOnlyLeftMouseButton() && event.GetClickCount() == 2) && - base::CommandLine::ForCurrentProcess()->HasSwitch("double-click-close-tab"))) { - if (HitTestPoint(event.location())) { - controller_->CloseTab(this, CLOSE_TAB_FROM_MOUSE); - } else if (closing_) { - // We're animating closed and a middle mouse button was pushed on us but - // we don't contain the mouse anymore. We assume the user is clicking - // quicker than the animation and we should close the tab that falls under - // the mouse. - gfx::Point location_in_parent = event.location(); - ConvertPointToTarget(this, parent(), &location_in_parent); - Tab* closest_tab = controller_->GetTabAt(location_in_parent); - if (closest_tab) { - controller_->CloseTab(closest_tab, CLOSE_TAB_FROM_MOUSE); - } - } - } else if (event.IsOnlyLeftMouseButton() && !event.IsShiftDown() && - !IsSelectionModifierDown(event)) { - // If the tab was already selected mouse pressed doesn't change the - // selection. Reset it now to handle the case where multiple tabs were - // selected. - controller_->SelectTab(this, event); - } -} - -void Tab::OnMouseCaptureLost() { - controller_->EndDrag(END_DRAG_CAPTURE_LOST); -} - -void Tab::OnMouseMoved(const ui::MouseEvent& event) { - tab_style_views()->SetHoverLocation(event.location()); - controller_->OnMouseEventInTab(this, event); - - // Linux enter/leave events are sometimes flaky, so we don't want to "miss" - // an enter event and fail to hover the tab. - // - // In Windows, we won't miss the enter event but mouse input is disabled after - // a touch gesture and we could end up ignoring the enter event. If the user - // subsequently moves the mouse, we need to then hover the tab. - // - // Either way, this is effectively a no-op if the tab is already in a hovered - // state (crbug.com/1326272). - MaybeUpdateHoverStatus(event); -} - -void Tab::OnMouseEntered(const ui::MouseEvent& event) { - MaybeUpdateHoverStatus(event); -} - -void Tab::MaybeUpdateHoverStatus(const ui::MouseEvent& event) { - // During system-DnD-based tab dragging we sometimes receive mouse events, but - // we shouldn't update the hover status during a drag. - if (mouse_hovered_ || !GetWidget()->IsMouseEventsEnabled() || - TabDragController::IsActive()) { - return; - } - -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) - // Move the hit test area for hovering up so that it is not overlapped by tab - // hover cards when they are shown. - // TODO(crbug.com/41467565): Once Linux/CrOS widget transparency is solved, - // remove that case. - constexpr int kHoverCardOverlap = 6; - if (event.location().y() >= height() - kHoverCardOverlap) { - return; - } -#endif - - mouse_hovered_ = true; - tab_style_views()->ShowHover(TabStyle::ShowHoverStyle::kSubtle); - UpdateForegroundColors(); - DeprecatedLayoutImmediately(); - if (g_show_hover_card_on_mouse_hover) { - controller_->UpdateHoverCard( - this, TabSlotController::HoverCardUpdateType::kHover); - } -} - -void Tab::OnMouseExited(const ui::MouseEvent& event) { - if (!mouse_hovered_) { - return; - } - mouse_hovered_ = false; - tab_style_views()->HideHover(TabStyle::HideHoverStyle::kGradual); - UpdateForegroundColors(); - DeprecatedLayoutImmediately(); -} - -void Tab::OnGestureEvent(ui::GestureEvent* event) { - controller_->UpdateHoverCard(nullptr, - TabSlotController::HoverCardUpdateType::kEvent); - switch (event->type()) { - case ui::EventType::kGestureTapDown: { - // TAP_DOWN is only dispatched for the first touch point. - DCHECK_EQ(1, event->details().touch_points()); - - // See comment in OnMousePressed() as to why we copy the event. - ui::GestureEvent event_in_parent(*event, static_cast(this), - parent()); - ui::ListSelectionModel original_selection; - original_selection = controller_->GetSelectionModel(); - if (!IsSelected()) { - controller_->SelectTab(this, *event); - } - gfx::Point loc(event->location()); - views::View::ConvertPointToScreen(this, &loc); - ui::GestureEvent cloned_event(event_in_parent, parent(), - static_cast(this)); - - if (!closing()) { -#if BUILDFLAG(IS_WIN) - // If the pen is down on the tab, let pen events fall through to the - // default window handler until the pen is raised. This allows the - // default window handler to execute drag-drop on the window when it's - // moved by its tab, e.g., when the window has a single tab or when a - // tab is being detached. - const bool is_pen = event->details().primary_pointer_type() == - ui::EventPointerType::kPen; - if (is_pen) { - views::UseDefaultHandlerForPenEventsUntilPenUp(); - } -#endif - controller_->MaybeStartDrag(this, cloned_event, original_selection); - } - break; - } - - default: - break; - } - event->SetHandled(); -} - -std::u16string Tab::GetTooltipText(const gfx::Point& p) const { - // Tab hover cards don't replace tooltips for tabs in all cases. - const auto tab_hover_cards_tooltip = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII("tab-hover-cards") == "tooltip"; - if (tab_hover_cards_tooltip) { - return GetTooltipText(data_.title, GetAlertStateToShow(data_.alert_state)); - } else { - return std::u16string(); - } -} - -void Tab::GetAccessibleNodeData(ui::AXNodeData* node_data) { - std::u16string name = controller_->GetAccessibleTabName(this); - if (!name.empty()) { - node_data->SetNameChecked(name); - } else { - // Under some conditions, |GetAccessibleTabName| returns an empty string. - node_data->SetNameExplicitlyEmpty(); - } -} - -gfx::Size Tab::CalculatePreferredSize( - const views::SizeBounds& available_size) const { - return gfx::Size(tab_style()->GetStandardWidth(), - GetLayoutConstant(TAB_HEIGHT)); -} - -void Tab::PaintChildren(const views::PaintInfo& info) { - // Clip children based on the tab's fill path. This has no effect except when - // the tab is too narrow to completely show even one icon, at which point this - // serves to clip the favicon. - ui::ClipRecorder clip_recorder(info.context()); - // The paint recording scale for tabs is consistent along the x and y axis. - const float paint_recording_scale = info.paint_recording_scale_x(); - - const SkPath clip_path = tab_style_views()->GetPath( - TabStyle::PathType::kInteriorClip, paint_recording_scale); - - clip_recorder.ClipPathWithAntiAliasing(clip_path); - View::PaintChildren(info); -} - -void Tab::OnPaint(gfx::Canvas* canvas) { - tab_style_views()->PaintTab(canvas); -} - -void Tab::AddedToWidget() { - paint_as_active_subscription_ = - GetWidget()->RegisterPaintAsActiveChangedCallback(base::BindRepeating( - &Tab::UpdateForegroundColors, base::Unretained(this))); -} - -void Tab::RemovedFromWidget() { - paint_as_active_subscription_ = {}; -} - -void Tab::OnFocus() { - View::OnFocus(); - controller_->UpdateHoverCard(this, - TabSlotController::HoverCardUpdateType::kFocus); -} - -void Tab::OnBlur() { - View::OnBlur(); - if (!controller_->IsFocusInTabs()) { - controller_->UpdateHoverCard( - nullptr, TabSlotController::HoverCardUpdateType::kFocus); - } -} - -void Tab::OnThemeChanged() { - TabSlotView::OnThemeChanged(); - UpdateForegroundColors(); -} - -TabSlotView::ViewType Tab::GetTabSlotViewType() const { - return TabSlotView::ViewType::kTab; -} - -TabSizeInfo Tab::GetTabSizeInfo() const { - return {tab_style()->GetPinnedWidth(), tab_style()->GetMinimumActiveWidth(), - tab_style()->GetMinimumInactiveWidth(), - tab_style()->GetStandardWidth()}; -} - -void Tab::SetClosing(bool closing) { - closing_ = closing; - ActiveStateChanged(); - - if (closing && views::FocusRing::Get(this)) { - // When closing, sometimes DCHECK fails because - // cc::Layer::IsPropertyChangeAllowed() returns false. Deleting - // the focus ring fixes this. TODO(collinbaker): investigate why - // this happens. - views::FocusRing::Remove(this); - } -} - -std::optional Tab::GetGroupColor() const { - if (closing_ || !group().has_value()) { - return std::nullopt; - } - - return controller_->GetPaintedGroupColor( - controller_->GetGroupColorId(group().value())); -} - -ui::ColorId Tab::GetAlertIndicatorColor(TabAlertState state) const { - const ui::ColorProvider* color_provider = GetColorProvider(); - if (!color_provider) { - return gfx::kPlaceholderColor; - } - - int group; - switch (state) { - case TabAlertState::MEDIA_RECORDING: - case TabAlertState::AUDIO_RECORDING: - case TabAlertState::VIDEO_RECORDING: - case TabAlertState::DESKTOP_CAPTURING: - group = 0; - break; - case TabAlertState::TAB_CAPTURING: - case TabAlertState::PIP_PLAYING: - group = 1; - break; - case TabAlertState::AUDIO_PLAYING: - case TabAlertState::AUDIO_MUTING: - case TabAlertState::BLUETOOTH_CONNECTED: - case TabAlertState::BLUETOOTH_SCAN_ACTIVE: - case TabAlertState::USB_CONNECTED: - case TabAlertState::HID_CONNECTED: - case TabAlertState::SERIAL_CONNECTED: - case TabAlertState::VR_PRESENTING_IN_HEADSET: - group = 2; - break; - } - - const ui::ColorId color_ids[3][2][2] = { - {{kColorTabAlertMediaRecordingInactiveFrameInactive, - kColorTabAlertMediaRecordingInactiveFrameActive}, - {kColorTabAlertMediaRecordingActiveFrameInactive, - kColorTabAlertMediaRecordingActiveFrameActive}}, - {{kColorTabAlertPipPlayingInactiveFrameInactive, - kColorTabAlertPipPlayingInactiveFrameActive}, - {kColorTabAlertPipPlayingActiveFrameInactive, - kColorTabAlertPipPlayingActiveFrameActive}}, - {{kColorTabAlertAudioPlayingInactiveFrameInactive, - kColorTabAlertAudioPlayingInactiveFrameActive}, - {kColorTabAlertAudioPlayingActiveFrameInactive, - kColorTabAlertAudioPlayingActiveFrameActive}}}; - return color_ids[group][tab_style_views()->GetApparentActiveState() == - TabActive::kActive] - [GetWidget()->ShouldPaintAsActive()]; -} - -bool Tab::IsActive() const { - return controller_->IsActiveTab(this); -} - -void Tab::ActiveStateChanged() { - UpdateTabIconNeedsAttentionBlocked(); - UpdateForegroundColors(); - icon_->SetActiveState(IsActive()); - alert_indicator_button_->OnParentTabButtonColorChanged(); - title_->SetFontList(tab_style_views_->GetFontList()); - DeprecatedLayoutImmediately(); -} - -void Tab::AlertStateChanged() { - if (controller_->HoverCardIsShowingForTab(this)) { - controller_->UpdateHoverCard( - this, TabSlotController::HoverCardUpdateType::kTabDataChanged); - } - DeprecatedLayoutImmediately(); -} - -void Tab::SelectedStateChanged() { - UpdateForegroundColors(); - GetViewAccessibility().SetIsSelected(IsSelected()); -} - -bool Tab::IsSelected() const { - return controller_->IsTabSelected(this); -} - -bool Tab::IsDiscarded() const { - return data().is_tab_discarded; -} - -bool Tab::HasThumbnail() const { - return data().thumbnail && data().thumbnail->has_data(); -} - -void Tab::SetData(TabRendererData data) { - DCHECK(GetWidget()); - - if (data_ == data) { - return; - } - - TabRendererData old(std::move(data_)); - data_ = std::move(data); - - icon_->SetData(data_); - icon_->SetCanPaintToLayer(controller_->CanPaintThrobberToLayer()); - UpdateTabIconNeedsAttentionBlocked(); - - std::u16string title = data_.title; - if (title.empty() && !data_.should_render_empty_title) { - title = icon_->GetShowingLoadingAnimation() - ? l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) - : CoreTabHelper::GetDefaultTitle(); - } else { - title = Browser::FormatTitleForDisplay(title); - } - title_->SetText(title); - - const auto new_alert_state = GetAlertStateToShow(data_.alert_state); - const auto old_alert_state = GetAlertStateToShow(old.alert_state); - if (new_alert_state != old_alert_state) { - alert_indicator_button_->TransitionToAlertState(new_alert_state); - } - if (old.pinned != data_.pinned) { - showing_alert_indicator_ = false; - } - if (!data_.pinned && old.pinned) { - is_animating_from_pinned_ = true; - // We must set this to true early, because we don't want to set - // |is_animating_from_pinned_| to false if we lay out before the animation - // begins. - set_animating(true); - } - - if (new_alert_state != old_alert_state || data_.title != old.title) { - TooltipTextChanged(); - } - - DeprecatedLayoutImmediately(); - SchedulePaint(); -} - -void Tab::StepLoadingAnimation(const base::TimeDelta& elapsed_time) { - icon_->StepLoadingAnimation(elapsed_time); - - // Update the layering if necessary. - // - // TODO(brettw) this design should be changed to be a push state when the tab - // can't be painted to a layer, rather than continually polling the - // controller about the state and reevaulating that state in the icon. This - // is both overly aggressive and wasteful in the common case, and not - // frequent enough in other cases since the state can be updated and the tab - // painted before the animation is stepped. - icon_->SetCanPaintToLayer(controller_->CanPaintThrobberToLayer()); -} - -void Tab::SetTabNeedsAttention(bool attention) { - icon_->SetAttention(TabIcon::AttentionType::kTabWantsAttentionStatus, - attention); - SchedulePaint(); -} - -void Tab::CreateFreezingVote(content::WebContents* contents) { - if (!freezing_vote_.has_value()) { - freezing_vote_.emplace(contents); - } -} - -void Tab::ReleaseFreezingVote() { - freezing_vote_.reset(); -} - -// static -std::u16string Tab::GetTooltipText(const std::u16string& title, - std::optional alert_state) { - if (!alert_state) { - return title; - } - - std::u16string result = title; - if (!result.empty()) { - result.append(1, '\n'); - } - result.append(GetTabAlertStateText(alert_state.value())); - return result; -} - -// static -std::optional Tab::GetAlertStateToShow( - const std::vector& alert_states) { - if (alert_states.empty()) { - return std::nullopt; - } - - return alert_states[0]; -} - -void Tab::SetShouldShowDiscardIndicator(bool enabled) { - icon_->SetShouldShowDiscardIndicator(enabled); -} - -void Tab::MaybeAdjustLeftForPinnedTab(gfx::Rect* bounds, - int visual_width) const { - if (ShouldRenderAsNormalTab()) { - return; - } - const int pinned_width = tab_style()->GetPinnedWidth(); - const int ideal_delta = width() - pinned_width; - const int ideal_x = (pinned_width - visual_width) / 2; - // TODO(crbug.com/40436434): This code is broken when the current width is - // less than the pinned width. - bounds->set_x( - bounds->x() + - base::ClampRound( - (1 - static_cast(ideal_delta) / - static_cast(kPinnedTabExtraWidthToRenderAsNormal)) * - (ideal_x - bounds->x()))); -} - -void Tab::UpdateIconVisibility() { - // TODO(pkasting): This whole function should go away, and we should simply - // compute child visibility state in Layout(). - - // Don't adjust whether we're centering the favicon or adding extra padding - // during tab closure; let it stay however it was prior to closing the tab. - // This prevents the icon and text from sliding left at the end of closing - // a non-narrow tab. - if (!closing_) { - center_icon_ = false; - extra_padding_before_content_ = false; - } - - showing_icon_ = showing_alert_indicator_ = false; - extra_alert_indicator_padding_ = false; - - if (height() < GetLayoutConstant(TAB_HEIGHT)) { - return; - } - - const bool has_favicon = data().show_icon; - const bool has_alert_icon = - (alert_indicator_button_ ? alert_indicator_button_->showing_alert_state() - : GetAlertStateToShow(data().alert_state)) - .has_value(); - - is_animating_from_pinned_ &= animating(); - - if (data().pinned || is_animating_from_pinned_) { - // When the tab is pinned, we can show one of the two icons; the alert icon - // is given priority over the favicon. The close buton is never shown. - showing_alert_indicator_ = has_alert_icon; - showing_icon_ = has_favicon && !has_alert_icon; - showing_close_button_ = false; - - // While animating to or from the pinned state, pinned tabs are rendered as - // normal tabs. Force the extra padding on so the favicon doesn't jitter - // left and then back right again as it resizes through layout regimes. - extra_padding_before_content_ = true; - extra_alert_indicator_padding_ = true; - return; - } - - int available_width = GetContentsBounds().width(); - - const bool touch_ui = ui::TouchUiController::Get()->touch_ui(); - const int favicon_width = gfx::kFaviconSize; - const int alert_icon_width = - alert_indicator_button_->GetPreferredSize().width(); - // In case of touch optimized UI, the close button has an extra padding on the - // left that needs to be considered. - const int close_button_width = GetLayoutConstant(TAB_CLOSE_BUTTON_SIZE) + - GetLayoutConstant(TAB_AFTER_TITLE_PADDING); - const bool large_enough_for_close_button = - available_width >= (touch_ui ? kTouchMinimumContentsWidthForCloseButtons - : kMinimumContentsWidthForCloseButtons); - - if (IsActive()) { -#if BUILDFLAG(IS_CHROMEOS_ASH) - // Hide tab close button for OnTask if locked. Only applicable for non-web - // browser scenarios. - showing_close_button_ = !controller_->IsLockedForOnTask(); -#else - // Close button is shown on active tabs regardless of the size. - showing_close_button_ = true; -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - available_width -= close_button_width; - - showing_alert_indicator_ = - has_alert_icon && alert_icon_width <= available_width; - if (showing_alert_indicator_) { - available_width -= alert_icon_width; - } - - showing_icon_ = has_favicon && favicon_width <= available_width; - if (showing_icon_) { - available_width -= favicon_width; - } - } else { - showing_alert_indicator_ = - has_alert_icon && alert_icon_width <= available_width; - if (showing_alert_indicator_) { - available_width -= alert_icon_width; - } - - showing_icon_ = has_favicon && favicon_width <= available_width; - if (showing_icon_) { - available_width -= favicon_width; - } - - showing_close_button_ = -#if BUILDFLAG(IS_CHROMEOS_ASH) - !controller_->IsLockedForOnTask() && -#endif - large_enough_for_close_button; - if (showing_close_button_) { - available_width -= close_button_width; - } - - // If no other controls are visible, show the alert icon or the favicon - // even though we don't have enough space. We'll clip the icon in - // PaintChildren(). - if (!showing_close_button_ && !showing_alert_indicator_ && !showing_icon_) { - showing_alert_indicator_ = has_alert_icon; - showing_icon_ = !showing_alert_indicator_ && has_favicon; - - // See comments near top of function on why this conditional is here. - if (!closing_) { - center_icon_ = true; - } - } - } - - // Don't update padding while the tab is closing, to avoid glitchy-looking - // behaviour when the close animation causes the tab to get very small - if (!closing_) { - // The extra padding is intended to visually balance the close button, so - // only include it when the close button is shown or will be shown on hover. - // We also check this for active tabs so that the extra padding doesn't pop - // in and out as you switch tabs. - extra_padding_before_content_ = large_enough_for_close_button; - } - - extra_alert_indicator_padding_ = showing_alert_indicator_ && - showing_close_button_ && - large_enough_for_close_button; -} - -bool Tab::ShouldRenderAsNormalTab() const { - return !data().pinned || (width() >= (tab_style()->GetPinnedWidth() + - kPinnedTabExtraWidthToRenderAsNormal)); -} - -void Tab::UpdateTabIconNeedsAttentionBlocked() { - // Only show the blocked attention indicator on non-active tabs. For active - // tabs, the user sees the dialog blocking the tab, so there's no point to it - // and it would be distracting. - if (IsActive()) { - icon_->SetAttention(TabIcon::AttentionType::kBlockedWebContents, false); - } else { - icon_->SetAttention(TabIcon::AttentionType::kBlockedWebContents, - data_.blocked); - } -} - -int Tab::GetWidthOfLargestSelectableRegion() const { - // Assume the entire region to the left of the alert indicator and/or close - // buttons is available for click-to-select. If neither are visible, the - // entire tab region is available. - const int indicator_left = alert_indicator_button_->GetVisible() - ? alert_indicator_button_->x() - : width(); - const int close_button_left = - close_button_->GetVisible() ? close_button_->x() : width(); - return std::min(indicator_left, close_button_left); -} - -void Tab::UpdateForegroundColors() { - TabStyle::TabColors colors = tab_style_views()->CalculateTargetColors(); - title_->SetEnabledColor(colors.foreground_color); - close_button_->SetColors(colors); - alert_indicator_button_->OnParentTabButtonColorChanged(); - // There may be no focus ring when the tab is closing. - if (auto* focus_ring = views::FocusRing::Get(this); focus_ring) { - focus_ring->SetColorId(colors.focus_ring_color); - focus_ring->SetOutsetFocusRingDisabled(true); - } - SchedulePaint(); -} - -void Tab::CloseButtonPressed(const ui::Event& event) { - if (!alert_indicator_button_ || !alert_indicator_button_->GetVisible()) { - base::RecordAction(UserMetricsAction("CloseTab_NoAlertIndicator")); - } else if (GetAlertStateToShow(data_.alert_state) == - TabAlertState::AUDIO_PLAYING) { - base::RecordAction(UserMetricsAction("CloseTab_AudioIndicator")); - } else { - base::RecordAction(UserMetricsAction("CloseTab_RecordingIndicator")); - } - - const bool from_mouse = event.type() == ui::EventType::kMouseReleased && - !(event.flags() & ui::EF_FROM_TOUCH); - controller_->CloseTab( - this, from_mouse ? CLOSE_TAB_FROM_MOUSE : CLOSE_TAB_FROM_TOUCH); -} - -BEGIN_METADATA(Tab) -END_METADATA diff --git a/src/chrome/browser/ui/views/tabs/tab.h b/src/chrome/browser/ui/views/tabs/tab.h deleted file mode 100644 index 23b5cdd8..00000000 --- a/src/chrome/browser/ui/views/tabs/tab.h +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright 2012 The Chromium Authors -// 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_TABS_TAB_H_ -#define CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ - -#include -#include -#include - -#include "base/gtest_prod_util.h" -#include "base/memory/raw_ptr.h" -#include "chrome/browser/ui/tabs/tab_enums.h" -#include "chrome/browser/ui/tabs/tab_renderer_data.h" -#include "chrome/browser/ui/views/tabs/tab_slot_view.h" -#include "chrome/browser/ui/views/tabs/tab_style_views.h" -#include "components/performance_manager/public/freezing/freezing.h" -#include "components/tab_groups/tab_group_id.h" -#include "ui/base/metadata/metadata_header_macros.h" -#include "ui/gfx/animation/animation_delegate.h" -#include "ui/gfx/animation/linear_animation.h" -#include "ui/gfx/geometry/point.h" -#include "ui/gfx/paint_throbber.h" -#include "ui/views/context_menu_controller.h" -#include "ui/views/controls/button/button.h" -#include "ui/views/controls/focus_ring.h" -#include "ui/views/masked_targeter_delegate.h" -#include "ui/views/view_observer.h" - -class AlertIndicatorButton; -class TabCloseButton; -class TabSlotController; -class TabIcon; -struct TabSizeInfo; - -namespace gfx { -class Animation; -class LinearAnimation; -} // namespace gfx -namespace views { -class Label; -class View; -} // namespace views - -/////////////////////////////////////////////////////////////////////////////// -// -// A View that renders a Tab in a TabStrip. -// -/////////////////////////////////////////////////////////////////////////////// -class Tab : public gfx::AnimationDelegate, - public views::MaskedTargeterDelegate, - public views::ViewObserver, - public TabSlotView { - METADATA_HEADER(Tab, TabSlotView) - - public: - // When the content's width of the tab shrinks to below this size we should - // hide the close button on inactive tabs. Any smaller and they're too easy - // to hit on accident. - static constexpr int kMinimumContentsWidthForCloseButtons = 68; - static constexpr int kTouchMinimumContentsWidthForCloseButtons = 100; - - // Sets whether hover cards should appear on mouse hover. Used in browser - // tests to prevent them from interfering with unrelated tests. - static void SetShowHoverCardOnMouseHoverForTesting(bool value); - - explicit Tab(TabSlotController* controller); - Tab(const Tab&) = delete; - Tab& operator=(const Tab&) = delete; - ~Tab() override; - - // gfx::AnimationDelegate: - void AnimationEnded(const gfx::Animation* animation) override; - void AnimationProgressed(const gfx::Animation* animation) override; - - // views::MaskedTargeterDelegate: - bool GetHitTestMask(SkPath* mask) const override; - - // TabSlotView: - void Layout(PassKey) override; - bool OnKeyPressed(const ui::KeyEvent& event) override; - bool OnKeyReleased(const ui::KeyEvent& event) override; - bool OnMousePressed(const ui::MouseEvent& event) override; - bool OnMouseDragged(const ui::MouseEvent& event) override; - void OnMouseReleased(const ui::MouseEvent& event) override; - void OnMouseCaptureLost() override; - void OnMouseMoved(const ui::MouseEvent& event) override; - void OnMouseEntered(const ui::MouseEvent& event) override; - void OnMouseExited(const ui::MouseEvent& event) override; - void OnGestureEvent(ui::GestureEvent* event) override; - std::u16string GetTooltipText(const gfx::Point& p) const override; - void GetAccessibleNodeData(ui::AXNodeData* node_data) override; - gfx::Size CalculatePreferredSize( - const views::SizeBounds& available_size) const override; - void PaintChildren(const views::PaintInfo& info) override; - void OnPaint(gfx::Canvas* canvas) override; - void AddedToWidget() override; - void RemovedFromWidget() override; - void OnFocus() override; - void OnBlur() override; - void OnThemeChanged() override; - TabSlotView::ViewType GetTabSlotViewType() const override; - TabSizeInfo GetTabSizeInfo() const override; - - TabSlotController* controller() const { return controller_; } - - // Used to set/check whether this Tab is being animated closed. - void SetClosing(bool closing); - bool closing() const { return closing_; } - - // Returns the color for the tab's group, if any. - std::optional GetGroupColor() const; - - // Returns the color used for the alert indicator icon. - ui::ColorId GetAlertIndicatorColor(TabAlertState state) const; - - // Returns true if this tab is the active tab. - bool IsActive() const; - - // Notifies the AlertIndicatorButton that the active state of this tab has - // changed. - void ActiveStateChanged(); - - // Called when the alert indicator has changed states. - void AlertStateChanged(); - - // Called when the selected state changes. - void SelectedStateChanged(); - - // Returns true if the tab is selected. - bool IsSelected() const; - - // Returns true if this tab is discarded. - bool IsDiscarded() const; - - // Returns true if this tab has captured a thumbnail. - bool HasThumbnail() const; - - // Sets the data this tabs displays. Should only be called after Tab is added - // to widget hierarchy. - void SetData(TabRendererData data); - const TabRendererData& data() const { return data_; } - - // Redraws the loading animation if one is visible. Otherwise, no-op. The - // |elapsed_time| parameter is shared between tabs and used to keep the - // throbbers in sync. - void StepLoadingAnimation(const base::TimeDelta& elapsed_time); - - // Sets the visibility of the indicator shown when the tab needs to indicate - // to the user that it needs their attention. - void SetTabNeedsAttention(bool attention); - - void CreateFreezingVote(content::WebContents* contents); - void ReleaseFreezingVote(); - bool HasFreezingVote() const { return freezing_vote_.has_value(); } - - // Returns the width of the largest part of the tab that is available for the - // user to click to select/activate the tab. - int GetWidthOfLargestSelectableRegion() const; - - bool mouse_hovered() const { return mouse_hovered_; } - - // Returns the TabStyle associated with this tab. - TabStyleViews* tab_style_views() { return tab_style_views_.get(); } - const TabStyleViews* tab_style_views() const { - return tab_style_views_.get(); - } - const TabStyle* tab_style() const { return tab_style_views_->tab_style(); } - - // Returns the text to show in a tab's tooltip: The contents |title|, followed - // by a break, followed by a localized string describing the |alert_state|. - // Exposed publicly for tests. - static std::u16string GetTooltipText( - const std::u16string& title, - std::optional alert_state); - - // Returns an alert state to be shown among given alert states. - static std::optional GetAlertStateToShow( - const std::vector& alert_states); - - bool showing_close_button_for_testing() const { - return showing_close_button_; - } - - raw_ptr close_button() { return close_button_; } - - TabIcon* GetTabIconForTesting() const { return icon_; } - - AlertIndicatorButton* alert_indicator_button_for_testing() { - return alert_indicator_button_; - } - - void SetShouldShowDiscardIndicator(bool enabled); - - private: - class TabCloseButtonObserver; - friend class AlertIndicatorButtonTest; - friend class TabTest; - friend class TabStripTestBase; -#if BUILDFLAG(IS_CHROMEOS_ASH) - FRIEND_TEST_ALL_PREFIXES(TabStripTest, CloseButtonHiddenWhenLockedForOnTask); -#endif - FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabCloseButtonVisibility); - FRIEND_TEST_ALL_PREFIXES(TabTest, TitleTextHasSufficientContrast); - FRIEND_TEST_ALL_PREFIXES(TabHoverCardInteractiveUiTest, - HoverCardVisibleOnTabCloseButtonFocusAfterTabFocus); - - // Invoked from Layout to adjust the position of the favicon or alert - // indicator for pinned tabs. The visual_width parameter is how wide the - // icon looks (rather than how wide the bounds are). - void MaybeAdjustLeftForPinnedTab(gfx::Rect* bounds, int visual_width) const; - - // Computes which icons are visible in the tab. Should be called everytime - // before layout is performed. - void UpdateIconVisibility(); - - // Returns whether the tab should be rendered as a normal tab as opposed to a - // pinned tab. - bool ShouldRenderAsNormalTab() const; - - // Updates the blocked attention state of the |icon_|. This only updates - // state; it is the responsibility of the caller to request a paint. - void UpdateTabIconNeedsAttentionBlocked(); - - // Selects, generates, and applies colors for various foreground elements to - // ensure proper contrast. Elements affected include title text, close button - // and alert icon. - void UpdateForegroundColors(); - - // Considers switching to hovered mode or [re-]showing the hover card based on - // the mouse moving over the tab. If the tab is already hovered or mouse - // events are disabled because of touch input, this is a no-op. - void MaybeUpdateHoverStatus(const ui::MouseEvent& event); - - void CloseButtonPressed(const ui::Event& event); - - // The controller, never nullptr. - const raw_ptr controller_; - - TabRendererData data_; - - std::unique_ptr tab_style_views_; - - // True if the tab is being animated closed. - bool closing_ = false; - - raw_ptr icon_ = nullptr; - raw_ptr alert_indicator_button_ = nullptr; - raw_ptr close_button_ = nullptr; - - raw_ptr title_; - // The title's bounds are animated when switching between showing and hiding - // the tab's favicon/throbber. - gfx::Rect start_title_bounds_; - gfx::Rect target_title_bounds_; - gfx::LinearAnimation title_animation_; - - // For narrow tabs, we show the alert icon or, if there is no alert icon, the - // favicon even if it won't completely fit. In this case, we need to center - // the icon within the tab; it will be clipped to fit. - bool center_icon_ = false; - - // Whether we're showing the icon. It is cached so that we can detect when it - // changes and layout appropriately. - bool showing_icon_ = false; - - // Whether we're showing the alert indicator. It is cached so that we can - // detect when it changes and layout appropriately. - bool showing_alert_indicator_ = false; - - // Whether we are showing the close button. It is cached so that we can - // detect when it changes and layout appropriately. - bool showing_close_button_ = false; - - // Whether the tab is currently animating from a pinned to an unpinned state. - bool is_animating_from_pinned_ = false; - - // If there's room, we add additional padding to the left of the favicon to - // balance the whitespace inside the non-hovered close button image; - // otherwise, the tab contents look too close to the left edge. Once the tabs - // get too small, we let the tab contents take the full width, to maximize - // visible area. - bool extra_padding_before_content_ = false; - - // When both the close button and alert indicator are visible, we add extra - // padding between them to space them out visually. - bool extra_alert_indicator_padding_ = false; - - // Indicates whether the mouse is currently hovered over the tab. This is - // different from View::IsMouseHovered() which does a naive intersection with - // the view bounds. - bool mouse_hovered_ = false; - - std::unique_ptr tab_close_button_observer_; - - // Freezing vote held while the tab is collapsed. - std::optional freezing_vote_; - - base::CallbackListSubscription paint_as_active_subscription_; -}; - -#endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ diff --git a/src/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc b/src/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc index 1af6b4bf..db23eeec 100644 --- a/src/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc +++ b/src/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc @@ -153,8 +153,9 @@ void BrowserAppMenuButton::UpdateIcon() { base::CommandLine::ForCurrentProcess()->HasSwitch("disable-thorium-icons"); const gfx::VectorIcon& icon = ui::TouchUiController::Get()->touch_ui() ? kBrowserToolsTouchIcon - : disable_thorium_icons ? kBrowserToolsChromeRefreshIcon - : kBrowserToolsChromeRefreshThoriumIcon; + : disable_thorium_icons + ? kBrowserToolsChromeRefreshIcon + : kBrowserToolsChromeRefreshThoriumIcon; // Fix Thorium hamburger menu size static const int icon_size = 22; for (auto state : kButtonStates) { diff --git a/src/chrome/installer/mini_installer/BUILD.gn b/src/chrome/installer/mini_installer/BUILD.gn index cc82bde2..58852f79 100644 --- a/src/chrome/installer/mini_installer/BUILD.gn +++ b/src/chrome/installer/mini_installer/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/compiler_opt.gni") import("//build/config/compiler/compiler.gni") import("//build/config/features.gni") import("//build/config/python.gni") @@ -315,8 +316,46 @@ template("generate_mini_installer") { } } -generate_mini_installer("mini_installer") { - rc_file = packed_files_rc_file +group("mini_installer") { + if (use_sse2) { + generate_mini_installer("thorium_WIN32_SSE2_mini_installer") { + rc_file = packed_files_rc_file + } + } else if (use_sse3) { + if (current_cpu == "x86") { + generate_mini_installer("thorium_WIN32_SSE3_mini_installer") { + rc_file = packed_files_rc_file + } + } else { + generate_mini_installer("thorium_SSE3_mini_installer") { + rc_file = packed_files_rc_file + } + } + } else if (use_sse4.1) { + generate_mini_installer("thorium_SSE4_mini_installer") { + rc_file = packed_files_rc_file + } + } else if (use_sse4.2) { + generate_mini_installer("thorium_SSE4.2_mini_installer") { + rc_file = packed_files_rc_file + } + } else if (use_avx) { + generate_mini_installer("thorium_AVX_mini_installer") { + rc_file = packed_files_rc_file + } + } else if (use_avx2) { + generate_mini_installer("thorium_AVX2_mini_installer") { + rc_file = packed_files_rc_file + } + } else if (use_avx512) { + generate_mini_installer("thorium_AVX512_mini_installer") { + rc_file = packed_files_rc_file + } + } else { + generate_mini_installer("thorium_mini_installer") { + rc_file = packed_files_rc_file + } + } } if (enable_uncompressed_archive) { diff --git a/src/components/neterror/resources/offline.js b/src/components/neterror/resources/offline.js index ce6e8335..26b35ae6 100644 --- a/src/components/neterror/resources/offline.js +++ b/src/components/neterror/resources/offline.js @@ -129,6 +129,7 @@ const IS_RTL = document.querySelector('html').dir == 'rtl'; /** @const */ /** const ARCADE_MODE_URL = 'Thorium Dino'; */ const ARCADE_MODE_URL = 'chrome://dino/'; +const ARCADE_MODE2_URL = 'Thorium Dino Game'; /** @const */ const RESOURCE_POSTFIX = 'offline-resources-'; @@ -453,8 +454,8 @@ Runner.prototype = { favicon100.href = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA3XAAAN1wFCKJt4AAABCUlEQVQ4y5WSK2/DMBSFv1RFwSuJZIWYBHe0wystTumCRze+/zC84NFqtMHDISaRJZMal27kZqqsm7Q7kiU/7uPc45NxBYV3G6BWnt6CscOS6zgCrVLkCcgW3IZ66uHWApNY/jO+BTogAsMfg8K73YyAIyJwBtZAHoz9vmTwAnwmyR/A48XVEIxt0iaZBP8IvWdgBRyAMomNwAnYj91TDWoglwKlMtEgDQZNxB6ogN2cgsHYbuobH0TdueT7SR8EYyOwB76UmCjUVWSFdyVwJ+cz8A5sZCyALhjbFN6tteILRahW9ltZs8gS06yETRmMfZX7I9AEY3vVyjJCPipceFcp9tVcWgVj+1+cIE8di05TcgAAAABJRU5ErkJggg=='; favicon200.href = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAA3XAAAN1wFCKJt4AAABxklEQVRYw81XoW7DMBB9mYKKM2LJKjEJTmn4cPFG23/oB+QfGjpePB7a4BCDZZaMiks3cp28yE7s1G13UqUmju13d+/e2QkiGFOyBJB7ft5pLprLQ4o49gpg4/ltDeAXQBLB+2/6ewbQUSQWU/M0FwkAPCGedZqLFYHwtpgAcqbkMYALUTkACnsROilmBGbZwwGkN15/+2gAraVSzvcEcBw8r4agUkNQjgAqzcXBU4DWAHaO4QOAyqYVYykoAGQeG+cASvq5yu6kuWhvRcISwD5WjhKLprckqUPP9wEN508laC7qEB1YMiX3TMnlYPMyYNPGpwRdKcjI0xNTsqd3oZ53mouaKVlMNacxDuyuza/mYjIK/6oXbM2Tyt17AeUsIw7kV6z5FuJIYim3wiKhIbbyFSEXBzrS7C6U+XPmJSOSuwPw4ln/DYAPzUU1WwkdIDaesjuqdqMkJOItXWICoDZk2myrhQ0cNauF5/59CuDZ0dV6OusP31XG2NYCIvfpqsZdwu/ywZT8ZEq+O8Y2V+uAsWAGYG25x1Vz8xxahmc6NrUAvszeYIuAx9gkCXOj1BrNRWc5TNYGBxAw5izxS8kmDgB3sx9qpKWGIYm9DgAAAABJRU5ErkJggg=='; - if (this.isArcadeMode()) { - document.title = 'Thorium Dino Game' + if (this.isChromeDino()) { + document.title = ARCADE_MODE2_URL; document.head.appendChild(favicon100); document.head.appendChild(favicon200); } @@ -1402,11 +1403,24 @@ Runner.prototype = { * Whether the game should go into arcade mode. * @return {boolean} */ + isChromeDino() { + // In RTL languages the title is wrapped with the left to right mark + // control characters ‪ and ‬ but are invisible. + const is_chrome_dino = IS_RTL ? document.title.indexOf(ARCADE_MODE_URL) == + : document.title === ARCADE_MODE_URL; + return is_chrome_dino; + + }, + isArcadeMode() { // In RTL languages the title is wrapped with the left to right mark // control characters ‪ and ‬ but are invisible. - return IS_RTL ? document.title.indexOf(ARCADE_MODE_URL) == 1 : - document.title === ARCADE_MODE_URL; + const is_chrome_dino = IS_RTL ? document.title.indexOf(ARCADE_MODE_URL) == + : document.title === ARCADE_MODE_URL; + const is_thorium_dino = IS_RTL ? document.title.indexOf(ARCADE_MODE2_URL) == 1 + : document.title === ARCADE_MODE2_URL; + return is_chrome_dino || is_thorium_dino; + }, /** diff --git a/upstream_version.sh b/upstream_version.sh index 56a51fb9..7ac0fd08 100755 --- a/upstream_version.sh +++ b/upstream_version.sh @@ -36,7 +36,7 @@ else export CR_SRC_DIR fi -CR_VER="130.0.6723.158" +CR_VER="130.0.6723.164" export CR_VER && diff --git a/version.sh b/version.sh index 8e3dd7b5..babdb5af 100755 --- a/version.sh +++ b/version.sh @@ -36,7 +36,7 @@ else export CR_SRC_DIR fi -THOR_VER="130.0.6723.158" +THOR_VER="130.0.6723.164" export THOR_VER &&