Compare commits

...

14 Commits

Author SHA1 Message Date
wukko e8e57e3486 revision: bump to 3 (#963) 2026-02-20 09:42:22 +00:00
wukko 643674676d merge: update to chromium 145.0.7632.109 (#958) 2026-02-20 15:34:54 +06:00
wukko 2b388075c3 patches: refresh for chromium 145.0.7632.109 2026-02-20 11:13:02 +06:00
wukko ff63ad4bbd merge: update to ungoogled-chromium 145.0.7632.109 2026-02-20 03:32:26 +06:00
wukko 2a1432b0e4 helium/noise/canvas: fix laddering and color bleeding post-noise (#955)
this fix is not perfect, but it resolved the most critical visual
artifacts. some visible grain remains, which we should blend better in a
follow-up.

- remove scan-order dependent copy paths that caused laddering/color
bleed
- noise from an immutable source snapshot instead of mutated output
pixels
- tune nearby context sampling offset to reduce visible grain and rename
the constant (`kMaxClosePixelDelta = 10` is now `kNearbyPixelMaxOffset =
2`)

fixes #827
2026-02-19 21:28:15 +00:00
wukko e56531d482 upstream-fixes/vertical: show discard indicator on discarded tabs (#957)
and remove discard promo because it was called before a valid UI context
(tab strip) was created, which was causing a crash. helium doesn't have
user education promos, so it was a no-op anyway.

fixes #926
2026-02-20 02:38:58 +06:00
wukko 47a6b26022 upstream-fixes/vertical: autoscroll to activated tabs (#952)
closes #916
2026-02-19 22:44:19 +06:00
wukko abe3bf12d8 upstream-fixes/vertical: fix vertical tabs layer z order (#950)
prevents side panel from painting over the tab strip
2026-02-19 22:15:13 +06:00
wukko 46578b03ec helium/ui/layout: keep vertical state & snap to default width (#949) 2026-02-19 21:19:34 +06:00
wukko c1c4d007dc helium/ui/layout: snap to default uncollapsed vertical width
makes restoring to default state easier
2026-02-19 21:15:50 +06:00
wukko edfd9ad0ea helium/ui/layout: store vertical collapse & resize state in prefs
fixes #928
2026-02-19 20:15:03 +06:00
wukko 6f7b4a9029 helium/ui/layout: add an option to display vertical tabs on right (#940) 2026-02-19 20:13:36 +06:00
wukko 4bbcd21640 upstream-fixes: disable scroll to change tabs on linux (#937) 2026-02-19 12:37:43 +06:00
Blaise 54de4017ee Update to Chromium 145.0.7632.109 2026-02-18 15:42:31 -06:00
64 changed files with 2006 additions and 318 deletions
+1 -1
View File
@@ -1 +1 @@
145.0.7632.75
145.0.7632.109
+2
View File
@@ -952,6 +952,7 @@ chrome/browser/content_settings/sound_content_setting_observer_unittest.cc
chrome/browser/contextual_cueing/caching_zero_state_suggestions_manager_unittest.cc
chrome/browser/contextual_cueing/zero_state_suggestions_browsertest.cc
chrome/browser/contextual_tasks/contextual_tasks_composebox_handler_unittest.cc
chrome/browser/contextual_tasks/contextual_tasks_cookie_synchronizer_unittest.cc
chrome/browser/contextual_tasks/contextual_tasks_page_handler.cc
chrome/browser/contextual_tasks/contextual_tasks_page_handler_unittest.cc
chrome/browser/contextual_tasks/contextual_tasks_ui.cc
@@ -1614,6 +1615,7 @@ chrome/browser/resources/new_tab_page/lens_form.ts
chrome/browser/resources/new_tab_page/modules/calendar/google_calendar_module.html
chrome/browser/resources/new_tab_page/transparency.ts
chrome/browser/resources/new_tab_page/voice_search_overlay.ts
chrome/browser/resources/omnibox/logging/logs_app.ts
chrome/browser/resources/omnibox/omnibox.html
chrome/browser/resources/omnibox/omnibox.ts
chrome/browser/resources/omnibox/omnibox_output.ts
+3 -3
View File
@@ -294,7 +294,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if BUILDFLAG(IS_WIN)
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -1025,6 +1025,8 @@ void AddImportDataStrings(content::WebUI
@@ -1035,6 +1035,8 @@ void AddImportDataStrings(content::WebUI
{"importHistory", IDS_SETTINGS_IMPORT_HISTORY_CHECKBOX},
{"importFavorites", IDS_SETTINGS_IMPORT_FAVORITES_CHECKBOX},
{"importPasswords", IDS_SETTINGS_IMPORT_PASSWORDS_CHECKBOX},
@@ -319,7 +319,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -1255,6 +1255,10 @@ static_library("ui") {
@@ -1259,6 +1259,10 @@ static_library("ui") {
"webui/settings/accessibility_main_handler.h",
"webui/settings/appearance_handler.cc",
"webui/settings/appearance_handler.h",
@@ -330,7 +330,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"webui/settings/browser_lifetime_handler.cc",
"webui/settings/browser_lifetime_handler.h",
"webui/settings/captions_handler.cc",
@@ -1415,6 +1419,13 @@ static_library("ui") {
@@ -1419,6 +1423,13 @@ static_library("ui") {
]
}
@@ -102,7 +102,7 @@ with limited CPU/memory resources and it is disabled by default.
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -2712,6 +2712,10 @@ inline constexpr char kLogJsConsoleMessa
@@ -2718,6 +2718,10 @@ inline constexpr char kLogJsConsoleMessa
"Enable logging JS console messages in system logs, please note that they "
"may contain PII.";
+9 -9
View File
@@ -724,7 +724,7 @@
COMPONENT_EXPORT(HELIUM) GURL GetDummyURL();
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2205,6 +2205,9 @@ void AddPrivacyStrings(content::WebUIDat
@@ -2215,6 +2215,9 @@ void AddPrivacyStrings(content::WebUIDat
IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE},
{"heliumExtProxyToggleDescription",
IDS_SETTINGS_HELIUM_SERVICES_EXT_PROXY_TOGGLE_DESCRIPTION},
@@ -809,7 +809,7 @@
optional KeywordModeEntryMethod keyword_mode_entry_method = 20;
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.h
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.h
@@ -304,6 +304,9 @@ class OmniboxEditModel {
@@ -307,6 +307,9 @@ class OmniboxEditModel {
return !is_keyword_hint_ && !keyword_.empty();
}
@@ -819,7 +819,7 @@
// Accepts the current keyword hint as a keyword. `entry_method` indicates how
// the user entered keyword mode.
void AcceptKeyword(
@@ -664,6 +667,10 @@ class OmniboxEditModel {
@@ -670,6 +673,10 @@ class OmniboxEditModel {
// triggering is enabled, false otherwise.
bool AllowKeywordSpaceTriggering() const;
@@ -832,7 +832,7 @@
// - youtube| -> youtube | (a space was appended to a keyword)
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
@@ -888,6 +888,24 @@ void OmniboxEditModel::OpenSelectionForT
@@ -889,6 +889,24 @@ void OmniboxEditModel::OpenSelectionForT
OpenSelection(popup_selection_, timestamp, disposition, via_keyboard);
}
@@ -857,7 +857,7 @@
void OmniboxEditModel::AcceptKeyword(
OmniboxEventProto::KeywordModeEntryMethod entry_method) {
TRACE_EVENT0("omnibox", "OmniboxEditModel::AcceptKeyword");
@@ -896,6 +914,17 @@ void OmniboxEditModel::AcceptKeyword(
@@ -897,6 +915,17 @@ void OmniboxEditModel::AcceptKeyword(
controller_->StopAutocomplete(/*clear_result=*/false);
@@ -875,7 +875,7 @@
SetIsKeywordHint(false);
keyword_mode_entry_method_ = entry_method;
if (original_user_text_with_keyword_.empty()) {
@@ -938,9 +967,6 @@ void OmniboxEditModel::AcceptKeyword(
@@ -939,9 +968,6 @@ void OmniboxEditModel::AcceptKeyword(
}
base::RecordAction(base::UserMetricsAction("AcceptedKeywordHint"));
@@ -885,7 +885,7 @@
EmitEnteredKeywordModeHistogram(entry_method, turl, !user_text_.empty());
}
@@ -2804,6 +2830,21 @@ bool OmniboxEditModel::AllowKeywordSpace
@@ -2812,6 +2838,21 @@ bool OmniboxEditModel::AllowKeywordSpace
return GetPrefService()->GetBoolean(omnibox::kKeywordSpaceTriggeringEnabled);
}
@@ -907,7 +907,7 @@
bool OmniboxEditModel::ShouldAcceptKeywordAfterInsertingSpaceAtEnd(
const std::u16string& new_text) {
// Check if the user has disabled space triggering.
@@ -2827,16 +2868,20 @@ bool OmniboxEditModel::ShouldAcceptKeywo
@@ -2835,16 +2876,20 @@ bool OmniboxEditModel::ShouldAcceptKeywo
return false;
}
@@ -937,7 +937,7 @@
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -2015,6 +2015,7 @@ bool OmniboxViewViews::HandleKeyEvent(vi
@@ -2016,6 +2016,7 @@ bool OmniboxViewViews::HandleKeyEvent(vi
metric_value);
if (controller()->IsPopupOpen() && !control) {
// Normal case of pressing <return> when the popup is open.
@@ -90,7 +90,7 @@
</template>
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2211,6 +2211,10 @@ void AddPrivacyStrings(content::WebUIDat
@@ -2221,6 +2221,10 @@ void AddPrivacyStrings(content::WebUIDat
{"heliumSpellcheckToggle", IDS_SETTINGS_HELIUM_SERVICES_SPELLCHECK_TOGGLE},
{"heliumSpellcheckToggleDescription",
IDS_SETTINGS_HELIUM_SERVICES_SPELLCHECK_TOGGLE_DESCRIPTION},
+1 -1
View File
@@ -1,6 +1,6 @@
--- a/components/search/ntp_features.cc
+++ b/components/search/ntp_features.cc
@@ -245,7 +245,7 @@ BASE_FEATURE(kNtpNextFeatures, base::FEA
@@ -239,7 +239,7 @@ BASE_FEATURE(kNtpNextFeatures, base::FEA
BASE_FEATURE(kNtpOneGoogleBarAsyncBarParts, base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, a footer will show on the NTP.
@@ -1,6 +1,6 @@
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -13547,11 +13547,387 @@ const FeatureEntry kFeatureEntries[] = {
@@ -13505,11 +13505,387 @@ const FeatureEntry kFeatureEntries[] = {
// AboutFlagsHistogramTest unit test to verify this process).
};
@@ -389,7 +389,7 @@
FlagsStateSingleton(const FlagsStateSingleton&) = delete;
FlagsStateSingleton& operator=(const FlagsStateSingleton&) = delete;
~FlagsStateSingleton() override = default;
@@ -13570,7 +13946,7 @@ class FlagsStateSingleton : public flags
@@ -13528,7 +13904,7 @@ class FlagsStateSingleton : public flags
void RestoreDefaultState() {
flags_state_ =
@@ -398,7 +398,7 @@
}
private:
@@ -13907,7 +14283,7 @@ base::span<const FeatureEntry> GetFeatur
@@ -13865,7 +14241,7 @@ base::span<const FeatureEntry> GetFeatur
!entries_for_testing->empty()) {
return *entries_for_testing;
}
+1 -1
View File
@@ -15,7 +15,7 @@
#endif // USE_AURA
#if defined(USE_AURA)
@@ -5225,11 +5225,13 @@ const FeatureEntry::Choice kOmniboxAutof
@@ -5159,11 +5159,13 @@ const FeatureEntry::Choice kOmniboxAutof
// calculate and verify checksum.
//
// When adding a new choice, add it to the end of the list.
+2 -2
View File
@@ -134,7 +134,7 @@
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/html/media/html_media_element.h"
@@ -776,6 +781,35 @@ LocalDOMWindow* BaseAudioContext::GetWin
@@ -777,6 +782,35 @@ LocalDOMWindow* BaseAudioContext::GetWin
return To<LocalDOMWindow>(GetExecutionContext());
}
@@ -183,7 +183,7 @@
--- a/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc
+++ b/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc
@@ -413,6 +413,8 @@ void OfflineAudioContext::FireCompletion
@@ -411,6 +411,8 @@ void OfflineAudioContext::FireCompletion
return;
}
+88 -69
View File
@@ -80,7 +80,7 @@
// AIPageContent.
--- /dev/null
+++ b/third_party/blink/renderer/core/helium_noise/canvas_noising_helper.cc
@@ -0,0 +1,240 @@
@@ -0,0 +1,259 @@
+// Copyright 2026 The Helium Authors
+// You can use, redistribute, and/or modify this source code under
+// the terms of the GPL-3.0 license that can be found in the LICENSE file.
@@ -91,9 +91,11 @@
+
+#include "third_party/blink/renderer/core/helium_noise/canvas_noising_helper.h"
+
+#include <algorithm>
+#include <array>
+#include <cstddef>
+#include <cstdint>
+#include <vector>
+
+#include "base/check_op.h"
+#include "base/containers/span.h"
@@ -115,8 +117,10 @@
+
+namespace {
+
+constexpr uint8_t kMaxClosePixelDelta = 10u;
+constexpr uint8_t kMaxNoisePerChannel = 3u;
+constexpr uint8_t kNearbyPixelMaxOffset = 2u;
+constexpr int kMaxSharedRgbNoise = 1;
+constexpr int kMaxIndependentRgbNoise = 1;
+constexpr int kMaxAlphaNoise = 1;
+constexpr uint8_t kChannelsPerPixel = 4u;
+constexpr std::array<uint8_t, 4u> kEmptyPixel({0, 0, 0, 0});
+
@@ -135,45 +139,71 @@
+
+// Returns two random pixel locations; one close to the offset and one
+// randomly selected from the entire canvas.
+const std::pair<PixelLocation, PixelLocation> GetRandomPixelLocations(
+std::pair<PixelLocation, PixelLocation> GetRandomPixelLocations(
+ HeliumNoiseHash& token_hash,
+ const PixelLocation offset,
+ const int width,
+ const int height) {
+ std::pair<PixelLocation, PixelLocation> pixel_locations;
+ // Uses 2 * log2(kMaxClosePixelDelta*2+1) = 8 bits from hash.
+ // Uses at most 2 * bit_width(kNearbyPixelMaxOffset * 2) bits from hash.
+ pixel_locations.first = {
+ offset.x + token_hash.GetValueBelow(kMaxClosePixelDelta * 2) -
+ kMaxClosePixelDelta + 1,
+ offset.y + token_hash.GetValueBelow(kMaxClosePixelDelta * 2) -
+ kMaxClosePixelDelta + 1};
+ offset.x + token_hash.GetValueBelow(kNearbyPixelMaxOffset * 2) -
+ kNearbyPixelMaxOffset + 1,
+ offset.y + token_hash.GetValueBelow(kNearbyPixelMaxOffset * 2) -
+ kNearbyPixelMaxOffset + 1};
+ // x and y might be negative or go beyond the width or height here, so we need
+ // to clamp them.
+ ClampPixelLocation(&pixel_locations.first, width, height);
+ // Uses max 2 * log2(kMaximumCanvasSize) = 40 bits from hash.
+ // Uses at most bit_width(width) + bit_width(height) bits from hash.
+ pixel_locations.second = {token_hash.GetValueBelow(width),
+ token_hash.GetValueBelow(height)};
+ // Used at most 48 bits from hash
+ // Uses at most 32 bits from hash.
+ return pixel_locations;
+}
+
+int GetSignedNoiseValue(HeliumNoiseHash& token_hash, int max_abs_noise) {
+ if (max_abs_noise <= 0) {
+ return 0;
+ }
+ return token_hash.GetValueBelow(max_abs_noise * 2 + 1) - max_abs_noise;
+}
+
+void HeliumNoisePixel(base::span<uint8_t> pixel, HeliumNoiseHash& token_hash) {
+ base::SpanWriter writer(base::as_writable_bytes(pixel));
+ const int shared_rgb_noise =
+ GetSignedNoiseValue(token_hash, kMaxSharedRgbNoise);
+ for (int i = 0; i < kChannelsPerPixel; ++i) {
+ int channel_value = pixel[i];
+
+ const bool is_alpha = i == kChannelsPerPixel - 1;
+
+ // Keep alpha limits stable.
+ if (is_alpha && (channel_value == 0 || channel_value == 255)) {
+ writer.WriteU8LittleEndian(base::checked_cast<uint8_t>(channel_value));
+ continue;
+ }
+
+ const int maxNoisePerChannel =
+ is_alpha ? kMaxAlphaNoise
+ : kMaxSharedRgbNoise + kMaxIndependentRgbNoise;
+
+ // Clamp min- and maxNoisedVal to [0, 255] and [1, 255] for the alpha
+ // channel if it was non-zero before.
+ int lowerLimit = (i == kChannelsPerPixel - 1 && channel_value > 0) ? 1 : 0;
+ int minNoisedVal = channel_value <= kMaxNoisePerChannel
+ ? lowerLimit
+ : channel_value - kMaxNoisePerChannel;
+ int maxNoisedVal = channel_value >= 255 - kMaxNoisePerChannel
+ ? 255
+ : channel_value + kMaxNoisePerChannel;
+ int noise = token_hash.GetValueBelow(
+ std::min(kMaxNoisePerChannel * 2 + 1, maxNoisedVal - minNoisedVal + 1));
+ writer.WriteU8LittleEndian(
+ base::checked_cast<uint8_t>(minNoisedVal + noise));
+ const int lowerLimit = (is_alpha && channel_value > 0) ? 1 : 0;
+ int minNoisedVal = std::max(lowerLimit, channel_value - maxNoisePerChannel);
+ int maxNoisedVal = std::min(255, channel_value + maxNoisePerChannel);
+
+ int noise = 0;
+ if (is_alpha) {
+ noise = GetSignedNoiseValue(token_hash, kMaxAlphaNoise);
+ } else {
+ noise = shared_rgb_noise +
+ GetSignedNoiseValue(token_hash, kMaxIndependentRgbNoise);
+ }
+
+ const int noised_value =
+ std::clamp(channel_value + noise, minNoisedVal, maxNoisedVal);
+ writer.WriteU8LittleEndian(base::checked_cast<uint8_t>(noised_value));
+ }
+}
+
@@ -186,9 +216,19 @@
+ .first<4u>();
+}
+
+base::span<const uint8_t, 4u> GetPixelAt(
+ const int x,
+ const int y,
+ const int width,
+ const base::span<const uint8_t> pixels) {
+ return pixels
+ .subspan(static_cast<size_t>((x + y * width) * kChannelsPerPixel))
+ .first<4u>();
+}
+
+uint64_t GetValueFromPixelLocations(
+ const std::pair<PixelLocation, PixelLocation> locations,
+ const base::span<uint8_t> pixels,
+ const base::span<const uint8_t> pixels,
+ int width) {
+ uint64_t result = 0u;
+ result |= base::U32FromLittleEndian(
@@ -199,7 +239,7 @@
+ return result;
+}
+
+void CopyPixelValue(const base::span<uint8_t> from_pixel,
+void CopyPixelValue(const base::span<const uint8_t> from_pixel,
+ base::span<uint8_t> to_pixel) {
+ base::SpanWriter writer(base::as_writable_bytes(to_pixel));
+ writer.Write(from_pixel.first<kChannelsPerPixel>());
@@ -209,56 +249,35 @@
+// source for pseudo-randomness. This function assumes that there are 4
+// channels per pixel.
+void HeliumNoisePixels(const HeliumNoiseHash& token_hash,
+ base::span<uint8_t> pixels,
+ const int width,
+ const int height) {
+ base::span<uint8_t> pixels,
+ const int width,
+ const int height) {
+ CHECK_EQ(pixels.size(),
+ static_cast<size_t>(width * height * kChannelsPerPixel));
+
+ const size_t row_size = width * kChannelsPerPixel;
+ std::vector<uint8_t> row1(row_size);
+ std::vector<uint8_t> row2(row_size);
+ base::span<uint8_t> unnoised_previous_row(row1);
+ base::span<uint8_t> unnoised_current_row(row2);
+ std::vector<uint8_t> source_pixel_storage(pixels.begin(), pixels.end());
+ base::span<const uint8_t> source_pixels(source_pixel_storage);
+
+ for (int y = 0; y < height; ++y) {
+ unnoised_current_row.copy_from(pixels.subspan(y * row_size, row_size));
+ for (int x = 0; x < width; ++x) {
+ auto pixel = GetPixelAt(x, y, width, pixels);
+ if (pixel == kEmptyPixel) {
+ auto source_pixel = GetPixelAt(x, y, width, source_pixels);
+ if (source_pixel == kEmptyPixel) {
+ continue;
+ }
+ if (y > 0 && x > 0 &&
+ GetPixelAt(x - 1, 0, width, unnoised_previous_row) == pixel) {
+ // same top-left pixel, copy.
+ CopyPixelValue(GetPixelAt(x - 1, y - 1, width, pixels), pixel);
+ } else if (y > 0 &&
+ GetPixelAt(x, 0, width, unnoised_previous_row) == pixel) {
+ // same top pixel, copy.
+ CopyPixelValue(GetPixelAt(x, y - 1, width, pixels), pixel);
+ } else if (y > 0 && x < width - 1 &&
+ GetPixelAt(x + 1, 0, width, unnoised_previous_row) == pixel) {
+ // same top-right pixel, copy.
+ CopyPixelValue(GetPixelAt(x + 1, y - 1, width, pixels), pixel);
+ } else if (x > 0 &&
+ GetPixelAt(x - 1, 0, width, unnoised_current_row) == pixel) {
+ // same left pixel, copy.
+ CopyPixelValue(GetPixelAt(x - 1, y, width, pixels), pixel);
+ } else {
+ // otherwise, noise the pixel.
+ HeliumNoiseHash hash_copy = token_hash;
+ hash_copy.Update(base::U32FromLittleEndian(pixel));
+ // GetRandomPixelLocations consumes at most 46 bits from hash.
+ const std::pair<PixelLocation, PixelLocation> other_pixels =
+ GetRandomPixelLocations(hash_copy, {x, y}, width, height);
+ hash_copy.Update(
+ GetValueFromPixelLocations(other_pixels, pixels, width));
+ // HeliumNoisePixel consumes 12 bits from hash
+ HeliumNoisePixel(pixel, hash_copy);
+ }
+ auto pixel = GetPixelAt(x, y, width, pixels);
+ CopyPixelValue(source_pixel, pixel);
+
+ HeliumNoiseHash hash_copy = token_hash;
+ hash_copy.Update((static_cast<uint64_t>(y) << 32) |
+ static_cast<uint32_t>(x));
+ hash_copy.Update(base::U32FromLittleEndian(source_pixel));
+ // GetRandomPixelLocations consumes at most 32 bits from hash.
+ const std::pair<PixelLocation, PixelLocation> other_pixels =
+ GetRandomPixelLocations(hash_copy, {x, y}, width, height);
+ hash_copy.Update(
+ GetValueFromPixelLocations(other_pixels, source_pixels, width));
+ HeliumNoisePixel(pixel, hash_copy);
+ }
+ // Previous can be overwritten (new current). Current is the now previous.
+ std::swap(unnoised_previous_row, unnoised_current_row);
+ }
+}
+
@@ -306,12 +325,12 @@
+ base::span<uint8_t> modify_pixels =
+ gfx::SkPixmapToWritableSpan(pixmap_to_noise);
+
+ auto token_hash = HeliumNoiseHash(
+ execution_context->GetHeliumNoiseTokens().at(
+ HeliumNoiseFeature::kCanvas));
+ auto token_hash =
+ HeliumNoiseHash(execution_context->GetHeliumNoiseTokens().at(
+ HeliumNoiseFeature::kCanvas));
+
+ HeliumNoisePixels(token_hash, modify_pixels, pixmap_to_noise.width(),
+ pixmap_to_noise.height());
+ pixmap_to_noise.height());
+
+ auto noised_image = bm.asImage();
+ snapshot = blink::UnacceleratedStaticBitmapImage::Create(
+1 -1
View File
@@ -737,7 +737,7 @@
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2190,6 +2190,8 @@ void AddPrivacyStrings(content::WebUIDat
@@ -2200,6 +2200,8 @@ void AddPrivacyStrings(content::WebUIDat
{"securityPageDescription", IDS_SETTINGS_SECURITY_DESCRIPTION},
{"heliumServicesTitle", IDS_SETTINGS_HELIUM_SERVICES},
{"heliumServicesDescription", IDS_SETTINGS_HELIUM_SERVICES_DESCRIPTION},
@@ -1,6 +1,6 @@
--- a/chrome/common/chrome_features.cc
+++ b/chrome/common/chrome_features.cc
@@ -1229,7 +1229,7 @@ BASE_FEATURE(kHttpsFirstBalancedMode, ba
@@ -1237,7 +1237,7 @@ BASE_FEATURE(kHttpsFirstBalancedMode, ba
// Automatically enables HTTPS-First Mode in a balanced configuration when
// possible.
BASE_FEATURE(kHttpsFirstBalancedModeAutoEnable,
@@ -201,7 +201,7 @@
</template>
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2201,6 +2201,10 @@ void AddPrivacyStrings(content::WebUIDat
@@ -2211,6 +2211,10 @@ void AddPrivacyStrings(content::WebUIDat
IDS_SETTINGS_HELIUM_SCHEMA_NOTICE_DESCRIPTION},
{"heliumGotIt", IDS_SETTINGS_GOT_IT},
{"heliumSchemaIgnore", IDS_SETTINGS_HELIUM_SCHEMA_IGNORE},
@@ -169,7 +169,7 @@
</message>
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -1267,7 +1267,7 @@ void AddLanguagesStrings(content::WebUID
@@ -1277,7 +1277,7 @@ void AddLanguagesStrings(content::WebUID
{"languagesDictionaryDownloadError",
IDS_SETTINGS_LANGUAGES_DICTIONARY_DOWNLOAD_FAILED},
{"languagesDictionaryDownloadErrorHelp",
@@ -178,7 +178,7 @@
#endif
#endif // !BUILDFLAG(IS_CHROMEOS)
#if BUILDFLAG(IS_CHROMEOS)
@@ -2208,6 +2208,9 @@ void AddPrivacyStrings(content::WebUIDat
@@ -2218,6 +2218,9 @@ void AddPrivacyStrings(content::WebUIDat
{"heliumBangsToggle", IDS_SETTINGS_HELIUM_SERVICES_BANGS_TOGGLE},
{"heliumBangsToggleDescription",
IDS_SETTINGS_HELIUM_SERVICES_BANGS_TOGGLE_DESCRIPTION},
@@ -16,7 +16,7 @@
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/hashprefix_realtime/hash_realtime_utils.h"
#include "components/saved_tab_groups/public/features.h"
@@ -2795,14 +2793,9 @@ void AddSearchStrings(content::WebUIData
@@ -2805,14 +2803,9 @@ void AddSearchStrings(content::WebUIData
html_source->AddString("searchExplanationLearnMoreURL",
chrome::kOmniboxLearnMoreURL);
+2 -2
View File
@@ -43,7 +43,7 @@
Google Advanced Protection Program
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2188,6 +2188,23 @@ void AddPrivacyStrings(content::WebUIDat
@@ -2198,6 +2198,23 @@ void AddPrivacyStrings(content::WebUIDat
{"siteSettingsSublabel", IDS_SETTINGS_PERMISSIONS_DESCRIPTION},
{"securityPageTitle", IDS_SETTINGS_SECURITY},
{"securityPageDescription", IDS_SETTINGS_SECURITY_DESCRIPTION},
@@ -753,7 +753,7 @@
+#endif // COMPONENTS_HELIUM_SERVICES_SCHEMA_H_
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -1301,6 +1301,8 @@ static_library("ui") {
@@ -1305,6 +1305,8 @@ static_library("ui") {
"webui/settings/search_engines_handler.h",
"webui/settings/security_settings_provider.cc",
"webui/settings/security_settings_provider.h",
+45 -32
View File
@@ -186,40 +186,52 @@
view_bounds_observer_.Observe(contents_view_);
}
@@ -162,130 +151,11 @@ std::vector<views::View*> ContentsContai
@@ -161,143 +150,9 @@ std::vector<views::View*> ContentsContai
void ContentsContainerView::UpdateBorderAndOverlay(bool is_in_split,
bool is_active,
bool is_highlighted) {
- bool is_highlighted) {
- const bool split_changed = is_in_split != is_in_split_;
- is_in_split_ = is_in_split;
-
- // The border, mini toolbar, and scrim should not be visible if not in a
- // split.
- if (!is_in_split) {
- SetBorder(nullptr);
- ClearBorderRoundedCorners();
- mini_toolbar_->SetVisible(false);
- container_outline_->SetVisible(false);
- if (split_changed) {
- SetBorder(nullptr);
- ClearBorderRoundedCorners();
-
- mini_toolbar_->SetVisible(false);
- container_outline_->SetVisible(false);
- if (capture_contents_border_widget_) {
- static_cast<ContentsCaptureBorderView*>(
- capture_contents_border_widget_->GetContentsView())
- ->SetIsInSplit(false);
- }
- }
- } else {
- if (split_changed) {
- SetBorder(views::CreateEmptyBorder(gfx::Insets(
- kSplitViewContentPadding + ContentsContainerOutline::kThickness)));
- UpdateBorderRoundedCorners();
- }
-
- container_outline_->UpdateState(is_active, is_highlighted);
- // Mini toolbar should only be visible for the inactive contents
- // container view or both depending on configuration.
- mini_toolbar_->UpdateState(is_active, is_highlighted);
- if (capture_contents_border_widget_) {
- static_cast<ContentsCaptureBorderView*>(
- capture_contents_border_widget_->GetContentsView())
- ->SetIsInSplit(false);
- ->SetIsInSplit(true);
- }
- return;
- }
-
- SetBorder(views::CreateEmptyBorder(gfx::Insets(
- kSplitViewContentPadding + ContentsContainerOutline::kThickness)));
- UpdateBorderRoundedCorners();
-
- container_outline_->UpdateState(is_active, is_highlighted);
- // Mini toolbar should only be visible for the inactive contents
- // container view or both depending on configuration.
- mini_toolbar_->UpdateState(is_active, is_highlighted);
- if (capture_contents_border_widget_) {
- static_cast<ContentsCaptureBorderView*>(
- capture_contents_border_widget_->GetContentsView())
- ->SetIsInSplit(true);
-#if BUILDFLAG(IS_CHROMEOS)
- if (split_changed) {
- // Ensures correct window rounded corners after updating contents rounded
- // corners in UpdateBorderRoundedCorners()/ClearBorderRoundedCorners().
- GetWidget()->non_client_view()->frame_view()->UpdateWindowRoundedCorners();
- }
-#endif // BUILDFLAG(IS_CHROMEOS)
-}
-
-void ContentsContainerView::UpdateBorderRoundedCorners() {
@@ -285,7 +297,8 @@
-
-void ContentsContainerView::ClearBorderRoundedCorners() {
- constexpr gfx::RoundedCornersF kNoRoundedCorners = gfx::RoundedCornersF{0};
-
+ bool is_highlighted) {}
- devtools_web_view_->holder()->SetCornerRadii(kNoRoundedCorners);
- devtools_scrim_view_->SetRoundedCorners(kNoRoundedCorners);
-
@@ -307,19 +320,19 @@
- glic_border_->SetRoundedCorners(kNoRoundedCorners);
- }
-#endif
+ SetBorder(nullptr);
}
void ContentsContainerView::ChildVisibilityChanged(View* child) {
-}
-
-void ContentsContainerView::ChildVisibilityChanged(View* child) {
- if ((child == new_tab_footer_view_ || child == devtools_web_view_) &&
- is_in_split_) {
- UpdateBorderRoundedCorners();
- }
+ return;
}
-}
+void ContentsContainerView::ChildVisibilityChanged(View* child) {}
void ContentsContainerView::Layout(PassKey pass_key) {
@@ -299,9 +169,6 @@ void ContentsContainerView::Layout(PassK
LayoutSuperclass<views::View>(this);
@@ -310,9 +165,6 @@ void ContentsContainerView::Layout(PassK
void ContentsContainerView::OnViewBoundsChanged(View* observed_view) {
if (observed_view == contents_view_) {
UpdateDevToolsDockedPlacement();
@@ -329,7 +342,7 @@
}
}
@@ -414,7 +281,7 @@ void ContentsContainerView::CreateCaptur
@@ -425,7 +277,7 @@ void ContentsContainerView::CreateCaptur
capture_contents_border_widget_->Init(std::move(params));
auto contents_capture_border_view =
@@ -338,7 +351,7 @@
capture_contents_border_widget_->SetContentsView(
std::move(contents_capture_border_view));
capture_contents_border_widget_->SetVisibilityChangedAnimationsEnabled(false);
@@ -568,30 +435,6 @@ views::ProposedLayout ContentsContainerV
@@ -579,30 +431,6 @@ views::ProposedLayout ContentsContainerV
non_devtools_contents_bounds, size_bounds);
}
@@ -246,7 +246,7 @@
</template>
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2215,6 +2215,10 @@ void AddPrivacyStrings(content::WebUIDat
@@ -2225,6 +2225,10 @@ void AddPrivacyStrings(content::WebUIDat
IDS_SETTINGS_HELIUM_SERVICES_UPDATE},
{"heliumUpdatesToggleDescription",
IDS_SETTINGS_HELIUM_SERVICES_UPDATE_DESCRIPTION},
@@ -25,7 +25,7 @@
location <= mojom::ManifestLocation::kMaxValue;
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -6215,7 +6215,8 @@ void AddChromeSchemeFactories(
@@ -6218,7 +6218,8 @@ void AddChromeSchemeFactories(
std::vector<std::string> allowed_webui_hosts;
// Support for chrome:// scheme if appropriate.
if ((extension->is_extension() || extension->is_platform_app()) &&
@@ -32,7 +32,7 @@
{"advancedPageTitle", IDS_SETTINGS_ADVANCED},
{"back", IDS_ACCNAME_BACK},
{"basicPageTitle", IDS_SETTINGS_BASIC},
@@ -2828,6 +2829,8 @@ void AddSearchEnginesStrings(content::We
@@ -2838,6 +2839,8 @@ void AddSearchEnginesStrings(content::We
IDS_SETTINGS_SEARCH_ENGINES_PAGE_EXPLANATION},
{"searchEnginesAddSiteSearch",
IDS_SETTINGS_SEARCH_ENGINES_ADD_SITE_SEARCH},
+1 -1
View File
@@ -11,7 +11,7 @@
{"loading", IDS_HISTORY_LOADING},
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2036,7 +2036,7 @@ void AddSyncControlsStrings(content::Web
@@ -2046,7 +2046,7 @@ void AddSyncControlsStrings(content::Web
void AddPeopleStrings(content::WebUIDataSource* html_source, Profile* profile) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
// Top level people strings:
@@ -22,7 +22,7 @@
</message>
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2183,7 +2183,7 @@ void AddPrivacyStrings(content::WebUIDat
@@ -2193,7 +2193,7 @@ void AddPrivacyStrings(content::WebUIDat
{"privacyPageMore", IDS_SETTINGS_PRIVACY_MORE},
{"doNotTrack", IDS_SETTINGS_ENABLE_DO_NOT_TRACK},
{"doNotTrackDialogTitle", IDS_SETTINGS_ENABLE_DO_NOT_TRACK_DIALOG_TITLE},
@@ -31,7 +31,7 @@
{"doNotTrackDialogLearnMoreA11yLabel",
IDS_SETTINGS_ENABLE_DO_NOT_TRACK_DIALOG_LEARN_MORE_ACCESSIBILITY_LABEL},
// TODO(crbug.com/40122957): This string is no longer used. Remove.
@@ -2946,7 +2946,7 @@ void AddSiteSettingsStrings(content::Web
@@ -2956,7 +2956,7 @@ void AddSiteSettingsStrings(content::Web
{"trackingProtectionSitesAllowedCookiesTitle",
IDS_SETTINGS_TRACKING_PROTECTION_SITES_ALLOWED_COOKIES_TITLE},
{"trackingProtectionSitesAllowedCookiesDescription",
@@ -15,7 +15,7 @@
</message>
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2188,9 +2188,9 @@ void AddPrivacyStrings(content::WebUIDat
@@ -2198,9 +2198,9 @@ void AddPrivacyStrings(content::WebUIDat
IDS_SETTINGS_ENABLE_DO_NOT_TRACK_DIALOG_LEARN_MORE_ACCESSIBILITY_LABEL},
// TODO(crbug.com/40122957): This string is no longer used. Remove.
{"permissionsPageTitle", IDS_SETTINGS_PERMISSIONS},
@@ -24,7 +24,7 @@
Signed in to <ph name="EMAIL">$1<ex>abcd@google.com</ex></ph>
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -1895,8 +1895,8 @@ void AddPersonalizationOptionsStrings(co
@@ -1905,8 +1905,8 @@ void AddPersonalizationOptionsStrings(co
{"enablePersonalizationLoggingDesc",
IDS_SETTINGS_ENABLE_LOGGING_PREF_DESC},
{"spellingDescription", IDS_SETTINGS_SPELLING_PREF_DESC},
+3 -3
View File
@@ -53,7 +53,9 @@
- @click="${this.onScrimClick_}"
- ?hidden="${!this.showScrim_}"></div>
- ` : ''}
- <div id="searchboxContainer">
- <div id="searchboxContainer"
- @focusin="${this.onSearchboxContainerFocusIn_}"
- @focusout="${this.onSearchboxContainerFocusOut_}">
- <cr-searchbox id="searchbox" ?is-dark="${this.isThemeDark_()}"
- placeholder-text="$i18n{searchBoxPlaceholder}"
- ?color-source-is-baseline="${this.colorSourceIsBaseline}"
@@ -69,7 +71,6 @@
- searchbox-layout-mode="${this.realboxLayoutMode_}"
- ?ntp-realbox-next-enabled="${this.ntpRealboxNextEnabled_}"
- ?cycling-placeholders="${this.searchboxCyclingPlaceholders_}"
- @searchbox-input-focus-changed="${this.onInputFocusChanged_}"
- context-menu-glif-animation-state="${this.contextMenuGlifAnimationState_}"
- ?multi-line-enabled="${this.multiLineEnabled_}">
- </cr-searchbox>
@@ -82,7 +83,6 @@
- ?disable-caret-color-animation="${true}"
- @composebox-initialized="${this.onComposeboxInitialized_}"
- @close-composebox="${this.closeComposebox_}"
- @composebox-input-focus-changed="${this.onInputFocusChanged_}"
- @context-menu-entrypoint-click="${this.onContextMenuEntrypointClick_}"
- @voice-search-action="${this.onComposeVoiceSearchAction_}"
- searchbox-layout-mode="${this.realboxLayoutMode_}">
+2 -2
View File
@@ -529,8 +529,8 @@
virtual bool ShouldDrawVerticalTabStrip() const = 0;
+ virtual bool ShouldDrawToolbarTabStrip() const = 0;
virtual bool IsVerticalTabStripCollapsed() const = 0;
virtual bool IsVerticalTabStripRightAligned() const = 0;
virtual bool ShouldDrawWebAppFrameToolbar() const = 0;
virtual bool GetBorderlessModeEnabled() const = 0;
--- a/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.cc
+++ b/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.cc
@@ -50,6 +50,10 @@ bool BrowserViewLayoutDelegateImpl::Shou
@@ -552,8 +552,8 @@
bool ShouldDrawVerticalTabStrip() const override;
+ bool ShouldDrawToolbarTabStrip() const override;
bool IsVerticalTabStripCollapsed() const override;
bool IsVerticalTabStripRightAligned() const override;
bool ShouldDrawWebAppFrameToolbar() const override;
bool GetBorderlessModeEnabled() const override;
--- a/chrome/browser/ui/views/frame/horizontal_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/horizontal_tab_strip_region_view.cc
@@ -15,6 +15,7 @@
+59 -12
View File
@@ -1,6 +1,6 @@
--- a/chrome/app/chrome_command_ids.h
+++ b/chrome/app/chrome_command_ids.h
@@ -94,15 +94,10 @@
@@ -94,15 +94,11 @@
// Helium commands
#define IDC_COPY_OR_INSPECT_SHORTCUT 34080
@@ -17,12 +17,13 @@
+#define IDC_BROWSER_LAYOUT_HORIZONTAL 34082
+#define IDC_BROWSER_LAYOUT_COMPACT 34083
+#define IDC_BROWSER_LAYOUT_VERTICAL 34084
+#define IDC_BROWSER_LAYOUT_VERTICAL_RIGHT 34085
// Tab group Commands
#define IDC_ADD_NEW_TAB_TO_GROUP 34100
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -10383,6 +10383,39 @@ Keep your key file in a safe place. You
@@ -10383,6 +10383,45 @@ Keep your key file in a safe place. You
Create split view
</message>
@@ -41,6 +42,9 @@
+ <message name="IDS_BROWSER_LAYOUT_VERTICAL" desc="In Title Case: Option for vertical layout.">
+ Vertical (Experimental)
+ </message>
+ <message name="IDS_BROWSER_LAYOUT_VERTICAL_RIGHT" desc="In Title Case: Option to move vertical tabs to the right side.">
+ Tabs on Right Side
+ </message>
+ </then>
+ <else>
+ <message name="IDS_BROWSER_LAYOUT_MENU" desc="The submenu for browser layout options.">
@@ -55,6 +59,9 @@
+ <message name="IDS_BROWSER_LAYOUT_VERTICAL" desc="Option for vertical layout.">
+ Vertical (experimental)
+ </message>
+ <message name="IDS_BROWSER_LAYOUT_VERTICAL_RIGHT" desc="Option to move vertical tabs to the right side.">
+ Tabs on right side
+ </message>
+ </else>
+ </if>
+ <!-- /Helium Browser Layout Strings -->
@@ -72,11 +79,12 @@
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_user_gesture_details.h"
@@ -260,6 +261,7 @@ void ShowTabSearch(BrowserWindowInterfac
@@ -260,6 +261,8 @@ void ShowTabSearch(BrowserWindowInterfac
void CloseTabSearch(Browser* browser);
void ToggleContextualTasksSidePanel(BrowserWindowInterface* browser);
void ToggleVerticalTabs(Browser* browser);
+void SetBrowserLayout(Browser* browser, HeliumLayoutType layout);
+void ToggleVerticalTabStripRightAligned(Browser* browser);
void ShowTabDeclutter(Browser* browser);
bool CanCloseFind(Browser* browser);
void CloseFind(Browser* browser);
@@ -90,15 +98,24 @@
#include "chrome/browser/ui/intent_picker_tab_helper.h"
#include "chrome/browser/ui/lens/lens_search_controller.h"
#include "chrome/browser/ui/location_bar/location_bar.h"
@@ -2225,6 +2226,14 @@ void ToggleVerticalTabs(Browser* browser
@@ -2225,6 +2226,23 @@ void ToggleVerticalTabs(Browser* browser
controller->SetVerticalTabsEnabled(!initial_tab_orientation);
}
+void SetBrowserLayout(Browser* browser, HeliumLayoutType layout) {
+ auto* toolbar_controller =
+ auto* controller =
+ HeliumLayoutStateController::From(browser);
+ if (toolbar_controller) {
+ toolbar_controller->SetBrowserLayout(layout);
+ if (controller) {
+ controller->SetBrowserLayout(layout);
+ }
+}
+
+void ToggleVerticalTabStripRightAligned(Browser* browser) {
+ auto* controller =
+ tabs::VerticalTabStripStateController::From(browser);
+ if (controller) {
+ controller->SetTabStripRightAligned(
+ !controller->IsTabStripRightAligned());
+ }
+}
+
@@ -107,7 +124,7 @@
tab_search::mojom::TabSearchSection::kOrganize,
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -588,6 +588,15 @@ bool BrowserCommandController::ExecuteCo
@@ -588,6 +588,18 @@ bool BrowserCommandController::ExecuteCo
case IDC_TOGGLE_VERTICAL_TABS:
ToggleVerticalTabs(browser_);
break;
@@ -119,11 +136,14 @@
+ break;
+ case IDC_BROWSER_LAYOUT_VERTICAL:
+ SetBrowserLayout(browser_, HeliumLayoutType::kVertical);
+ break;
+ case IDC_BROWSER_LAYOUT_VERTICAL_RIGHT:
+ ToggleVerticalTabStripRightAligned(browser_);
+ break;
// Window management commands
case IDC_NEW_WINDOW:
@@ -1498,6 +1507,12 @@ void BrowserCommandController::InitComma
@@ -1498,6 +1510,14 @@ void BrowserCommandController::InitComma
command_updater_.UpdateCommandEnabled(IDC_ORGANIZE_TABS, true);
command_updater_.UpdateCommandEnabled(IDC_DECLUTTER_TABS, true);
command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, true);
@@ -133,6 +153,8 @@
+ command_updater_.UpdateCommandEnabled(IDC_BROWSER_LAYOUT_HORIZONTAL, true);
+ command_updater_.UpdateCommandEnabled(IDC_BROWSER_LAYOUT_COMPACT, true);
+ command_updater_.UpdateCommandEnabled(IDC_BROWSER_LAYOUT_VERTICAL, true);
+ command_updater_.UpdateCommandEnabled(IDC_BROWSER_LAYOUT_VERTICAL_RIGHT,
+ true);
#if BUILDFLAG(IS_CHROMEOS)
command_updater_.UpdateCommandEnabled(IDC_TOGGLE_MULTITASK_MENU, true);
command_updater_.UpdateCommandEnabled(IDC_MINIMIZE_WINDOW, true);
@@ -166,7 +188,7 @@
SystemMenuModelBuilder::SystemMenuModelBuilder(
ui::AcceleratorProvider* provider,
Browser* browser)
@@ -100,6 +96,21 @@ void SystemMenuModelBuilder::BuildSystem
@@ -100,6 +96,25 @@ void SystemMenuModelBuilder::BuildSystem
if (!browser()->profile()->IsOffTheRecord()) {
model->AddSeparator(ui::NORMAL_SEPARATOR);
@@ -180,6 +202,10 @@
+ IDC_BROWSER_LAYOUT_COMPACT, IDS_BROWSER_LAYOUT_COMPACT);
+ browser_layout_menu_contents_->AddCheckItemWithStringId(
+ IDC_BROWSER_LAYOUT_VERTICAL, IDS_BROWSER_LAYOUT_VERTICAL);
+ browser_layout_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
+ browser_layout_menu_contents_->AddCheckItemWithStringId(
+ IDC_BROWSER_LAYOUT_VERTICAL_RIGHT,
+ IDS_BROWSER_LAYOUT_VERTICAL_RIGHT);
+
+ model->AddSubMenuWithStringId(IDC_BROWSER_LAYOUT_MENU,
+ IDS_BROWSER_LAYOUT_MENU,
@@ -188,7 +214,7 @@
model->AddItemWithStringId(IDC_SHOW_CUSTOMIZE_CHROME_SIDE_PANEL,
IDS_SHOW_CUSTOMIZE_CHROME_SIDE_PANEL);
}
@@ -116,20 +127,6 @@ void SystemMenuModelBuilder::BuildSystem
@@ -116,20 +131,6 @@ void SystemMenuModelBuilder::BuildSystem
#endif // BUILDFLAG(IS_WIN)
#endif // BUILDFLAG(ENABLE_GLIC)
@@ -219,7 +245,7 @@
#include "chrome/browser/ui/tabs/vertical_tab_strip_state_controller.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
@@ -47,6 +48,25 @@ bool SystemMenuModelDelegate::IsCommandI
@@ -47,6 +48,32 @@ bool SystemMenuModelDelegate::IsCommandI
return !prefs->GetBoolean(prefs::kUseCustomChromeFrame);
}
#endif
@@ -241,7 +267,28 @@
+ }
+ }
+ }
+
+ if (command_id == IDC_BROWSER_LAYOUT_VERTICAL_RIGHT) {
+ auto* vertical_tab_controller =
+ tabs::VerticalTabStripStateController::From(browser_);
+ return vertical_tab_controller &&
+ vertical_tab_controller->IsTabStripRightAligned();
+ }
+
return false;
}
@@ -85,6 +112,13 @@ bool SystemMenuModelDelegate::IsCommandI
return glic::GlicEnabling::IsEnabledForProfile(browser_->profile());
}
#endif
+
+ if (command_id == IDC_BROWSER_LAYOUT_VERTICAL_RIGHT) {
+ auto* layout_controller = HeliumLayoutStateController::From(browser_);
+ return layout_controller &&
+ layout_controller->GetBrowserLayout() == HeliumLayoutType::kVertical;
+ }
+
return true;
}
+420 -11
View File
@@ -53,15 +53,17 @@
}
--- a/chrome/browser/ui/tabs/tab_strip_prefs.cc
+++ b/chrome/browser/ui/tabs/tab_strip_prefs.cc
@@ -5,6 +5,7 @@
@@ -5,7 +5,9 @@
#include "chrome/browser/ui/tabs/tab_strip_prefs.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/helium/helium_layout_state_controller.h"
#include "chrome/browser/ui/tabs/features.h"
+#include "chrome/browser/ui/tabs/vertical_tab_strip_state.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/common/chrome_features.h"
@@ -31,14 +32,16 @@ bool GetDefaultTabSearchRightAligned() {
#include "chrome/common/pref_names.h"
@@ -31,14 +33,23 @@ bool GetDefaultTabSearchRightAligned() {
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(prefs::kTabSearchRightAligned,
GetDefaultTabSearchRightAligned());
@@ -71,6 +73,13 @@
+ prefs::kHeliumLayout,
+ std::to_underlying(HeliumLayoutType::kHorizontal),
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
+ registry->RegisterBooleanPref(prefs::kHeliumVerticalRightAligned,
+ false);
+ registry->RegisterBooleanPref(prefs::kHeliumVerticalCollapsed,
+ false);
+ registry->RegisterIntegerPref(
+ prefs::kHeliumVerticalUncollapsedWidth,
+ kVerticalTabStripDefaultUncollapsedWidth);
}
TabSearchPosition GetTabSearchPosition(const Profile* profile) {
@@ -81,26 +90,184 @@
return TabSearchPosition::kVerticalTabstrip;
}
--- a/chrome/browser/ui/tabs/vertical_tab_strip_state_controller.h
+++ b/chrome/browser/ui/tabs/vertical_tab_strip_state_controller.h
@@ -7,15 +7,11 @@
#include "base/callback_list.h"
#include "base/memory/raw_ptr.h"
-#include "base/scoped_observation.h"
-#include "chrome/browser/sessions/session_service_base_observer.h"
-#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/tabs/vertical_tab_strip_state.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/sessions/core/session_id.h"
#include "ui/base/unowned_user_data/scoped_unowned_user_data.h"
-class BrowserList;
class BrowserWindowInterface;
class PrefService;
class SessionService;
@@ -26,8 +22,7 @@ class ActionItem;
namespace tabs {
-class VerticalTabStripStateController : public SessionServiceBaseObserver,
- public BrowserListObserver {
+class VerticalTabStripStateController {
public:
DECLARE_USER_DATA(VerticalTabStripStateController);
@@ -43,13 +38,15 @@ class VerticalTabStripStateController :
delete;
VerticalTabStripStateController& operator=(
const VerticalTabStripStateController&) = delete;
- ~VerticalTabStripStateController() override;
+ ~VerticalTabStripStateController();
static VerticalTabStripStateController* From(
BrowserWindowInterface* browser_window);
bool ShouldDisplayVerticalTabs() const;
void SetVerticalTabsEnabled(bool enabled);
+ bool IsTabStripRightAligned() const;
+ void SetTabStripRightAligned(bool right_aligned);
bool IsCollapsed() const;
void SetCollapsed(bool collapsed);
@@ -65,40 +62,24 @@ class VerticalTabStripStateController :
base::CallbackListSubscription RegisterOnStateChanged(
StateChangedCallback callback);
- static constexpr char kCollapsedKey[] = "vertical_tab_strip_collapsed";
- static constexpr char kUncollapsedWidthKey[] =
- "vertical_tab_strip_uncollapsed_width";
-
private:
void NotifyStateChanged();
- // Updates the SessionService with the current state (collapsed status and
- // uncollapsed width) for the associated session ID.
- void UpdateSessionService();
+ // Updates pref-backed state (collapsed status and uncollapsed width).
+ void UpdatePrefs();
// Update the Collapse Button's Action Item (kActionToggleCollapseVertical)
// based on the Vertical Tab Strip's Collapse State.
void UpdateCollapseActionItem();
- // SessionServiceBase::SessionServiceBaseObserver:
- void OnDestroying(SessionServiceBase* service) override;
-
- // BrowserListObserver:
- void OnBrowserAdded(Browser* browser) override;
-
const raw_ptr<PrefService> pref_service_;
PrefChangeRegistrar pref_change_registrar_;
raw_ptr<actions::ActionItem> root_action_item_;
- raw_ptr<SessionService> session_service_;
- const SessionID session_id_;
- raw_ptr<BrowserWindowInterface> browser_window_;
VerticalTabStripState state_;
base::RepeatingCallbackList<void(VerticalTabStripStateController*)>
on_state_changed_callback_list_;
- base::ScopedObservation<BrowserList, BrowserListObserver>
- browser_list_observation_{this};
ui::ScopedUnownedUserData<VerticalTabStripStateController>
scoped_unowned_user_data_;
};
--- a/chrome/browser/ui/tabs/vertical_tab_strip_state_controller.cc
+++ b/chrome/browser/ui/tabs/vertical_tab_strip_state_controller.cc
@@ -15,6 +15,7 @@
@@ -6,15 +6,11 @@
#include <optional>
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/to_string.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/sessions/session_service.h"
-#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/ui/actions/chrome_action_id.h"
#include "chrome/browser/ui/browser_actions.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window/public/browser_window_interface.h"
+#include "chrome/browser/ui/helium/helium_layout_state_controller.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_notifier_impl.h"
@@ -46,7 +47,7 @@ VerticalTabStripStateController::Vertica
@@ -32,58 +28,31 @@ VerticalTabStripStateController::Vertica
BrowserWindowInterface* browser_window,
PrefService* pref_service,
actions::ActionItem* root_action_item,
- SessionService* session_service,
- SessionID session_id,
- std::optional<bool> restored_state_collapsed,
- std::optional<int> restored_state_uncollapsed_width)
+ SessionService* /*session_service*/,
+ SessionID /*session_id*/,
+ std::optional<bool> /*restored_state_collapsed*/,
+ std::optional<int> /*restored_state_uncollapsed_width*/)
: pref_service_(pref_service),
root_action_item_(root_action_item),
- session_service_(session_service),
- session_id_(session_id),
- browser_window_(browser_window),
scoped_unowned_user_data_(browser_window->GetUnownedUserDataHost(),
*this) {
pref_change_registrar_.Init(pref_service_);
pref_change_registrar_.Add(
- pref_change_registrar_.Add(
- prefs::kVerticalTabsEnabled,
+ prefs::kHeliumLayout,
+ pref_change_registrar_.AddMultiple(
+ {prefs::kHeliumLayout, prefs::kHeliumVerticalRightAligned},
base::BindRepeating(&VerticalTabStripStateController::NotifyStateChanged,
base::Unretained(this)));
@@ -92,11 +93,14 @@ VerticalTabStripStateController* Vertica
- if (restored_state_collapsed.has_value()) {
- SetCollapsed(restored_state_collapsed.value());
- }
- if (restored_state_uncollapsed_width.has_value()) {
- SetUncollapsedWidth(restored_state_uncollapsed_width.value());
- }
+ state_.collapsed =
+ pref_service_->GetBoolean(prefs::kHeliumVerticalCollapsed);
+ state_.uncollapsed_width = pref_service_->GetInteger(
+ prefs::kHeliumVerticalUncollapsedWidth);
UpdateCollapseActionItem();
-
- if (session_service_) {
- session_service_->AddObserver(this);
-
- bool is_browser_ready = false;
- for (Browser* browser : *BrowserList::GetInstance()) {
- if (browser->session_id() == session_id_) {
- is_browser_ready = true;
- break;
- }
- }
-
- if (!is_browser_ready) {
- browser_list_observation_.Observe(BrowserList::GetInstance());
- }
- }
-
// TODO(crbug.com/455559992): Add uncollapsed text logic for collapse button.
}
-VerticalTabStripStateController::~VerticalTabStripStateController() {
- if (session_service_) {
- session_service_->RemoveObserver(this);
- session_service_ = nullptr;
- }
-}
+VerticalTabStripStateController::~VerticalTabStripStateController() = default;
// static
VerticalTabStripStateController* VerticalTabStripStateController::From(
@@ -92,11 +61,24 @@ VerticalTabStripStateController* Vertica
}
bool VerticalTabStripStateController::ShouldDisplayVerticalTabs() const {
@@ -114,22 +281,98 @@
+ HeliumLayoutType layout = enabled ? HeliumLayoutType::kVertical
+ : HeliumLayoutType::kHorizontal;
+ pref_service_->SetInteger(prefs::kHeliumLayout, std::to_underlying(layout));
+}
+
+bool VerticalTabStripStateController::IsTabStripRightAligned() const {
+ return pref_service_->GetBoolean(prefs::kHeliumVerticalRightAligned);
+}
+
+void VerticalTabStripStateController::SetTabStripRightAligned(
+ bool right_aligned) {
+ pref_service_->SetBoolean(prefs::kHeliumVerticalRightAligned,
+ right_aligned);
}
bool VerticalTabStripStateController::IsCollapsed() const {
@@ -137,24 +119,23 @@ VerticalTabStripStateController::Registe
}
void VerticalTabStripStateController::NotifyStateChanged() {
- UpdateSessionService();
+ UpdatePrefs();
UpdateCollapseActionItem();
on_state_changed_callback_list_.Notify(this);
}
-void VerticalTabStripStateController::UpdateSessionService() {
- if (session_service_ && !browser_list_observation_.IsObserving()) {
- session_service_->AddWindowExtraData(session_id_, kCollapsedKey,
- base::ToString(state_.collapsed));
- session_service_->AddWindowExtraData(
- session_id_, kUncollapsedWidthKey,
- base::NumberToString(state_.uncollapsed_width));
- }
+void VerticalTabStripStateController::UpdatePrefs() {
+ pref_service_->SetBoolean(prefs::kHeliumVerticalCollapsed,
+ state_.collapsed);
+ pref_service_->SetInteger(prefs::kHeliumVerticalUncollapsedWidth,
+ state_.uncollapsed_width);
}
void VerticalTabStripStateController::UpdateCollapseActionItem() {
+ // In right-aligned mode, the directional icon has to be flipped.
const gfx::VectorIcon& icon =
- IsCollapsed() ? views::kMenuCloseIcon : views::kMenuOpenIcon;
+ IsCollapsed() == IsTabStripRightAligned() ? views::kMenuOpenIcon
+ : views::kMenuCloseIcon;
const auto& text =
IsCollapsed() ? IDS_EXPAND_VERTICAL_TABS : IDS_COLLAPSE_VERTICAL_TABS;
@@ -171,19 +152,4 @@ void VerticalTabStripStateController::Up
}
}
-void VerticalTabStripStateController::OnDestroying(
- SessionServiceBase* service) {
- if (service == session_service_) {
- session_service_->RemoveObserver(this);
- session_service_ = nullptr;
- }
-}
-
-void VerticalTabStripStateController::OnBrowserAdded(Browser* browser) {
- if (browser == browser_window_->GetBrowserForMigrationOnly()) {
- browser_list_observation_.Reset();
- UpdateSessionService();
- }
-}
-
} // namespace tabs
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -1313,6 +1313,9 @@ inline constexpr char kNewTabNextToActiv
@@ -1313,6 +1313,21 @@ inline constexpr char kNewTabNextToActiv
// cycling through tabs with Ctrl+Tab.
inline constexpr char kTabCyclingMRU[] = "helium.browser.mru_tab_cycling";
+// An enum (HeliumLayoutType) pref that controls the browser layout.
+inline constexpr char kHeliumLayout[] = "helium.browser.layout";
+
+// A boolean pref set to true if vertical tabs should be on the right side.
+inline constexpr char kHeliumVerticalRightAligned[] =
+ "helium.browser.vertical_right_aligned";
+
+// A boolean pref set to true if vertical tabs are collapsed.
+inline constexpr char kHeliumVerticalCollapsed[] =
+ "helium.browser.vertical_collapsed";
+
+// An integer pref that stores the vertical tab strip width.
+inline constexpr char kHeliumVerticalUncollapsedWidth[] =
+ "helium.browser.vertical_uncollapsed_width";
+
// A boolean pref set to true if a Home button to open the Home pages should be
// visible on the toolbar.
inline constexpr char kShowHomeButton[] = "browser.show_home_button";
@@ -1989,9 +1992,6 @@ inline constexpr char kGoogleSearchSideP
@@ -1989,9 +2004,6 @@ inline constexpr char kGoogleSearchSideP
// True when the tab search button is on the right side of the tab strip even in
// RTL.
inline constexpr char kTabSearchRightAligned[] = "tab_search.is_right_aligned";
@@ -295,7 +538,7 @@
class HistoryClustersSidePanelCoordinator;
class HistorySidePanelCoordinator;
class IncognitoClearBrowsingDataDialogCoordinator;
@@ -573,6 +574,9 @@ class BrowserWindowFeatures {
@@ -568,6 +569,9 @@ class BrowserWindowFeatures {
std::unique_ptr<tabs::TabDeclutterController> tab_declutter_controller_;
@@ -327,3 +570,169 @@
if (tabs::IsVerticalTabsFeatureEnabled()) {
const std::optional<bool>& restored_state_collapsed =
browser->GetBrowserForMigrationOnly()
--- a/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate.h
+++ b/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate.h
@@ -31,6 +31,7 @@ class BrowserViewLayoutDelegate {
virtual bool ShouldUseTouchableTabstrip() const = 0;
virtual bool ShouldDrawVerticalTabStrip() const = 0;
virtual bool IsVerticalTabStripCollapsed() const = 0;
+ virtual bool IsVerticalTabStripRightAligned() const = 0;
virtual bool ShouldDrawWebAppFrameToolbar() const = 0;
virtual bool GetBorderlessModeEnabled() const = 0;
virtual gfx::Rect GetBoundsForTabStripRegionInBrowserView() const = 0;
--- a/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.cc
+++ b/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.cc
@@ -54,6 +54,12 @@ bool BrowserViewLayoutDelegateImpl::IsVe
return browser_view_->IsVerticalTabStripCollapsed();
}
+bool BrowserViewLayoutDelegateImpl::IsVerticalTabStripRightAligned() const {
+ auto* controller =
+ tabs::VerticalTabStripStateController::From(browser_view_->browser());
+ return controller && controller->IsTabStripRightAligned();
+}
+
bool BrowserViewLayoutDelegateImpl::ShouldDrawWebAppFrameToolbar() const {
return !GetBorderlessModeEnabled() &&
GetFrameView()->ShouldShowWebAppFrameToolbar();
--- a/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.h
+++ b/chrome/browser/ui/views/frame/layout/browser_view_layout_delegate_impl.h
@@ -24,6 +24,7 @@ class BrowserViewLayoutDelegateImpl : pu
bool ShouldUseTouchableTabstrip() const override;
bool ShouldDrawVerticalTabStrip() const override;
bool IsVerticalTabStripCollapsed() const override;
+ bool IsVerticalTabStripRightAligned() const override;
bool ShouldDrawWebAppFrameToolbar() const override;
bool GetBorderlessModeEnabled() const override;
gfx::Rect GetBoundsForTabStripRegionInBrowserView() const override;
--- a/chrome/browser/ui/browser_live_tab_context.cc
+++ b/chrome/browser/ui/browser_live_tab_context.cc
@@ -12,8 +12,6 @@
#include "base/check_deref.h"
#include "base/feature_list.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/to_string.h"
#include "base/token.h"
#include "base/uuid.h"
#include "base/values.h"
@@ -32,12 +30,10 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/browser_window/public/browser_window_features.h"
#include "chrome/browser/ui/browser_window/public/browser_window_interface.h"
-#include "chrome/browser/ui/tabs/features.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_utils.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/tab_group_action_context_desktop.h"
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/browser/ui/tabs/vertical_tab_strip_state_controller.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/common/buildflags.h"
@@ -167,18 +163,7 @@ std::map<std::string, std::string> Brows
std::map<std::string, std::string>
BrowserLiveTabContext::GetExtraDataForWindow() const {
- std::map<std::string, std::string> data;
-
- auto* controller =
- tabs::VerticalTabStripStateController::From(&browser_.get());
- if (controller) {
- data[tabs::VerticalTabStripStateController::kCollapsedKey] =
- base::ToString(controller->IsCollapsed());
- data[tabs::VerticalTabStripStateController::kUncollapsedWidthKey] =
- base::NumberToString(controller->GetUncollapsedWidth());
- }
-
- return data;
+ return std::map<std::string, std::string>();
}
std::optional<tab_groups::TabGroupId> BrowserLiveTabContext::GetTabGroupForTab(
@@ -402,7 +387,7 @@ sessions::LiveTabContext* BrowserLiveTab
ui::mojom::WindowShowState show_state,
const std::string& workspace,
const std::string& user_title,
- const std::map<std::string, std::string>& extra_data) {
+ const std::map<std::string, std::string>& /*extra_data*/) {
std::unique_ptr<Browser::CreateParams> create_params;
if (ShouldCreateAppWindowForAppName(profile, app_name)) {
// Only trusted app popup windows should ever be restored.
@@ -427,26 +412,6 @@ sessions::LiveTabContext* BrowserLiveTab
create_params->initial_workspace = workspace;
create_params->user_title = user_title;
- if (tabs::IsVerticalTabsFeatureEnabled()) {
- if (extra_data.contains(
- tabs::VerticalTabStripStateController::kCollapsedKey)) {
- create_params->vertical_tab_strip_collapsed =
- extra_data.at(tabs::VerticalTabStripStateController::kCollapsedKey) ==
- "true";
- }
-
- if (extra_data.contains(
- tabs::VerticalTabStripStateController::kUncollapsedWidthKey)) {
- int uncollapsed_width = 0;
- if (base::StringToInt(
- extra_data.at(
- tabs::VerticalTabStripStateController::kUncollapsedWidthKey),
- &uncollapsed_width)) {
- create_params->vertical_tab_strip_uncollapsed_width = uncollapsed_width;
- }
- }
- }
-
Browser* browser = Browser::Create(*create_params.get());
return browser->GetFeatures().live_tab_context();
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -65,12 +65,10 @@
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/startup/startup_tab.h"
#include "chrome/browser/ui/startup/startup_types.h"
-#include "chrome/browser/ui/tabs/features.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_utils.h"
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_user_gesture_details.h"
-#include "chrome/browser/ui/tabs/vertical_tab_strip_state_controller.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/waap/initial_webui_window_metrics_manager.h"
#include "chrome/browser/ui/webui/whats_new/whats_new_util.h"
@@ -1135,7 +1133,7 @@ class SessionRestoreImpl : public Browse
ui::mojom::WindowShowState show_state,
const std::string& app_name,
const std::string& user_title,
- const std::map<std::string, std::string>& extra_data,
+ const std::map<std::string, std::string>& /*extra_data*/,
int32_t restore_id) {
Browser::CreateParams params(type, profile_, false);
params.initial_bounds = bounds;
@@ -1161,26 +1159,6 @@ class SessionRestoreImpl : public Browse
params.initial_visible_on_all_workspaces_state = visible_on_all_workspaces;
params.creation_source = Browser::CreationSource::kSessionRestore;
- if (tabs::IsVerticalTabsFeatureEnabled()) {
- if (extra_data.contains(
- tabs::VerticalTabStripStateController::kCollapsedKey)) {
- params.vertical_tab_strip_collapsed =
- extra_data.at(
- tabs::VerticalTabStripStateController::kCollapsedKey) == "true";
- }
-
- if (extra_data.contains(
- tabs::VerticalTabStripStateController::kUncollapsedWidthKey)) {
- int uncollapsed_width = 0;
- if (base::StringToInt(
- extra_data.at(tabs::VerticalTabStripStateController::
- kUncollapsedWidthKey),
- &uncollapsed_width)) {
- params.vertical_tab_strip_uncollapsed_width = uncollapsed_width;
- }
- }
- }
-
base::TimeTicks now = base::TimeTicks::Now();
Browser* browser = Browser::Create(params);
if (auto* manager = InitialWebUIWindowMetricsManager::From(browser)) {
+31 -6
View File
@@ -1,17 +1,19 @@
--- a/chrome/browser/extensions/api/settings_private/prefs_util.cc
+++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -180,6 +180,10 @@ const PrefsUtil::TypedPrefMap& PrefsUtil
@@ -180,6 +180,12 @@ const PrefsUtil::TypedPrefMap& PrefsUtil
}
s_allowlist = new PrefsUtil::TypedPrefMap();
+ // Helium layout
+ (*s_allowlist)[::prefs::kHeliumLayout] =
+ settings_api::PrefType::kNumber;
+ (*s_allowlist)[::prefs::kHeliumVerticalRightAligned] =
+ settings_api::PrefType::kBoolean;
+
// Miscellaneous
(*s_allowlist)[::embedder_support::kAlternateErrorPagesEnabled] =
settings_api::PrefType::kBoolean;
@@ -215,8 +219,6 @@ const PrefsUtil::TypedPrefMap& PrefsUtil
@@ -215,8 +221,6 @@ const PrefsUtil::TypedPrefMap& PrefsUtil
settings_api::PrefType::kBoolean;
(*s_allowlist)[::prefs::kSidePanelHorizontalAlignment] =
settings_api::PrefType::kBoolean;
@@ -22,7 +24,7 @@
(*s_allowlist)[tab_groups::prefs::kAutoPinNewTabGroups] =
--- a/chrome/app/settings_strings.grdp
+++ b/chrome/app/settings_strings.grdp
@@ -276,6 +276,18 @@
@@ -276,6 +276,21 @@
<message name="IDS_SETTINGS_CYCLE_TABS_IN_MRU_ORDER" desc="Label for the checkbox which enables or disables cycling through tabs in MRU order when using Ctrl+Tab.">
Cycle through tabs in most recently used order with Ctrl+Tab
</message>
@@ -37,13 +39,16 @@
+ </message>
+ <message name="IDS_SETTINGS_BROWSER_LAYOUT_VERTICAL" desc="Vertical option in the browser layout dropdown.">
+ Vertical (experimental)
+ </message>
+ <message name="IDS_SETTINGS_TAB_STRIP_RIGHT_ALIGN" desc="Label for the toggle that displays vertical tabs on the right side of the browser window.">
+ Show vertical tabs on right side
+ </message>
<message name="IDS_SETTINGS_SHOW_HOME_BUTTON" desc="Label for the checkbox which enables or disables showing the home button in the toolbar.">
Show home button
</message>
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -525,6 +525,10 @@ void AddAppearanceStrings(content::WebUI
@@ -525,6 +525,11 @@ void AddAppearanceStrings(content::WebUI
{"systemMode", IDS_NTP_CUSTOMIZE_CHROME_COLOR_SCHEME_MODE_SYSTEM_LABEL},
{"openNewTabNextToActive", IDS_SETTINGS_NEW_TAB_NEXT_TO_ACTIVE_BUTTON},
{"cycleTabsInMRUOrder", IDS_SETTINGS_CYCLE_TABS_IN_MRU_ORDER},
@@ -51,6 +56,7 @@
+ {"browserLayoutHorizontal", IDS_SETTINGS_BROWSER_LAYOUT_HORIZONTAL},
+ {"browserLayoutCompact", IDS_SETTINGS_BROWSER_LAYOUT_COMPACT},
+ {"browserLayoutVertical", IDS_SETTINGS_BROWSER_LAYOUT_VERTICAL},
+ {"tabStripRightAlign", IDS_SETTINGS_TAB_STRIP_RIGHT_ALIGN},
{"showHomeButton", IDS_SETTINGS_SHOW_HOME_BUTTON},
{"showBookmarksBar", IDS_SETTINGS_SHOW_BOOKMARKS_BAR},
{"tabStripPosition", IDS_SETTINGS_TAB_STRIP_POSITION},
@@ -108,9 +114,20 @@
declare private tabSearchOptions_: DropdownMenuOptionList;
private appearanceBrowserProxy_: AppearanceBrowserProxy =
AppearanceBrowserProxyImpl.getInstance();
@@ -458,6 +470,10 @@ export class SettingsAppearancePageEleme
}
// </if>
+ private showVerticalRightAlignSetting_(layout: number|undefined): boolean {
+ return this.showVerticalTabsEnabled_ && layout === BrowserLayout.VERTICAL;
+ }
+
private themeChanged_(themeId: string) {
if (this.prefs === undefined || this.systemTheme_ === undefined) {
return;
--- a/chrome/browser/resources/settings/appearance_page/appearance_page.html
+++ b/chrome/browser/resources/settings/appearance_page/appearance_page.html
@@ -96,6 +96,18 @@
@@ -96,6 +96,26 @@
</cr-button>
</template>
</div>
@@ -125,11 +142,19 @@
+ menu-options="[[browserLayoutOptions_]]">
+ </settings-dropdown-menu>
+ </div>
+ <div class="list-frame hover-card-toggles">
+ <settings-toggle-button
+ hidden="[[!showVerticalRightAlignSetting_(
+ prefs.helium.browser.layout.value)]]"
+ pref="{{prefs.helium.browser.vertical_right_aligned}}"
+ label="$i18n{tabStripRightAlign}">
+ </settings-toggle-button>
+ </div>
+
<div
class="hr"
hidden="[[!showHr_(
@@ -151,19 +163,6 @@
@@ -151,19 +171,6 @@
label="$i18n{showBookmarksBar}">
</settings-toggle-button>
+312 -45
View File
@@ -29,13 +29,132 @@
}
--- a/chrome/browser/ui/views/frame/layout/browser_view_tabbed_layout_impl.cc
+++ b/chrome/browser/ui/views/frame/layout/browser_view_tabbed_layout_impl.cc
@@ -652,10 +652,12 @@ BrowserViewTabbedLayoutImpl::CalculatePr
? std::max(0, base::ClampCeil(browser_params.leading_exclusion
.ContentWithPadding()
.width()) -
@@ -173,13 +173,17 @@ int BrowserViewTabbedLayoutImpl::GetColl
return 0;
}
- // If there is no leading exclusion, the tabstrip goes all the way to the top.
- if (params.leading_exclusion.IsEmpty()) {
+ const auto& exclusion_area = delegate().IsVerticalTabStripRightAligned()
+ ? params.trailing_exclusion
+ : params.leading_exclusion;
+
+ // If there is no side exclusion, the tabstrip goes all the way to the top.
+ if (exclusion_area.IsEmpty()) {
return 0;
}
const int exclusion_height =
- base::ClampCeil(params.leading_exclusion.ContentWithPadding().height());
+ base::ClampCeil(exclusion_area.ContentWithPadding().height());
// Try to align with toolbar. But if it's not visible, then don't.
if (!delegate().IsToolbarVisible()) {
@@ -248,6 +252,8 @@ BrowserViewTabbedLayoutImpl::CalculatePr
BrowserLayoutParams params = browser_params;
bool needs_exclusion = true;
const TabStripType tab_strip_type = GetTabStripType();
+ const bool vertical_right_aligned =
+ delegate().IsVerticalTabStripRightAligned();
if (tab_strip_type == TabStripType::kWebUi) {
// When the WebUI tab strip is present, it does not paint over the caption
@@ -298,6 +304,9 @@ BrowserViewTabbedLayoutImpl::CalculatePr
views().browser_view)) {
gfx::Rect vertical_tab_strip_bounds;
if (tab_strip_type == TabStripType::kVertical) {
+ const BrowserLayoutExclusionArea& side_exclusion =
+ vertical_right_aligned ? params.trailing_exclusion
+ : params.leading_exclusion;
int vertical_tab_strip_relative_top = 0;
int vertical_tab_strip_width =
views().vertical_tab_strip_region_view->GetPreferredSize().width();
@@ -310,17 +319,23 @@ BrowserViewTabbedLayoutImpl::CalculatePr
} else {
// Un-collapsed tabstrip must be at least as wide as the caption
// buttons, if present.
- const int leading_exclusion_width = base::ClampCeil(
- params.leading_exclusion.ContentWithPadding().width());
+ const int side_exclusion_width = base::ClampCeil(
+ side_exclusion.ContentWithPadding().width());
vertical_tab_strip_width =
- std::max(vertical_tab_strip_width, leading_exclusion_width);
+ std::max(vertical_tab_strip_width, side_exclusion_width);
}
+ const int vertical_tab_strip_x =
+ vertical_right_aligned
+ ? params.visual_client_area.right() - vertical_tab_strip_width
+ : params.visual_client_area.x();
vertical_tab_strip_bounds = gfx::Rect(
- params.visual_client_area.x(),
- params.visual_client_area.y() + vertical_tab_strip_relative_top,
+ vertical_tab_strip_x, params.visual_client_area.y() +
+ vertical_tab_strip_relative_top,
+ vertical_tab_strip_width, params.visual_client_area.height() -
+ vertical_tab_strip_relative_top);
+ params.InsetHorizontal(
vertical_tab_strip_width,
- params.visual_client_area.height() - vertical_tab_strip_relative_top);
- params.InsetHorizontal(vertical_tab_strip_width, /*leading=*/true);
+ /*leading=*/!vertical_right_aligned);
}
layout.AddChild(views().vertical_tab_strip_region_view,
vertical_tab_strip_bounds,
@@ -362,16 +377,21 @@ BrowserViewTabbedLayoutImpl::CalculatePr
GetTopContainerBoundsInParent(top_container_local_bounds, params);
params.SetTop(top_container_layout.bounds.bottom());
- // Possibly bump the leading margin of the top container out to cover the
+ // Possibly bump the side margin of the top container out to cover the
// caption buttons, leaving all of the child views in the same absolute
// position.
if (collapsed_vertical_tab_strip_adjustment > 0) {
- top_container_layout.bounds.Outset(
- gfx::Outsets::TLBR(0, collapsed_vertical_tab_strip_adjustment, 0, 0));
- for (auto& [child, child_layout] : top_container_layout.children) {
- if (!child_layout.bounds.IsEmpty()) {
- child_layout.bounds.Offset(collapsed_vertical_tab_strip_adjustment,
- 0);
+ if (vertical_right_aligned) {
+ top_container_layout.bounds.Outset(gfx::Outsets::TLBR(
+ 0, 0, 0, collapsed_vertical_tab_strip_adjustment));
+ } else {
+ top_container_layout.bounds.Outset(gfx::Outsets::TLBR(
+ 0, collapsed_vertical_tab_strip_adjustment, 0, 0));
+ for (auto& [child, child_layout] : top_container_layout.children) {
+ if (!child_layout.bounds.IsEmpty()) {
+ child_layout.bounds.Offset(collapsed_vertical_tab_strip_adjustment,
+ 0);
+ }
}
}
}
@@ -647,15 +667,25 @@ BrowserViewTabbedLayoutImpl::CalculatePr
toolbar_height);
// If the toolbar is not in the browser, then the exclusion isn't either.
- const int exclusion_width =
- toolbar_bounds
- ? std::max(0, base::ClampCeil(browser_params.leading_exclusion
- .ContentWithPadding()
- .width()) -
- tabstrip_bounds->x())
+ tabstrip_bounds->x() - 10)
: 0;
- : 0;
+ int exclusion_width = 0;
+ if (toolbar_bounds) {
+ const BrowserLayoutExclusionArea& side_exclusion =
+ vertical_right_aligned ? browser_params.trailing_exclusion
+ : browser_params.leading_exclusion;
+ const int side_exclusion_width =
+ base::ClampCeil(side_exclusion.ContentWithPadding().width());
+ const int side_distance_from_client_edge =
+ vertical_right_aligned
+ ? browser_params.visual_client_area.right() -
+ tabstrip_bounds->right()
+ : tabstrip_bounds->x();
+ exclusion_width = std::max(
+ 0, side_exclusion_width - side_distance_from_client_edge - 10);
+ }
views().vertical_tab_strip_region_view->SetExclusionWidthForLayout(
exclusion_width);
+ views().vertical_tab_strip_region_view->SetHasLeadingExclusionForLayout(
@@ -43,7 +162,7 @@
}
return layout;
@@ -712,7 +714,8 @@ gfx::Rect BrowserViewTabbedLayoutImpl::C
@@ -712,7 +742,8 @@ gfx::Rect BrowserViewTabbedLayoutImpl::C
gfx::Rect toolbar_bounds;
if (toolbar_visible) {
// Visually clamp two conflicting margins: window controls & toolbar
@@ -98,17 +217,26 @@
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_VERTICAL_TAB_STRIP_REGION_VIEW_H_
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -51,7 +51,8 @@
@@ -20,6 +20,7 @@
#include "chrome/browser/ui/tabs/tab_group_model.h"
#include "chrome/browser/ui/tabs/tab_strip_api/tab_strip_service.h"
#include "chrome/browser/ui/tabs/tab_strip_api/tab_strip_service_feature.h"
+#include "chrome/browser/ui/tabs/vertical_tab_strip_state.h"
#include "chrome/browser/ui/tabs/vertical_tab_strip_state_controller.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/top_container_background.h"
@@ -52,7 +53,9 @@
#include "ui/views/view_utils.h"
namespace {
-constexpr int kRegionVerticalPadding = 5;
+constexpr int kRegionVerticalPadding = 3;
+constexpr int kBottomContainerGap = 2;
+constexpr int kDefaultWidthSnapDistance = 6;
} // namespace
VerticalTabStripRegionView::VerticalTabStripRegionView(
@@ -85,15 +86,13 @@ VerticalTabStripRegionView::VerticalTabS
@@ -91,15 +94,13 @@ VerticalTabStripRegionView::VerticalTabS
views::FlexSpecification(views::MinimumFlexSizeRule::kPreferred,
views::MaximumFlexSizeRule::kUnbounded));
@@ -125,7 +253,53 @@
resize_animation_.SetTweenType(gfx::Tween::Type::EASE_IN_OUT_EMPHASIZED);
resize_animation_.Reset(!state_controller_->IsCollapsed());
@@ -404,6 +403,15 @@ void VerticalTabStripRegionView::SetExcl
@@ -148,8 +149,11 @@ void VerticalTabStripRegionView::Layout(
// Manually position the resize area as it overlaps views handled by the flex
// layout.
- resize_area_->SetBoundsRect(gfx::Rect(bounds().right() - kResizeAreaWidth, 0,
- kResizeAreaWidth, bounds().height()));
+ const int resize_area_x = state_controller_->IsTabStripRightAligned()
+ ? 0
+ : bounds().right() - kResizeAreaWidth;
+ resize_area_->SetBoundsRect(gfx::Rect(resize_area_x, 0, kResizeAreaWidth,
+ bounds().height()));
}
views::View* VerticalTabStripRegionView::GetDefaultFocusableChild() {
@@ -332,7 +336,10 @@ void VerticalTabStripRegionView::OnResiz
if (!starting_width_on_resize_.has_value()) {
starting_width_on_resize_ = width();
}
- const int proposed_width = starting_width_on_resize_.value() + resize_amount;
+ const int resize_delta = state_controller_->IsTabStripRightAligned()
+ ? -resize_amount
+ : resize_amount;
+ const int proposed_width = starting_width_on_resize_.value() + resize_delta;
if (done_resizing) {
starting_width_on_resize_ = std::nullopt;
}
@@ -342,6 +349,19 @@ void VerticalTabStripRegionView::OnResiz
new_state.collapsed = false;
new_state.uncollapsed_width =
std::clamp(proposed_width, kUncollapsedMinWidth, kUncollapsedMaxWidth);
+
+ // Snap to default uncollapsed width if within the snap distance.
+ const int default_uncollapsed_width =
+ tabs::kVerticalTabStripDefaultUncollapsedWidth;
+ const int min_snap_width =
+ default_uncollapsed_width - kDefaultWidthSnapDistance;
+ const int max_snap_width =
+ default_uncollapsed_width + kDefaultWidthSnapDistance;
+ if (new_state.uncollapsed_width >= min_snap_width &&
+ new_state.uncollapsed_width <= max_snap_width) {
+ new_state.uncollapsed_width = default_uncollapsed_width;
+ }
+
if (done_resizing) {
// We only want to save the uncollapsed width to the state controller if
// the user has lifted their mouse, otherwise dragging the resize area to
@@ -410,6 +430,15 @@ void VerticalTabStripRegionView::SetExcl
top_button_container_->SetExclusionWidthForLayout(exclusion_width);
}
@@ -141,23 +315,24 @@
VerticalPinnedTabContainerView*
VerticalTabStripRegionView::GetPinnedTabsContainer() {
return tab_strip_view_->GetPinnedTabsContainer();
@@ -425,10 +433,11 @@ views::View* VerticalTabStripRegionView:
@@ -431,11 +460,12 @@ views::View* VerticalTabStripRegionView:
views::FlexSpecification(views::MinimumFlexSizeRule::kScaleToZero,
views::MaximumFlexSizeRule::kPreferred));
tab_strip_view_->SetProperty(views::kMarginsKey,
- gfx::Insets::VH(kRegionVerticalPadding, 0));
+ gfx::Insets::TLBR(kRegionVerticalPadding, 0,
+ kBottomContainerGap, 0));
tab_strip_view_->InitializeTabStrip(*tab_strip_model_);
- std::optional<size_t> separator_index = GetIndexOf(top_button_separator_);
- CHECK(separator_index.has_value());
- ReorderChildView(tab_strip_view_, separator_index.value() + 1);
+ gfx::Insets::TLBR(kRegionVerticalPadding, 0,
+ kBottomContainerGap, 0));
+ std::optional<size_t> top_container_index = GetIndexOf(top_button_container_);
+ CHECK(top_container_index.has_value());
+ ReorderChildView(tab_strip_view_, top_container_index.value() + 1);
return tab_strip_view_;
}
@@ -438,6 +447,23 @@ void VerticalTabStripRegionView::ClearTa
@@ -445,6 +475,23 @@ void VerticalTabStripRegionView::ClearTa
RemoveChildViewT(std::exchange(tab_strip_view_, nullptr));
}
@@ -181,7 +356,7 @@
void VerticalTabStripRegionView::OnCollapsedStateChanged(
tabs::VerticalTabStripStateController* state_controller) {
if (target_collapse_state_.collapsed != state_controller->IsCollapsed()) {
@@ -453,16 +479,15 @@ void VerticalTabStripRegionView::OnColla
@@ -460,16 +507,15 @@ void VerticalTabStripRegionView::OnColla
state_controller_->IsCollapsed()
? LayoutConstant::kVerticalTabStripCollapsedPadding
: LayoutConstant::kVerticalTabStripUncollapsedPadding);
@@ -201,16 +376,17 @@
if (tab_strip_view_) {
tab_strip_view_->SetCollapsedState(state_controller->IsCollapsed());
@@ -503,9 +528,6 @@ void VerticalTabStripRegionView::ResizeT
@@ -510,10 +556,6 @@ void VerticalTabStripRegionView::ResizeT
}
void VerticalTabStripRegionView::UpdateBackgroundColors() {
- top_button_separator_->SetColorId(IsFrameActive()
- ? kColorTabDividerFrameActive
- : kColorTabDividerFrameInactive);
-
SchedulePaint();
}
bool VerticalTabStripRegionView::IsFrameActive() const {
--- a/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_top_container.cc
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_top_container.cc
@@ -18,7 +18,8 @@
@@ -257,7 +433,7 @@
if (total_height > host_size.height()) {
host_size.set_height(total_height);
@@ -88,52 +78,40 @@ views::ProposedLayout VerticalTabStripTo
@@ -88,52 +78,43 @@ views::ProposedLayout VerticalTabStripTo
for (views::LabelButton* container_button :
base::Reversed(container_buttons)) {
const gfx::Size pref_size = container_button->GetPreferredSize();
@@ -290,21 +466,24 @@
- if (exclusion_width_ > 0 && total_width > host_size.width()) {
- host_size.Enlarge(0, toolbar_height_);
- }
+ int current_x = exclusion_width_;
+ const bool is_right_aligned = state_controller_->IsTabStripRightAligned();
+ int current_x = is_right_aligned ? host_size.width() - exclusion_width_
+ : exclusion_width_;
- int current_x = host_size.width();
-
- // Calculate bounds to right-align the button horizontally and center it
+ // Calculate bounds to left-align the buttons horizontally and center them
// vertically within the available space.
- // vertically within the available space.
- for (views::LabelButton* container_button : container_buttons) {
+ // Calculate bounds to align buttons against the same edge as the tabstrip,
+ // and center them vertically within the available space.
+ for (views::LabelButton* container_button :
+ base::Reversed(container_buttons)) {
const gfx::Size pref_size = container_button->GetPreferredSize();
+ const int button_size = pref_size.height();
gfx::Rect bounds(
- current_x - pref_size.width(),
+ current_x,
+ is_right_aligned ? current_x - button_size : current_x,
host_size.height() -
(GetLayoutConstant(
LayoutConstant::kVerticalTabStripTopButtonContainerHeight) +
@@ -319,11 +498,12 @@
views::SizeBounds(pref_size));
- current_x = bounds.x() - kTopButtonPadding;
+ current_x = bounds.right() + kTopButtonPadding;
+ current_x = is_right_aligned ? bounds.x() - kTopButtonPadding
+ : bounds.right() + kTopButtonPadding;
}
}
@@ -171,10 +149,6 @@ bool VerticalTabStripTopContainer::IsPos
@@ -171,10 +152,6 @@ bool VerticalTabStripTopContainer::IsPos
return false;
}
@@ -334,7 +514,7 @@
return true;
}
@@ -185,7 +159,11 @@ void VerticalTabStripTopContainer::SetTo
@@ -185,7 +162,11 @@ void VerticalTabStripTopContainer::SetTo
void VerticalTabStripTopContainer::SetExclusionWidthForLayout(
const int exclusion_width) {
@@ -725,7 +905,15 @@
--- a/chrome/browser/ui/views/frame/contents_container_view.h
+++ b/chrome/browser/ui/views/frame/contents_container_view.h
@@ -19,6 +19,7 @@
@@ -8,6 +8,7 @@
#include <memory>
#include <optional>
+#include "base/callback_list.h"
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
@@ -19,10 +20,15 @@
class BrowserView;
class ContentsContainerOutline;
class ContentsWebView;
@@ -733,7 +921,15 @@
class MultiContentsViewMiniToolbar;
class ScrimView;
class ActorOverlayWebView;
@@ -109,9 +110,7 @@ class ContentsContainerView : public vie
+namespace tabs {
+class VerticalTabStripStateController;
+} // namespace tabs
+
namespace gfx {
class Rect;
} // namespace gfx
@@ -109,9 +115,7 @@ class ContentsContainerView : public vie
SkColor outline_color,
int font_size);
@@ -744,15 +940,27 @@
void ShowCaptureContentsBorder();
void HideCaptureContentsBorder();
@@ -131,7 +130,6 @@ class ContentsContainerView : public vie
@@ -129,9 +133,10 @@ class ContentsContainerView : public vie
// the bounds of contents_webview relative to the local bounds of the
// container that holds both contents_webview and devtools_webview.
void UpdateDevToolsDockedPlacement();
+ void OnVerticalTabStripStateChanged(
+ tabs::VerticalTabStripStateController*);
// views::View:
- void ChildVisibilityChanged(View* child) override;
void Layout(PassKey) override;
// views::ViewObserver:
@@ -173,6 +171,9 @@ class ContentsContainerView : public vie
@@ -142,6 +147,7 @@ class ContentsContainerView : public vie
const views::SizeBounds& size_bounds) const override;
bool is_in_split_ = false;
+ bool is_first_view_ = false;
raw_ptr<BrowserView> browser_view_ = nullptr;
raw_ptr<ContentsWebView> contents_view_ = nullptr;
@@ -173,6 +179,9 @@ class ContentsContainerView : public vie
// open.
raw_ptr<ScrimView> contents_scrim_view_ = nullptr;
@@ -762,12 +970,21 @@
// The view that contains the Glic Actor Overlay. The Actor Overlay is a UI
// overlay that is shown on top of the web contents.
raw_ptr<ActorOverlayWebView> actor_overlay_web_view_ = nullptr;
@@ -185,6 +194,7 @@ class ContentsContainerView : public vie
DevToolsContentsResizingStrategy strategy_;
base::ScopedObservation<View, ViewObserver> view_bounds_observer_{this};
+ base::CallbackListSubscription vertical_tab_strip_state_subscription_;
};
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_VIEW_H_
--- a/chrome/browser/ui/views/frame/contents_container_view.cc
+++ b/chrome/browser/ui/views/frame/contents_container_view.cc
@@ -7,12 +7,15 @@
@@ -7,13 +7,18 @@
#include <memory>
#include <optional>
+#include "base/functional/bind.h"
+#include "base/i18n/rtl.h"
+#include "base/scoped_observation.h"
#include "chrome/browser/actor/ui/actor_overlay_web_view.h"
@@ -778,9 +995,11 @@
#include "chrome/browser/ui/color/chrome_color_id.h"
+#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/read_anything/read_anything_immersive_overlay_view.h"
+#include "chrome/browser/ui/tabs/vertical_tab_strip_state_controller.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/view_ids.h"
@@ -28,13 +31,17 @@
#include "chrome/browser/ui/views/frame/browser_view.h"
@@ -28,13 +33,17 @@
#include "chrome/common/chrome_features.h"
#include "components/search/ntp_features.h"
#include "content/public/browser/web_contents.h"
@@ -799,7 +1018,7 @@
#include "ui/views/layout/delegating_layout_manager.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/proposed_layout.h"
@@ -42,6 +49,7 @@
@@ -42,6 +51,7 @@
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"
@@ -807,7 +1026,7 @@
#if BUILDFLAG(ENABLE_GLIC)
#include "chrome/browser/glic/browser_ui/context_sharing_border_view.h"
@@ -58,6 +66,94 @@ constexpr int kNewTabFooterSeparatorHeig
@@ -58,6 +68,107 @@ constexpr int kNewTabFooterSeparatorHeig
constexpr int kNewTabFooterHeight = 56;
} // namespace
@@ -837,6 +1056,17 @@
+ SchedulePaint();
+ }
+
+ void SetCornerOnRight(bool corner_on_right) {
+ if (corner_on_right_ == corner_on_right) {
+ return;
+ }
+ corner_on_right_ = corner_on_right;
+ PreferredSizeChanged();
+ SchedulePaint();
+ }
+
+ bool IsCornerOnRight() const { return corner_on_right_; }
+
+ void OnThemeChanged() override {
+ View::OnThemeChanged();
+ SchedulePaint();
@@ -861,10 +1091,11 @@
+
+ const float corner_radius = static_cast<float>(corner_radius_);
+ const bool is_rtl = base::i18n::IsRTL();
+ const bool corner_on_right = is_rtl ? !corner_on_right_ : corner_on_right_;
+ const SkVector rounded_vector = {corner_radius, corner_radius};
+ const SkVector radii[4] = {
+ is_rtl ? SkVector{0, 0} : rounded_vector,
+ is_rtl ? rounded_vector : SkVector{0, 0},
+ corner_on_right ? SkVector{0, 0} : rounded_vector,
+ corner_on_right ? rounded_vector : SkVector{0, 0},
+ {0, 0},
+ {0, 0},
+ };
@@ -892,6 +1123,7 @@
+
+ private:
+ int corner_radius_ = 0;
+ bool corner_on_right_ = false;
+ base::ScopedObservation<views::Widget, views::WidgetObserver>
+ widget_observation_{this};
+};
@@ -902,7 +1134,7 @@
ContentsContainerView::ContentsContainerView(BrowserView* browser_view)
: browser_view_(browser_view),
web_contents_modal_dialog_host_(browser_view_, this) {
@@ -81,6 +177,8 @@ ContentsContainerView::ContentsContainer
@@ -81,6 +192,8 @@ ContentsContainerView::ContentsContainer
contents_view_ = AddChildView(
std::make_unique<ContentsWebView>(browser_view->GetProfile()));
contents_view_->SetID(VIEW_ID_TAB_CONTAINER);
@@ -911,36 +1143,71 @@
if (base::FeatureList::IsEnabled(ntp_features::kNtpFooter)) {
new_tab_footer_view_separator_ =
@@ -149,13 +247,15 @@ std::vector<views::View*> ContentsContai
@@ -130,6 +243,15 @@ ContentsContainerView::ContentsContainer
#endif
view_bounds_observer_.Observe(contents_view_);
+
+ auto* vertical_controller =
+ tabs::VerticalTabStripStateController::From(browser_view_->browser());
+ if (vertical_controller) {
+ vertical_tab_strip_state_subscription_ =
+ vertical_controller->RegisterOnStateChanged(base::BindRepeating(
+ &ContentsContainerView::OnVerticalTabStripStateChanged,
+ base::Unretained(this)));
+ }
}
ContentsContainerView::~ContentsContainerView() = default;
@@ -149,10 +271,32 @@ std::vector<views::View*> ContentsContai
}
void ContentsContainerView::UpdateBorderAndOverlay(bool is_in_split,
- bool is_active,
- bool is_highlighted) {
- SetBorder(nullptr);
-}
- bool is_highlighted) {}
-
-void ContentsContainerView::ChildVisibilityChanged(View* child) {
- return;
-void ContentsContainerView::ChildVisibilityChanged(View* child) {}
+ bool is_first_view) {
+ is_in_split_ = is_in_split;
+ is_first_view_ = is_first_view;
+
+ const bool show_corner_fill =
+ browser_view_->ShouldDrawVerticalTabStrip() &&
+ (!is_in_split || is_first_view);
+ bool corner_on_right = false;
+ if (show_corner_fill) {
+ auto* controller =
+ tabs::VerticalTabStripStateController::From(browser_view_->browser());
+ corner_on_right = controller && controller->IsTabStripRightAligned();
+ }
+ const int corner_radius =
+ show_corner_fill
+ ? GetLayoutConstant(LayoutConstant::kVerticalTabCornerRadius)
+ : 0;
+ leading_corner_fill_view_->SetCornerOnRight(corner_on_right);
+ leading_corner_fill_view_->SetCornerRadius(corner_radius);
}
+}
+
+void ContentsContainerView::OnVerticalTabStripStateChanged(
+ tabs::VerticalTabStripStateController*) {
+ UpdateBorderAndOverlay(is_in_split_, is_first_view_);
+ InvalidateLayout();
+}
void ContentsContainerView::Layout(PassKey pass_key) {
@@ -399,6 +499,14 @@ views::ProposedLayout ContentsContainerV
LayoutSuperclass<views::View>(this);
@@ -395,6 +539,19 @@ views::ProposedLayout ContentsContainerV
layouts.child_layouts.emplace_back(
contents_view_.get(), contents_view_->GetVisible(), contents_rect);
+ if (leading_corner_fill_view_) {
+ const gfx::Size corner_size = leading_corner_fill_view_->GetPreferredSize();
+ const gfx::Rect corner_bounds(contents_rect.origin(), corner_size);
+ const gfx::Rect corner_bounds(
+ leading_corner_fill_view_->IsCornerOnRight()
+ ? gfx::Point(contents_rect.right() - corner_size.width(),
+ contents_rect.y())
+ : contents_rect.origin(),
+ corner_size);
+ layouts.child_layouts.emplace_back(
+ leading_corner_fill_view_.get(),
+ leading_corner_fill_view_->GetVisible(), corner_bounds);
+6 -31
View File
@@ -20,50 +20,25 @@
return types_enabled;
--- a/chrome/browser/ui/views/zoom/zoom_view_controller.cc
+++ b/chrome/browser/ui/views/zoom/zoom_view_controller.cc
@@ -52,42 +52,7 @@ void ZoomViewController::UpdatePageActio
}
@@ -90,16 +90,7 @@ void ZoomViewController::UpdatePageActio
void ZoomViewController::UpdatePageActionIcon(bool is_bubble_visible) {
void ZoomViewController::UpdatePageActionIconVisibility(
bool is_bubble_visible) {
- zoom::ZoomController* zoom_controller =
- zoom::ZoomController::FromWebContents(GetWebContents());
- CHECK(zoom_controller);
-
- // Update the tooltip with the current zoom percentage.
- page_action_controller_->OverrideTooltip(
- kActionZoomNormal,
- l10n_util::GetStringFUTF16(
- IDS_TOOLTIP_ZOOM,
- base::FormatPercent(zoom_controller->GetZoomPercent())));
-
- switch (zoom_controller->GetZoomRelativeToDefault()) {
- case ZoomController::ZOOM_BELOW_DEFAULT_ZOOM:
- page_action_controller_->OverrideImage(
- kActionZoomNormal,
- ui::ImageModel::FromVectorIcon(kZoomMinusChromeRefreshIcon));
- break;
- case ZoomController::ZOOM_AT_DEFAULT_ZOOM:
- // Default and above share the “zoom plus” icon for simplicity.
- case ZoomController::ZOOM_ABOVE_DEFAULT_ZOOM:
- page_action_controller_->OverrideImage(
- kActionZoomNormal,
- ui::ImageModel::FromVectorIcon(kZoomPlusChromeRefreshIcon));
- break;
- default:
- NOTREACHED();
- }
-
- // Show or hide the page action icon. Hide it if at default zoom and no
- // bubble.
- const bool is_at_default_zoom = zoom_controller->IsAtDefaultZoom();
- if (is_at_default_zoom && !is_bubble_visible) {
page_action_controller_->Hide(kActionZoomNormal);
- page_action_controller_->Hide(kActionZoomNormal);
- } else {
- page_action_controller_->Show(kActionZoomNormal);
- }
+ page_action_controller_->Hide(kActionZoomNormal);
}
void ZoomViewController::UpdateBubbleVisibility(bool prefer_to_show_bubble,
@@ -131,8 +96,7 @@ bool ZoomViewController::CanBubbleBeVisi
@@ -143,8 +134,7 @@ bool ZoomViewController::CanBubbleBeVisi
// If neither of these is true, we only show the bubble if the zoom level
// is not at the default (`!is_zoom_at_default`), indicating that zoom is
// active.
+12 -12
View File
@@ -159,16 +159,16 @@
group_color.value_or(tab_stroke_color));
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -133,6 +133,8 @@ constexpr int kTabAlertIndicatorCloseBut
// the discard ring by this amount if there is enough space.
constexpr int kIncreasedDiscardIndicatorRadiusDp = 2;
@@ -129,6 +129,8 @@ constexpr int kPinnedTabExtraWidthToRend
constexpr int kTabAlertIndicatorCloseButtonPaddingAdjustmentTouchUI = 8;
constexpr int kTabAlertIndicatorCloseButtonPaddingAdjustment = 4;
+constexpr int kIndicatorPadding = 2;
+
bool g_show_hover_card_on_mouse_hover = true;
// Helper functions ------------------------------------------------------------
@@ -433,19 +435,15 @@ void Tab::Layout(PassKey) {
@@ -426,19 +428,15 @@ void Tab::Layout(PassKey) {
}
close_button_->SetVisible(showing_close_button_);
@@ -193,7 +193,7 @@
contents_rect.y() + Center(contents_rect.height(), image_size.height()),
image_size.width(), image_size.height());
if (center_icon_) {
@@ -456,6 +454,7 @@ void Tab::Layout(PassKey) {
@@ -449,6 +447,7 @@ void Tab::Layout(PassKey) {
MaybeAdjustLeftForPinnedTab(&bounds, bounds.width());
}
alert_indicator_button_->SetBoundsRect(bounds);
@@ -201,7 +201,7 @@
}
alert_indicator_button_->UpdateAlertIndicatorAnimation();
alert_indicator_button_->SetVisible(showing_alert_indicator_);
@@ -464,7 +463,9 @@ void Tab::Layout(PassKey) {
@@ -457,7 +456,9 @@ void Tab::Layout(PassKey) {
bool show_title = ShouldRenderAsNormalTab();
if (show_title) {
int title_left = start;
@@ -212,7 +212,7 @@
// 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
@@ -475,9 +476,7 @@ void Tab::Layout(PassKey) {
@@ -468,9 +469,7 @@ void Tab::Layout(PassKey) {
title_left = std::max(title_left, after_favicon);
}
int title_right = contents_rect.right();
@@ -223,7 +223,7 @@
// Allow the title to overlay the close button's empty border padding.
title_right = close_x - after_title_padding;
}
@@ -1187,7 +1186,7 @@ void Tab::UpdateIconVisibility() {
@@ -1176,7 +1175,7 @@ void Tab::UpdateIconVisibility() {
const int close_button_width =
GetLayoutConstant(LayoutConstant::kTabCloseButtonSize) +
GetLayoutConstant(LayoutConstant::kTabAfterTitlePadding);
@@ -232,7 +232,7 @@
available_width >= (touch_ui ? kTouchMinimumContentsWidthForCloseButtons
: kMinimumContentsWidthForCloseButtons);
@@ -1235,6 +1234,10 @@ void Tab::UpdateIconVisibility() {
@@ -1224,6 +1223,10 @@ void Tab::UpdateIconVisibility() {
large_enough_for_close_button;
if (base::CommandLine::ForCurrentProcess()->HasSwitch("hide-tab-close-buttons"))
showing_close_button_ = false;
@@ -243,7 +243,7 @@
if (showing_close_button_) {
available_width -= close_button_width;
}
@@ -1252,10 +1255,6 @@ void Tab::UpdateIconVisibility() {
@@ -1241,10 +1244,6 @@ void Tab::UpdateIconVisibility() {
}
}
}
@@ -254,7 +254,7 @@
}
bool Tab::ShouldRenderAsNormalTab() const {
@@ -1276,15 +1275,29 @@ void Tab::UpdateTabIconNeedsAttentionBlo
@@ -1265,15 +1264,29 @@ void Tab::UpdateTabIconNeedsAttentionBlo
}
int Tab::GetWidthOfLargestSelectableRegion() const {
@@ -552,7 +552,7 @@
gfx::ImageSkia AlertIndicatorButton::GetImageToPaint() {
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -275,14 +275,6 @@ bool BrowserTabStripController::IsBrowse
@@ -266,14 +266,6 @@ bool BrowserTabStripController::IsBrowse
void BrowserTabStripController::SelectTab(int model_index,
const ui::Event& event) {
+1 -1
View File
@@ -65,7 +65,7 @@
(*s_allowlist)[::prefs::kPinnedActions] = settings_api::PrefType::kList;
--- a/chrome/browser/ui/actions/chrome_action_id.h
+++ b/chrome/browser/ui/actions/chrome_action_id.h
@@ -572,6 +572,8 @@
@@ -576,6 +576,8 @@
#define TOOLBAR_PINNABLE_ACTION_IDS \
E(kActionHome, IDC_HOME) \
E(kActionForward, IDC_FORWARD) \
+7
View File
@@ -4,6 +4,8 @@ upstream-fixes/vertical/r1568929-animate-cross-collection-operations.patch
upstream-fixes/vertical/r1570045-improve-dragging-between-groups-and-unpinned.patch
upstream-fixes/vertical/r1570472-fix-crash-drag-pinned-tabs.patch
upstream-fixes/vertical/r1570584-remove-redundant-parameter-from-tabdragcontroller.patch
upstream-fixes/vertical/r1570647-vertical-tab-discard-indicator.patch
upstream-fixes/vertical/r1570728-disable-tab-change-scroll-on-linux.patch
upstream-fixes/vertical/r1571017-add-horizontal-animation-support-to-layout.patch
upstream-fixes/vertical/r1571331-improve-tab-drag-performance-macos.patch
upstream-fixes/vertical/r1571338-handle-tab-drags-over-split-vertical-tabs.patch
@@ -12,15 +14,19 @@ upstream-fixes/vertical/r1571827-update-group-editor-bubble-anchoring.patch
upstream-fixes/vertical/r1571897-paint-dragged-tabs-to-layer.patch
upstream-fixes/vertical/r1571978-support-dragging-multiple-vertical-tabs.patch
upstream-fixes/vertical/r1572056-fix-hit-test-context-menu.patch
upstream-fixes/vertical/r1572266-fix-vertical-tab-strip-z-order.patch
upstream-fixes/vertical/r1572660-correctly-position-dragged-split-views.patch
upstream-fixes/vertical/r1572664-rename-tabslotshimview-to-verticaltabslotview.patch
upstream-fixes/vertical/r1572994-check-tab-collection-node-before-dragging.patch
upstream-fixes/vertical/r1573180-reset-tab-strip-model-flag.patch
upstream-fixes/vertical/r1573301-always-enlarge-discard-indicator.patch
upstream-fixes/vertical/r1573324-lazily-load-tabstrips-when-switching-modes.patch
upstream-fixes/vertical/r1573883-fix-crash-dragging-from-inactive-tabstrip.patch
upstream-fixes/vertical/r1574955-handle-dragging-pinned-vertical-tabs.patch
upstream-fixes/vertical/r1576165-correctly-position-tabs-dragged-at-bottom-of-container.patch
upstream-fixes/vertical/r1576224-implement-tabstripregionview-overrides.patch
upstream-fixes/vertical/r1576368-add-scrollview-api.patch
upstream-fixes/vertical/r1576442-scroll-to-activated-tabs.patch
upstream-fixes/vertical/r1576761-move-drag-offset-data-to-dragsessiondata.patch
upstream-fixes/vertical/r1576938-fix-drag-targeting-crash.patch
upstream-fixes/vertical/r1577348-support-dragging-tabgroup-headers.patch
@@ -39,6 +45,7 @@ upstream-fixes/vertical/r1580497-ensure-dragged-tabs-are-contiguous.patch
upstream-fixes/vertical/r1580788-use-bounds-of-dragged-tabs-for-target.patch
upstream-fixes/vertical/keep-vertical-drag-alive-across-handoff.patch
upstream-fixes/vertical/dont-reset-inexistent-tab-strip.patch
upstream-fixes/vertical/remove-tab-discard-ring-promo.patch
inox-patchset/fix-building-without-safebrowsing.patch
inox-patchset/disable-autofill-download-manager.patch
@@ -79,7 +79,7 @@
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
@@ -658,6 +659,9 @@ void SearchProvider::Run(bool query_is_p
@@ -662,6 +663,9 @@ void SearchProvider::Run(bool query_is_p
}
void SearchProvider::DoHistoryQuery(bool minimal_changes) {
@@ -8,7 +8,7 @@
#include "base/debug/alias.h"
#include "base/functional/bind.h"
#include "base/i18n/rtl.h"
@@ -768,6 +769,13 @@ void Tab::HideHover(TabStyle::HideHoverS
@@ -761,6 +762,13 @@ void Tab::HideHover(TabStyle::HideHoverS
DeprecatedLayoutImmediately();
}
@@ -1,6 +1,6 @@
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -1200,7 +1200,11 @@ void Tab::UpdateIconVisibility() {
@@ -1189,7 +1189,11 @@ void Tab::UpdateIconVisibility() {
// Close button is shown on active tabs regardless of the size.
showing_close_button_ = true;
#endif // BUILDFLAG(IS_CHROMEOS)
@@ -12,7 +12,7 @@
showing_alert_indicator_ =
has_alert_icon && alert_icon_width <= available_width;
@@ -1229,6 +1233,8 @@ void Tab::UpdateIconVisibility() {
@@ -1218,6 +1222,8 @@ void Tab::UpdateIconVisibility() {
!controller_->IsLockedForOnTask() &&
#endif
large_enough_for_close_button;
@@ -40,13 +40,13 @@
// It's possible to destroy the browser while a drop is active. In this case,
@@ -331,7 +346,7 @@ bool BrowserRootView::OnMouseWheel(const
// Scroll-event-changes-tab is incompatible with scrolling tabstrip, so
// Scroll-event-changes-tab is incompatible with vertical tabstrip, so
// disable it if the latter feature is enabled.
- if (browser_defaults::kScrollEventChangesTab) {
+ if (scroll_event_changes_tab_) {
- if (browser_defaults::kScrollEventChangesTab &&
+ if (scroll_event_changes_tab_ &&
!browser_view_->ShouldDrawVerticalTabStrip()) {
// Switch to the left/right tab if the wheel-scroll happens over the
// tabstrip, or the empty space beside the tabstrip.
views::View* hit_view = GetEventHandlerForPoint(event.location());
--- a/chrome/browser/ui/views/frame/browser_root_view.h
+++ b/chrome/browser/ui/views/frame/browser_root_view.h
@@ -158,6 +158,8 @@ class BrowserRootView : public views::in
@@ -1,6 +1,6 @@
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -5228,10 +5228,12 @@ const FeatureEntry::Choice kOmniboxAutof
@@ -5162,10 +5162,12 @@ const FeatureEntry::Choice kOmniboxAutof
#include "chrome/browser/ungoogled_flag_choices.h"
#include "chrome/browser/bromite_flag_choices.h"
#include "chrome/browser/ungoogled_platform_flag_choices.h"
@@ -1,6 +1,6 @@
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -5224,7 +5224,13 @@ const FeatureEntry::Choice kOmniboxAutof
@@ -5158,7 +5158,13 @@ const FeatureEntry::Choice kOmniboxAutof
// calculate and verify checksum.
//
// When adding a new choice, add it to the end of the list.
@@ -29,7 +29,7 @@
#include "components/performance_manager/public/user_tuning/prefs.h"
#include "components/prefs/pref_service.h"
#include "components/saved_tab_groups/public/features.h"
@@ -560,6 +563,18 @@ void BrowserTabStripController::CreateNe
@@ -551,6 +554,18 @@ void BrowserTabStripController::CreateNe
chrome::NewTab(browser_view_->browser(), context);
}
@@ -237,7 +237,7 @@
#if BUILDFLAG(IS_WIN)
--- a/chrome/browser/chrome_browser_interface_binders_webui_parts_desktop.cc
+++ b/chrome/browser/chrome_browser_interface_binders_webui_parts_desktop.cc
@@ -486,8 +486,6 @@ void PopulateChromeWebUIFrameBindersPart
@@ -488,8 +488,6 @@ void PopulateChromeWebUIFrameBindersPart
::mojom::app_service_internals::AppServiceInternalsPageHandler,
AppServiceInternalsUI>(map);
@@ -648,7 +648,7 @@
${this.showErrorDialog ? html`<viewer-error-dialog id="error-dialog">
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -1504,8 +1504,6 @@ static_library("ui") {
@@ -1508,8 +1508,6 @@ static_library("ui") {
"//chrome/browser/regional_capabilities",
"//chrome/browser/safe_browsing",
"//chrome/browser/safe_browsing:advanced_protection",
@@ -657,7 +657,7 @@
"//chrome/browser/smart_card",
"//chrome/browser/tab_group_sync:utils",
"//chrome/browser/themes",
@@ -2282,7 +2280,6 @@ static_library("ui") {
@@ -2286,7 +2284,6 @@ static_library("ui") {
"//chrome/browser/policy:onc",
"//chrome/browser/policy:system_features_disable_list",
"//chrome/browser/push_notification",
@@ -665,7 +665,7 @@
"//chrome/browser/ui/ash/accessibility",
"//chrome/browser/ui/ash/app_access",
"//chrome/browser/ui/ash/arc",
@@ -4780,7 +4777,6 @@ static_library("ui") {
@@ -4784,7 +4781,6 @@ static_library("ui") {
"//chrome/browser/ui/waap:waap_utils",
"//chrome/browser/ui/webauthn:impl",
"//chrome/browser/ui/webui/app_service_internals",
@@ -738,7 +738,7 @@
"//components/safety_check:features",
--- a/chrome/browser/ui/views/user_education/browser_user_education_service.cc
+++ b/chrome/browser/ui/views/user_education/browser_user_education_service.cc
@@ -857,40 +857,6 @@ void MaybeRegisterChromeFeaturePromos(
@@ -856,40 +856,6 @@ void MaybeRegisterChromeFeaturePromos(
"Triggered when the PDF Viewer opens.")));
#endif
@@ -1011,7 +1011,7 @@
"//services/service_manager/public/cpp",
"//services/strings",
"//services/test/echo/public/mojom",
@@ -7296,9 +7291,6 @@ test("unit_tests") {
@@ -7297,9 +7292,6 @@ test("unit_tests") {
"//components/safe_browsing/content/browser",
"//components/safe_browsing/content/browser:client_side_detection_images_cache",
"//components/safe_browsing/content/browser:credit_card_form_event",
@@ -1619,7 +1619,7 @@
// certificate. So, when users click proceed on an interstitial, move the tab
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -4314,8 +4314,6 @@ static_library("ui") {
@@ -4318,8 +4318,6 @@ static_library("ui") {
"views/safe_browsing/password_reuse_modal_warning_dialog.h",
"views/safe_browsing/tailored_security_desktop_dialog_manager.cc",
"views/safe_browsing/tailored_security_desktop_dialog_manager.h",
@@ -2040,7 +2040,7 @@
"//components/safe_browsing/content/browser:credit_card_form_event",
"//components/safe_browsing/content/browser:safe_browsing_service",
"//components/safe_browsing/content/browser/password_protection",
@@ -7289,7 +7288,6 @@ test("unit_tests") {
@@ -7290,7 +7289,6 @@ test("unit_tests") {
"//components/resources",
"//components/safe_browsing:buildflags",
"//components/safe_browsing/content/browser",
@@ -2,7 +2,7 @@
#
--- a/components/omnibox/common/omnibox_features.cc
+++ b/components/omnibox/common/omnibox_features.cc
@@ -242,7 +242,7 @@ BASE_FEATURE(kOmniboxTouchDownTriggerFor
@@ -247,7 +247,7 @@ BASE_FEATURE(kOmniboxTouchDownTriggerFor
BASE_FEATURE(kOmniboxSiteSearch, DISABLED);
// Enables additional site search providers for the Site search Starter Pack.
@@ -533,7 +533,7 @@
// Constrain title width manually since it doesn't have FlexSpecification.
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -1104,40 +1104,20 @@ void AddPerformanceStrings(content::WebU
@@ -1114,40 +1114,20 @@ void AddPerformanceStrings(content::WebU
IDS_SETTINGS_PERFORMANCE_TAB_HOVER_PREVIEW_CARD_LINK_SUBTITLE},
{"performanceInterventionEnabledLabel",
IDS_SETTINGS_PERFORMANCE_INTERVENTION_NOTIFICATION_ENABLED_LABEL},
@@ -583,7 +583,7 @@
html_source->AddString(
"tabDiscardTimerFiveMinutes",
@@ -1183,11 +1163,6 @@ void AddPerformanceStrings(content::WebU
@@ -1193,11 +1173,6 @@ void AddPerformanceStrings(content::WebU
base::NumberToString16(
performance_manager::user_tuning::BatterySaverModeManager::
kLowBatteryThresholdPercent)));
@@ -3905,7 +3905,7 @@
#include "components/saved_tab_groups/public/features.h"
#include "components/signin/public/base/signin_buildflags.h"
#include "components/strings/grit/components_branded_strings.h"
@@ -3836,11 +3835,6 @@ void AddSiteSettingsStrings(content::Web
@@ -3846,11 +3845,6 @@ void AddSiteSettingsStrings(content::Web
html_source->AddLocalizedStrings(kSensorsLocalizedStrings);
html_source->AddBoolean(
@@ -0,0 +1,252 @@
From d848dfaecedc6a6d47988fa2f68932d934dd9275 Mon Sep 17 00:00:00 2001
From: Charles Meng <charlesmeng@chromium.org>
Date: Fri, 16 Jan 2026 14:21:11 -0800
Subject: [PATCH] [Vertical Tabs] Allow vertical tab icon to show discard indicator
Notify vertical tab icon to update data when a tab is replaced due to
discard. Additionally listen to the should show discard indicator pref
on the tab icon itself.
Fixed: 475302379
Change-Id: I2e39735d8a3cd38d66217b54677f0d5a4d7c08b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7486606
Commit-Queue: Charles Meng <charlesmeng@chromium.org>
Reviewed-by: Eshwar Stalin <estalin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1570647}
---
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -160,15 +160,6 @@ BrowserTabStripController::BrowserTabStr
menu_model_factory_ = std::make_unique<TabMenuModelFactory>();
}
model_->SetTabStripUI(this);
-
- should_show_discard_indicator_ = g_browser_process->local_state()->GetBoolean(
- performance_manager::user_tuning::prefs::kDiscardRingTreatmentEnabled);
- local_state_registrar_.Init(g_browser_process->local_state());
- local_state_registrar_.Add(
- performance_manager::user_tuning::prefs::kDiscardRingTreatmentEnabled,
- base::BindRepeating(
- &BrowserTabStripController::OnDiscardRingTreatmentEnabledChanged,
- base::Unretained(this)));
}
BrowserTabStripController::~BrowserTabStripController() {
@@ -937,11 +928,6 @@ void BrowserTabStripController::AddTabs(
tabstrip_->AddTabsAt(std::move(tabs_data));
- for (const auto& [contents, index] : contents_list) {
- tabstrip_->tab_at(index)->SetShouldShowDiscardIndicator(
- should_show_discard_indicator_);
- }
-
// Try to show tab search IPH if needed.
constexpr int kTabSearchIPHTriggerThreshold = 8;
if (tabstrip_->GetTabCount() >= kTabSearchIPHTriggerThreshold) {
@@ -950,15 +936,6 @@ void BrowserTabStripController::AddTabs(
}
}
-void BrowserTabStripController::OnDiscardRingTreatmentEnabledChanged() {
- should_show_discard_indicator_ = g_browser_process->local_state()->GetBoolean(
- performance_manager::user_tuning::prefs::kDiscardRingTreatmentEnabled);
- for (int tab_index = 0; tab_index < tabstrip_->GetTabCount(); ++tab_index) {
- tabstrip_->tab_at(tab_index)->SetShouldShowDiscardIndicator(
- should_show_discard_indicator_);
- }
-}
-
bool BrowserTabStripController::IsContextMenuCommandChecked(
TabStripModel::ContextMenuCommand command_id) {
return false;
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.h
@@ -197,11 +197,7 @@ class BrowserTabStripController : public
// tabs.
std::unique_ptr<ImmersiveRevealedLock> immersive_reveal_lock_;
- PrefChangeRegistrar local_state_registrar_;
-
std::unique_ptr<TabMenuModelFactory> menu_model_factory_;
-
- bool should_show_discard_indicator_ = true;
};
#endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -1079,10 +1079,6 @@ std::u16string Tab::GetTooltipText(const
return result;
}
-void Tab::SetShouldShowDiscardIndicator(bool enabled) {
- icon_->SetShouldShowDiscardIndicator(enabled);
-}
-
void Tab::UpdateInsets() {
SetBorder(views::CreateEmptyBorder(tab_style_views()->GetContentsInsets()));
}
--- a/chrome/browser/ui/views/tabs/tab.h
+++ b/chrome/browser/ui/views/tabs/tab.h
@@ -207,8 +207,6 @@ class Tab : public gfx::AnimationDelegat
return alert_indicator_button_;
}
- void SetShouldShowDiscardIndicator(bool enabled);
-
void UpdateInsets();
#if BUILDFLAG(ENABLE_GLIC)
--- a/chrome/browser/ui/views/tabs/tab_icon.cc
+++ b/chrome/browser/ui/views/tabs/tab_icon.cc
@@ -25,6 +25,8 @@
#include "chrome/common/webui_url_constants.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/grit/components_scaled_resources.h"
+#include "components/performance_manager/public/user_tuning/prefs.h"
+#include "components/prefs/pref_service.h"
#include "content/public/common/url_constants.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/resource/resource_bundle.h"
@@ -112,6 +114,13 @@ TabIcon::TabIcon()
DCHECK(!GetShowingLoadingAnimation());
SetProperty(views::kElementIdentifierKey, kTabIconElementId);
+
+ local_state_registrar_.Init(g_browser_process->local_state());
+ local_state_registrar_.Add(
+ performance_manager::user_tuning::prefs::kDiscardRingTreatmentEnabled,
+ base::BindRepeating(&TabIcon::OnDiscardRingTreatmentEnabledChanged,
+ base::Unretained(this)));
+ OnDiscardRingTreatmentEnabledChanged();
}
TabIcon::~TabIcon() = default;
@@ -197,9 +206,13 @@ void TabIcon::EnlargeDiscardIndicatorRad
increased_discard_indicator_radius_ = radius;
}
-void TabIcon::SetShouldShowDiscardIndicator(bool enabled) {
- should_show_discard_indicator_ = enabled;
- bool show_discard_indicator = is_discarded_ && should_show_discard_indicator_;
+void TabIcon::OnDiscardRingTreatmentEnabledChanged() {
+ discard_ring_treatment_enabled_ =
+ g_browser_process->local_state()->GetBoolean(
+ performance_manager::user_tuning::prefs::
+ kDiscardRingTreatmentEnabled);
+ bool show_discard_indicator =
+ is_discarded_ && discard_ring_treatment_enabled_;
if (was_discard_indicator_shown_ != show_discard_indicator) {
was_discard_indicator_shown_ = show_discard_indicator;
@@ -454,7 +467,8 @@ void TabIcon::SetIcon(const ui::ImageMod
void TabIcon::SetDiscarded(bool discarded) {
is_discarded_ = discarded;
- bool show_discard_indicator = is_discarded_ && should_show_discard_indicator_;
+ bool show_discard_indicator =
+ is_discarded_ && discard_ring_treatment_enabled_;
if (was_discard_indicator_shown_ != show_discard_indicator) {
was_discard_indicator_shown_ = show_discard_indicator;
favicon_size_animation_.SetSlideDuration(
--- a/chrome/browser/ui/views/tabs/tab_icon.h
+++ b/chrome/browser/ui/views/tabs/tab_icon.h
@@ -10,6 +10,7 @@
#include "base/time/time.h"
#include "chrome/browser/ui/tabs/tab_network_state.h"
#include "components/performance_manager/public/features.h"
+#include "components/prefs/pref_change_registrar.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/models/image_model.h"
@@ -83,7 +84,7 @@ class TabIcon : public views::View, publ
bool GetActiveStateForTesting() { return is_active_tab_; }
void EnlargeDiscardIndicatorRadius(int radius);
- void SetShouldShowDiscardIndicator(bool enabled);
+ void OnDiscardRingTreatmentEnabledChanged();
protected:
class CrashAnimation;
@@ -195,7 +196,7 @@ class TabIcon : public views::View, publ
// due to a change in the discard status or a change to the pref, because
// we don't want to animate the discard ring in the latter case.
bool is_discarded_ = false;
- bool should_show_discard_indicator_ = true;
+ bool discard_ring_treatment_enabled_ = true;
bool was_discard_indicator_shown_ = false;
// Crash animation (in place of favicon). Lazily created since most of the
@@ -211,6 +212,8 @@ class TabIcon : public views::View, publ
bool is_monochrome_favicon_ = false;
int increased_discard_indicator_radius_ = 0;
+
+ PrefChangeRegistrar local_state_registrar_;
};
#endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_ICON_H_
--- a/chrome/browser/ui/views/tabs/vertical/BUILD.gn
+++ b/chrome/browser/ui/views/tabs/vertical/BUILD.gn
@@ -104,6 +104,7 @@ source_set("browser_tests") {
":impl",
"//base",
"//chrome/browser",
+ "//chrome/browser/performance_manager/public/user_tuning",
"//chrome/browser/ui",
"//chrome/browser/ui:browser_element_identifiers",
"//chrome/browser/ui:ui_features",
--- a/chrome/browser/ui/views/tabs/vertical/root_tab_collection_node.cc
+++ b/chrome/browser/ui/views/tabs/vertical/root_tab_collection_node.cc
@@ -124,21 +124,21 @@ void RootTabCollectionNode::OnTabStripMo
return;
}
- std::set<TabCollectionNode*> selection_changes;
+ std::set<TabCollectionNode*> changed_tabs;
if (selection.active_tab_changed()) {
if (selection.old_tab) {
TabCollectionNode* old_tab_node =
GetNodeForHandle(selection.old_tab->GetHandle());
if (old_tab_node) {
- selection_changes.insert(old_tab_node);
+ changed_tabs.insert(old_tab_node);
}
}
if (selection.new_tab) {
TabCollectionNode* new_tab_node =
GetNodeForHandle(selection.new_tab->GetHandle());
if (new_tab_node) {
- selection_changes.insert(new_tab_node);
+ changed_tabs.insert(new_tab_node);
}
}
}
@@ -158,13 +158,22 @@ void RootTabCollectionNode::OnTabStripMo
base::STLSetUnion<SelectionHandles>(old_selections, new_selections)) {
TabCollectionNode* tab_node = GetNodeForHandle(tab_handle);
if (tab_node) {
- selection_changes.insert(tab_node);
+ changed_tabs.insert(tab_node);
}
}
selected_tabs_ = selected_tabs;
}
- for (auto* tab_node : selection_changes) {
+ if (change.type() == TabStripModelChange::kReplaced) {
+ // Discarding a tab causes a replace change notification to be sent. Add any
+ // replaced tab to the list of tabs to update.
+ auto* replace = change.GetReplace();
+ TabCollectionNode* tab_node = GetNodeForHandle(
+ tab_strip_model->GetTabAtIndex(replace->index)->GetHandle());
+ changed_tabs.insert(tab_node);
+ }
+
+ for (auto* tab_node : changed_tabs) {
tab_node->NotifyDataChanged();
}
}
@@ -0,0 +1,28 @@
From 5a01450659fa329157d6996f10d4a2ad2ad2decd Mon Sep 17 00:00:00 2001
From: Alison Gale <agale@chromium.org>
Date: Fri, 16 Jan 2026 18:35:05 -0800
Subject: [PATCH] [Vertical Tabs] Disable scroll to change tabs on Linux
Bug: 474165324
Change-Id: I71eff12cf6f50c238cfbf72d5f0c7789037f5ba0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7486711
Commit-Queue: Alison Gale <agale@chromium.org>
Reviewed-by: Vince Lugli <lugli@google.com>
Cr-Commit-Position: refs/heads/main@{#1570728}
---
--- a/chrome/browser/ui/views/frame/browser_root_view.cc
+++ b/chrome/browser/ui/views/frame/browser_root_view.cc
@@ -329,9 +329,10 @@ bool BrowserRootView::OnMouseWheel(const
// TODO(dfried): See if it's possible to move this logic deeper into the view
// hierarchy - ideally to HorizontalTabStripRegionView.
- // Scroll-event-changes-tab is incompatible with scrolling tabstrip, so
+ // Scroll-event-changes-tab is incompatible with vertical tabstrip, so
// disable it if the latter feature is enabled.
- if (browser_defaults::kScrollEventChangesTab) {
+ if (browser_defaults::kScrollEventChangesTab &&
+ !browser_view_->ShouldDrawVerticalTabStrip()) {
// Switch to the left/right tab if the wheel-scroll happens over the
// tabstrip, or the empty space beside the tabstrip.
views::View* hit_view = GetEventHandlerForPoint(event.location());
@@ -25,7 +25,7 @@ Cr-Commit-Position: refs/heads/main@{#1571827}
#include "components/tabs/public/split_tab_data.h"
#include "components/tabs/public/tab_collection.h"
#include "components/tabs/public/tab_collection_types.h"
@@ -173,18 +174,23 @@ void RootTabCollectionNode::OnTabGroupCh
@@ -182,18 +183,23 @@ void RootTabCollectionNode::OnTabGroupCh
if (tab_strip_model_->closing_all()) {
return;
}
@@ -0,0 +1,55 @@
From fba80fe8421c23bdc0e1403d4694a2b008c5aa51 Mon Sep 17 00:00:00 2001
From: Dana Fried <dfried@chromium.org>
Date: Wed, 21 Jan 2026 06:14:27 -0800
Subject: [PATCH] [Vertical Tabs] Paint tabstrip to layer
This prevents the animating side panel from painting over the tabstrip,
since Z-order works like:
layer highest Z
...
layer lowest Z
non-layer highest Z
...
non-layer lowest Z
Bug: 473424028
Change-Id: I09e4f2c60c5dd45583c15523316a940b85ecab35
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7494682
Commit-Queue: Dana Fried <dfried@chromium.org>
Auto-Submit: Dana Fried <dfried@chromium.org>
Reviewed-by: Eshwar Stalin <estalin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1572266}
---
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -37,6 +37,7 @@
#include "components/tabs/public/tab_interface.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/color/color_id.h"
+#include "ui/compositor/layer.h"
#include "ui/gfx/animation/animation.h"
#include "ui/views/background.h"
#include "ui/views/controls/resize_area.h"
@@ -61,6 +62,11 @@ VerticalTabStripRegionView::VerticalTabS
: tab_strip_model_(browser->GetTabStripModel()),
state_controller_(state_controller),
resize_animation_(this) {
+ // For z-ordering purposes this needs to be on a layer.
+ SetPaintToLayer();
+ // Because corners may be transparent, this must be set to false.
+ layer()->SetFillsBoundsOpaquely(false);
+
flex_layout_ = SetLayoutManager(std::make_unique<views::FlexLayout>());
flex_layout_->SetOrientation(views::LayoutOrientation::kVertical)
.SetCollapseMargins(true)
@@ -471,6 +477,8 @@ void VerticalTabStripRegionView::UpdateB
top_button_separator_->SetColorId(IsFrameActive()
? kColorTabDividerFrameActive
: kColorTabDividerFrameInactive);
+
+ SchedulePaint();
}
bool VerticalTabStripRegionView::IsFrameActive() const {
@@ -0,0 +1,123 @@
From fa336d92699c944b7f6128e41935b2281efbcc89 Mon Sep 17 00:00:00 2001
From: Charles Meng <charlesmeng@chromium.org>
Date: Thu, 22 Jan 2026 14:04:53 -0800
Subject: [PATCH] [Vertical Tabs] Always enlarge the discard indicator for vertical tabs
Update TabIcon so that it by default enlarges the discard indicator
radius unless its parent view notifies it that there is not enough
width to do so. This makes it so that the indicator radius is always
enlarged in the case of vertical tabs.
Comparison screenshots:
https://screenshot.googleplex.com/hJ8bcEqJ6VwGYyj.png
https://screenshot.googleplex.com/5PCEYzUgzjBRvHy.png
Bug: 475302379
Change-Id: Iaa899a268bfba42578dc2e962f8459645d3aa918
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7510237
Reviewed-by: Eshwar Stalin <estalin@chromium.org>
Commit-Queue: Charles Meng <charlesmeng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1573301}
---
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -128,10 +128,6 @@ constexpr int kPinnedTabExtraWidthToRend
constexpr int kTabAlertIndicatorCloseButtonPaddingAdjustmentTouchUI = 8;
constexpr int kTabAlertIndicatorCloseButtonPaddingAdjustment = 4;
-// 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 ------------------------------------------------------------
@@ -383,11 +379,8 @@ void Tab::Layout(PassKey) {
} else {
MaybeAdjustLeftForPinnedTab(&favicon_bounds, gfx::kFaviconSize);
}
- icon_->EnlargeDiscardIndicatorRadius(
- width() - 2 * tab_style()->GetBottomCornerRadius() >=
- gfx::kFaviconSize + 2 * kIncreasedDiscardIndicatorRadiusDp
- ? kIncreasedDiscardIndicatorRadiusDp
- : 0);
+ icon_->ResizeDiscardIndicatorRadiusForWidth(
+ width() - 2 * tab_style()->GetBottomCornerRadius());
// Add space for insets outside the favicon bounds.
favicon_bounds.Inset(-icon_->GetInsets());
--- a/chrome/browser/ui/views/tabs/tab_icon.cc
+++ b/chrome/browser/ui/views/tabs/tab_icon.cc
@@ -102,9 +102,8 @@ TabIcon::TabIcon()
SetCanProcessEventsWithinSubtree(false);
// Add padding to avoid clipping the attention indicator and the increased
- // discard ring radius when kDiscardRingImprovements is enabled. Padding must
- // be symmetric on each side so that elements will anchor to the center of the
- // favicon.
+ // discard ring radius. Padding must be symmetric on each side so that
+ // elements will anchor to the center of the favicon.
SetBorder(views::CreateEmptyBorder(kAttentionIndicatorRadius));
const int preferred_width = gfx::kFaviconSize + GetInsets().width();
@@ -201,9 +200,11 @@ void TabIcon::StepLoadingAnimation(const
}
}
-void TabIcon::EnlargeDiscardIndicatorRadius(int radius) {
- CHECK(radius <= GetInsets().left());
- increased_discard_indicator_radius_ = radius;
+void TabIcon::ResizeDiscardIndicatorRadiusForWidth(int width) {
+ increased_discard_indicator_radius_ =
+ width >= gfx::kFaviconSize + 2 * kIncreasedDiscardIndicatorRadiusDp
+ ? kIncreasedDiscardIndicatorRadiusDp
+ : 0;
}
void TabIcon::OnDiscardRingTreatmentEnabledChanged() {
@@ -317,11 +318,10 @@ void TabIcon::PaintDiscardRingAndIcon(gf
// Fades in the discard ring and smaller favicon
MaybePaintFavicon(canvas, icon, icon_bounds);
- // Increase the bounds of the discard ring beyond the icon bounds if
- // kDiscardRingImprovements is enabled. This is safe because in the
- // constructor, we have already added insets so that the larger discard ring
- // can expand into them and won't be clipped, and the icon bounds will be
- // inside those insets.
+ // Increase the bounds of the discard ring beyond the icon bounds if there is
+ // enough space in the tab. This is safe because in the constructor, we have
+ // already added insets so that the larger discard ring can expand into them
+ // and won't be clipped, and the icon bounds will be inside those insets.
gfx::Rect discard_ring_bounds = icon_bounds;
discard_ring_bounds.Outset(increased_discard_indicator_radius_);
--- a/chrome/browser/ui/views/tabs/tab_icon.h
+++ b/chrome/browser/ui/views/tabs/tab_icon.h
@@ -83,7 +83,11 @@ class TabIcon : public views::View, publ
gfx::ImageSkia GetThemedIconForTesting() { return themed_favicon_; }
bool GetActiveStateForTesting() { return is_active_tab_; }
- void EnlargeDiscardIndicatorRadius(int radius);
+ // Called by the parent view when the width available to draw the tab icon
+ // changes, to determine whether to increase the discard indicator radius.
+ // Not used by vertical tabs since there always is enough width to draw the
+ // increased discard indicator radius.
+ void ResizeDiscardIndicatorRadiusForWidth(int width);
void OnDiscardRingTreatmentEnabledChanged();
protected:
@@ -211,7 +215,12 @@ class TabIcon : public views::View, publ
bool is_monochrome_favicon_ = false;
- int increased_discard_indicator_radius_ = 0;
+ // If there is enough space, increased the size of the discard ring beyond the
+ // default favicon size, by this amount.
+ static constexpr int kIncreasedDiscardIndicatorRadiusDp = 2;
+
+ // The amount to increase the size of the discard ring by.
+ int increased_discard_indicator_radius_ = kIncreasedDiscardIndicatorRadiusDp;
PrefChangeRegistrar local_state_registrar_;
};
@@ -176,7 +176,7 @@ Cr-Commit-Position: refs/heads/main@{#1573324}
virtual void DisableTabStripEditingForTesting() const = 0;
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -58,7 +58,8 @@ VerticalTabStripRegionView::VerticalTabS
@@ -59,7 +59,8 @@ VerticalTabStripRegionView::VerticalTabS
actions::ActionItem* root_action_item,
BrowserWindowInterface* browser,
BrowserView* browser_view)
@@ -185,8 +185,8 @@ Cr-Commit-Position: refs/heads/main@{#1573324}
+ tab_strip_model_(browser_view->browser()->GetTabStripModel()),
state_controller_(state_controller),
resize_animation_(this) {
flex_layout_ = SetLayoutManager(std::make_unique<views::FlexLayout>());
@@ -105,21 +106,22 @@ VerticalTabStripRegionView::VerticalTabS
// For z-ordering purposes this needs to be on a layer.
@@ -111,21 +112,22 @@ VerticalTabStripRegionView::VerticalTabS
GetViewAccessibility().SetRole(ax::mojom::Role::kTabList);
@@ -217,7 +217,7 @@ Cr-Commit-Position: refs/heads/main@{#1573324}
}
void VerticalTabStripRegionView::AddedToWidget() {
@@ -142,6 +144,56 @@ views::View* VerticalTabStripRegionView:
@@ -148,6 +150,56 @@ views::View* VerticalTabStripRegionView:
return top_button_container_;
}
@@ -274,7 +274,7 @@ Cr-Commit-Position: refs/heads/main@{#1573324}
bool VerticalTabStripRegionView::IsTabStripEditable() const {
// TODO(crbug.com/467710547): This needs to consider the drag context. Wait
// until that is implemented before updating this function.
@@ -341,29 +393,6 @@ bool VerticalTabStripRegionView::IsPosit
@@ -347,29 +399,6 @@ bool VerticalTabStripRegionView::IsPosit
return true;
}
@@ -304,7 +304,7 @@ Cr-Commit-Position: refs/heads/main@{#1573324}
void VerticalTabStripRegionView::SetToolbarHeightForLayout(
const int toolbar_height) {
top_button_container_->SetToolbarHeightForLayout(toolbar_height);
@@ -403,6 +432,12 @@ views::View* VerticalTabStripRegionView:
@@ -409,6 +438,12 @@ views::View* VerticalTabStripRegionView:
return tab_strip_view_;
}
@@ -361,10 +361,10 @@ Cr-Commit-Position: refs/heads/main@{#1573324}
menu_model_factory_ = std::make_unique<TabMenuModelFactory>();
}
- model_->SetTabStripUI(this);
}
should_show_discard_indicator_ = g_browser_process->local_state()->GetBoolean(
performance_manager::user_tuning::prefs::kDiscardRingTreatmentEnabled);
@@ -184,6 +183,7 @@ BrowserTabStripController::~BrowserTabSt
BrowserTabStripController::~BrowserTabStripController() {
@@ -175,6 +174,7 @@ BrowserTabStripController::~BrowserTabSt
void BrowserTabStripController::InitFromModel(TabStrip* tabstrip) {
tabstrip_ = tabstrip;
@@ -372,7 +372,7 @@ Cr-Commit-Position: refs/heads/main@{#1573324}
// Walk the model, calling our insertion observer method for each item within
// it.
@@ -192,7 +192,37 @@ void BrowserTabStripController::InitFrom
@@ -183,7 +183,37 @@ void BrowserTabStripController::InitFrom
tabs_to_add.emplace_back(model_->GetTabAtIndex(i), i);
}
AddTabs(tabs_to_add);
@@ -19,7 +19,7 @@ Cr-Commit-Position: refs/heads/main@{#1573883}
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -514,6 +514,10 @@ bool VerticalTabStripRegionView::IsFrame
@@ -522,6 +522,10 @@ bool VerticalTabStripRegionView::IsFrame
TabDragTarget* VerticalTabStripRegionView::GetTabDragTarget(
const gfx::Point& point_in_screen) {
@@ -30,7 +30,7 @@ Cr-Commit-Position: refs/heads/main@{#1574955}
#include "chrome/browser/ui/views/tabs/vertical/vertical_tab_drag_handler.h"
#include "chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_bottom_container.h"
#include "chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_controller.h"
@@ -119,7 +120,7 @@ VerticalTabStripRegionView::~VerticalTab
@@ -125,7 +126,7 @@ VerticalTabStripRegionView::~VerticalTab
tab_strip_controller_.reset();
if (drag_handler_) {
@@ -39,7 +39,7 @@ Cr-Commit-Position: refs/heads/main@{#1574955}
drag_handler_ = nullptr;
}
}
@@ -189,7 +190,9 @@ void VerticalTabStripRegionView::ResetTa
@@ -195,7 +196,9 @@ void VerticalTabStripRegionView::ResetTa
tab_strip_controller_.reset();
CHECK(drag_handler_);
@@ -50,7 +50,7 @@ Cr-Commit-Position: refs/heads/main@{#1574955}
root_node_.reset();
}
@@ -303,7 +306,7 @@ views::View* VerticalTabStripRegionView:
@@ -309,7 +312,7 @@ views::View* VerticalTabStripRegionView:
}
TabDragContext* VerticalTabStripRegionView::GetDragContext() {
@@ -59,7 +59,7 @@ Cr-Commit-Position: refs/heads/main@{#1574955}
}
std::optional<BrowserRootView::DropIndex>
@@ -517,13 +520,17 @@ TabDragTarget* VerticalTabStripRegionVie
@@ -525,13 +528,17 @@ TabDragTarget* VerticalTabStripRegionVie
if (!drag_handler_) {
return nullptr;
}
@@ -25,7 +25,7 @@ Cr-Commit-Position: refs/heads/main@{#1576224}
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -198,35 +198,31 @@ void VerticalTabStripRegionView::ResetTa
@@ -204,35 +204,31 @@ void VerticalTabStripRegionView::ResetTa
}
bool VerticalTabStripRegionView::IsTabStripEditable() const {
@@ -0,0 +1,110 @@
From c85037d93ebf287dd174f7917e2aeb71f49a4314 Mon Sep 17 00:00:00 2001
From: thomas lukaszewicz <tluk@chromium.org>
Date: Wed, 28 Jan 2026 21:15:23 -0800
Subject: [PATCH] Add ScrollView::RequestSuccessfulPresentationTimeForNextFrame()
This CL adds a new API that enables clients to respond to changes in
scroll view content bounds.
This is intended to be used in combination with ScrollView scroll
APIs (e.g. ScrollToOffset(), ScrollByOffset()) where it is necessary
for the content bounds to have been updated for offsets to be
computed correctly.
The associated callback must wait for the compositor to generate
the next frame. This is necessary as layer scroll calculations
require the compositor to update layer information.
Bug: 459824840
Change-Id: If9cfb74e8982cc63440cc257b35f9fe3039eb7ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7528853
Commit-Queue: Tom Lukaszewicz <tluk@chromium.org>
Reviewed-by: Keren Zhu <kerenzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1576368}
---
--- a/ui/views/controls/scroll_view.cc
+++ b/ui/views/controls/scroll_view.cc
@@ -927,6 +927,22 @@ void ScrollView::Layout(PassKey) {
post_layout_callback_.Run(this);
CHECK_EQ(layout_needed, needs_layout());
}
+
+ if (next_successful_frame_post_layout_callback_) {
+ // Layout should only occur to Widget parented Views.
+ views::Widget* const widget = GetWidget();
+ CHECK(widget);
+ widget->GetCompositor()->RequestSuccessfulPresentationTimeForNextFrame(
+ base::BindOnce(
+ [](base::WeakPtr<ScrollView> self, base::OnceClosure callback,
+ const viz::FrameTimingDetails& frame_timing_details) {
+ if (self) {
+ std::move(callback).Run();
+ }
+ },
+ weak_ptr_factory_.GetWeakPtr(),
+ std::move(next_successful_frame_post_layout_callback_)));
+ }
}
bool ScrollView::OnKeyPressed(const ui::KeyEvent& event) {
@@ -1469,6 +1485,11 @@ void ScrollView::RegisterPostLayoutCallb
post_layout_callback_ = post_layout_callback;
}
+void ScrollView::RegisterNextSuccessfulFramePostLayoutCallback(
+ base::OnceClosure callback) {
+ next_successful_frame_post_layout_callback_ = std::move(callback);
+}
+
View* ScrollView::GetContentsViewportForTest() const {
return contents_viewport_;
}
--- a/ui/views/controls/scroll_view.h
+++ b/ui/views/controls/scroll_view.h
@@ -11,6 +11,7 @@
#include "base/callback_list.h"
#include "base/memory/raw_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "ui/color/color_variant.h"
#include "ui/compositor/layer_type.h"
#include "ui/views/controls/focus_ring.h"
@@ -257,9 +258,19 @@ class VIEWS_EXPORT ScrollView : public V
// and to update the scrollbars to reflect the new position.
// The callback should not trigger any new layouts on the scroll view,
// otherwise it will lead to a CHECK failure.
+ // DEPRECATED: Use `RegisterNextSuccessfulFramePostLayoutCallback()` instead.
void RegisterPostLayoutCallback(
base::RepeatingCallback<void(ScrollView*)> post_layout_callback);
+ // Registers a callback that will be invoked after the compositor has
+ // submitted the next successful frame following the next layout pass. Waiting
+ // for the next frame post layout is necessary as a given layout pass will not
+ // be reflected on a content view's layer until a frame has been produced.
+ // Failing to wait for frame production will result in incorrect scroll
+ // behavior of APIs such as `ScrollToOffset()` and `ScrollByOffset()`.
+ void RegisterNextSuccessfulFramePostLayoutCallback(
+ base::OnceClosure callback);
+
bool is_scrolling() const {
return horiz_sb_->is_scrolling() || vert_sb_->is_scrolling();
}
@@ -434,6 +445,8 @@ class VIEWS_EXPORT ScrollView : public V
// Post-layout callback.
base::RepeatingCallback<void(ScrollView*)> post_layout_callback_;
+ base::OnceClosure next_successful_frame_post_layout_callback_;
+
GradientDirection gradient_direction_ = GradientDirection::kNone;
// Track if the leading gradient is shown
@@ -441,6 +454,8 @@ class VIEWS_EXPORT ScrollView : public V
// Track if the trailing gradient is shown
bool is_trailing_gradient_visible_ = false;
+
+ base::WeakPtrFactory<ScrollView> weak_ptr_factory_{this};
};
// When building with GCC this ensures that an instantiation of the
@@ -0,0 +1,323 @@
From 215ae0715affb24f938d45d4f5935bb29ecd9c38 Mon Sep 17 00:00:00 2001
From: thomas lukaszewicz <tluk@chromium.org>
Date: Thu, 29 Jan 2026 02:02:10 -0800
Subject: [PATCH] [Vertical Tabs] Add support for scrolling to activated tabs
This CL adds support for scrolling into view activated tabs across
both pinned and unpinned collections.
This CL handles cases where tabs may be present in nested collections
(such as tab groups or split tabs).
A static method was added to the animating layout manager that allows
querying for view target bounds, independent of any animations that
may currently be in progress.
See video below
http://screencast/cast/NDc0Nzk2OTUzMzMxMzAyNHwxNTA4OTI3Zi1mNw
Bug: 459824840, 475613765
Change-Id: I69fa14c6c515db50583bc0b470e043077843c888
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7530416
Reviewed-by: Eshwar Stalin <estalin@chromium.org>
Commit-Queue: Tom Lukaszewicz <tluk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1576442}
---
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -431,6 +431,7 @@ views::View* VerticalTabStripRegionView:
views::MaximumFlexSizeRule::kUnbounded));
tab_strip_view_->SetProperty(views::kMarginsKey,
gfx::Insets::VH(kRegionVerticalPadding, 0));
+ tab_strip_view_->InitializeTabStrip(*tab_strip_model_);
std::optional<size_t> separator_index = GetIndexOf(top_button_separator_);
CHECK(separator_index.has_value());
ReorderChildView(tab_strip_view_, separator_index.value() + 1);
--- a/chrome/browser/ui/views/tabs/vertical/BUILD.gn
+++ b/chrome/browser/ui/views/tabs/vertical/BUILD.gn
@@ -16,6 +16,7 @@ source_set("vertical") {
"vertical_split_tab_view.h",
"vertical_tab_strip_bottom_container.h",
"vertical_tab_strip_top_container.h",
+ "vertical_tab_strip_utils.h",
"vertical_tab_strip_view.h",
"vertical_unpinned_tab_container_view.h",
]
@@ -52,6 +53,7 @@ source_set("impl") {
"vertical_tab_group_view.h",
"vertical_tab_strip_bottom_container.cc",
"vertical_tab_strip_top_container.cc",
+ "vertical_tab_strip_utils.cc",
"vertical_tab_strip_view.cc",
"vertical_tab_view.cc",
"vertical_tab_view.h",
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_utils.cc
@@ -0,0 +1,37 @@
+// Copyright 2026 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_utils.h"
+
+#include "chrome/browser/ui/views/tabs/vertical/tab_collection_animating_layout_manager.h"
+#include "chrome/browser/ui/views/tabs/vertical/vertical_pinned_tab_container_view.h"
+#include "chrome/browser/ui/views/tabs/vertical/vertical_tab_group_view.h"
+#include "chrome/browser/ui/views/tabs/vertical/vertical_unpinned_tab_container_view.h"
+#include "ui/views/view.h"
+#include "ui/views/view_utils.h"
+
+gfx::Rect GetVerticalTabStripViewTargetBounds(const views::View* view) {
+ CHECK(view);
+
+ const views::View* const parent = view->parent();
+ const auto has_animating_layout_manager = [](const views::View* container) {
+ // New clients of `TabCollectionAnimatingLayoutManager` should be added to
+ // this list as usage expands.
+ return views::IsViewClass<VerticalPinnedTabContainerView>(container) ||
+ views::IsViewClass<VerticalUnpinnedTabContainerView>(container) ||
+ views::IsViewClass<VerticalTabGroupView>(container);
+ };
+ if (!parent || !has_animating_layout_manager(parent)) {
+ return view->bounds();
+ }
+
+ const auto* const layout_manager =
+ static_cast<const TabCollectionAnimatingLayoutManager*>(
+ parent->GetLayoutManager());
+ CHECK(layout_manager);
+
+ const views::ChildLayout* const view_layout =
+ layout_manager->target_layout().GetLayoutFor(view);
+ return view_layout ? view_layout->bounds : view->bounds();
+}
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_utils.h
@@ -0,0 +1,20 @@
+// Copyright 2026 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_VERTICAL_VERTICAL_TAB_STRIP_UTILS_H_
+#define CHROME_BROWSER_UI_VIEWS_TABS_VERTICAL_VERTICAL_TAB_STRIP_UTILS_H_
+
+#include "ui/gfx/geometry/rect.h"
+
+namespace views {
+class View;
+}
+
+// Returns the target bounds for the provided `view` in the vertical tab strip
+// hierarchy. For views managed by `TabCollectionAnimatingLayoutManager` this
+// may differ from current `View::bounds()` due to animated transitions. For
+// other views the current bounds will be returned.
+gfx::Rect GetVerticalTabStripViewTargetBounds(const views::View* view);
+
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_VERTICAL_VERTICAL_TAB_STRIP_UTILS_H_
--- a/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_view.cc
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_view.cc
@@ -9,8 +9,10 @@
#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/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/tabs/vertical/tab_collection_node.h"
#include "chrome/browser/ui/views/tabs/vertical/vertical_pinned_tab_container_view.h"
+#include "chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_utils.h"
#include "chrome/browser/ui/views/tabs/vertical/vertical_unpinned_tab_container_view.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/color/color_id.h"
@@ -22,6 +24,7 @@
#include "ui/views/layout/proposed_layout.h"
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"
+#include "ui/views/view_tracker.h"
#include "ui/views/view_utils.h"
namespace {
@@ -38,7 +41,8 @@ void SetScrollViewProperties(views::Scro
}
} // namespace
-VerticalTabStripView::VerticalTabStripView(TabCollectionNode* collection_node) {
+VerticalTabStripView::VerticalTabStripView(TabCollectionNode* collection_node)
+ : collection_node_(collection_node) {
SetLayoutManager(std::make_unique<views::DelegatingLayoutManager>(this));
SetProperty(views::kElementIdentifierKey, kTabStripElementId);
@@ -59,6 +63,10 @@ VerticalTabStripView::VerticalTabStripVi
collection_node->set_remove_child_from_node(base::BindRepeating(
&VerticalTabStripView::RemoveScrollViewContents, base::Unretained(this)));
+
+ node_destroyed_subscription_ =
+ collection_node_->RegisterWillDestroyCallback(base::BindOnce(
+ &VerticalTabStripView::ResetCollectionNode, base::Unretained(this)));
}
VerticalTabStripView::~VerticalTabStripView() = default;
@@ -138,6 +146,33 @@ views::ProposedLayout VerticalTabStripVi
return layouts;
}
+void VerticalTabStripView::OnTabStripModelChanged(
+ TabStripModel* tab_strip_model,
+ const TabStripModelChange& change,
+ const TabStripSelectionChange& selection) {
+ if (collection_node_ && selection.active_tab_changed() && selection.new_tab) {
+ TabCollectionNode* activated_node =
+ collection_node_->GetNodeForHandle(selection.new_tab->GetHandle());
+ CHECK(activated_node);
+
+ if (pinned_tabs_container_view_->Contains(activated_node->view())) {
+ pinned_tabs_scroll_view_->RegisterNextSuccessfulFramePostLayoutCallback(
+ base::BindOnce(
+ &VerticalTabStripView::DidPresentFramePostActivation,
+ base::Unretained(this), pinned_tabs_scroll_view_,
+ std::make_unique<views::ViewTracker>(activated_node->view())));
+ } else {
+ // Views must either be in the pinned or unpinned view trees.
+ DCHECK(unpinned_tabs_container_view_->Contains(activated_node->view()));
+ unpinned_tabs_scroll_view_->RegisterNextSuccessfulFramePostLayoutCallback(
+ base::BindOnce(
+ &VerticalTabStripView::DidPresentFramePostActivation,
+ base::Unretained(this), unpinned_tabs_scroll_view_,
+ std::make_unique<views::ViewTracker>(activated_node->view())));
+ }
+ }
+}
+
VerticalPinnedTabContainerView* VerticalTabStripView::GetPinnedTabsContainer() {
return pinned_tabs_container_view_;
}
@@ -194,6 +229,12 @@ bool VerticalTabStripView::IsPositionInW
return true;
}
+void VerticalTabStripView::InitializeTabStrip(TabStripModel& tab_strip_model) {
+ // TODO(crbug.com/452120900): TabStripModelObserver auto-unregisters in its
+ // destructor.
+ tab_strip_model.AddObserver(this);
+}
+
views::View* VerticalTabStripView::AddScrollViewContents(
std::unique_ptr<views::View> view) {
if (auto* container =
@@ -226,5 +267,46 @@ void VerticalTabStripView::RemoveScrollV
NOTREACHED();
}
+void VerticalTabStripView::ResetCollectionNode() {
+ collection_node_ = nullptr;
+}
+
+void VerticalTabStripView::DidPresentFramePostActivation(
+ views::ScrollView* scroll_view,
+ std::unique_ptr<views::ViewTracker> view_tracker) {
+ views::View* const activated_view = view_tracker->view();
+
+ // Guard against views being removed from the tree between frames.
+ if (!activated_view || !Contains(activated_view)) {
+ return;
+ }
+
+ // Get view bounds in its contents coordinates.
+ gfx::Rect activated_view_bounds =
+ GetVerticalTabStripViewTargetBounds(activated_view);
+
+ // Proceed up the hierarchy until the content view is reached, iteratively
+ // adjusting target view bounds.
+ for (views::View* v = activated_view->parent(); v != scroll_view->contents();
+ v = v->parent()) {
+ activated_view_bounds =
+ views::View::ConvertRectToTarget(v, v->parent(), activated_view_bounds);
+ }
+
+ // Get the visible bounds of the content view.
+ const gfx::Rect visible_contents_rect = scroll_view->GetVisibleRect();
+
+ // Determine the adjustment required to fit the activated view into the
+ // visible content view bounds.
+ gfx::Rect adjusted_activated_view_bounds = activated_view_bounds;
+ adjusted_activated_view_bounds.AdjustToFit(visible_contents_rect);
+
+ // Calculate the required scroll offset for the visible content bounds (the
+ // reverse of the activated view adjustment).
+ int diff = activated_view_bounds.y() - adjusted_activated_view_bounds.y();
+
+ scroll_view->ScrollByOffset({0, static_cast<float>(diff)});
+}
+
BEGIN_METADATA(VerticalTabStripView)
END_METADATA
--- a/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_view.h
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_view.h
@@ -6,11 +6,13 @@
#define CHROME_BROWSER_UI_VIEWS_TABS_VERTICAL_VERTICAL_TAB_STRIP_VIEW_H_
#include "base/memory/raw_ptr.h"
+#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/layout/delegating_layout_manager.h"
#include "ui/views/view.h"
class TabCollectionNode;
+class TabStripModel;
class VerticalPinnedTabContainerView;
class VerticalUnpinnedTabContainerView;
@@ -18,11 +20,13 @@ namespace views {
class ScrollView;
class Separator;
class View;
+class ViewTracker;
} // namespace views
// Container that holds the pinned and unpinned tabs in the vertical tab strip.
class VerticalTabStripView final : public views::View,
- public views::LayoutDelegate {
+ public views::LayoutDelegate,
+ public TabStripModelObserver {
METADATA_HEADER(VerticalTabStripView, views::View)
public:
@@ -39,14 +43,30 @@ class VerticalTabStripView final : publi
bool IsPositionInWindowCaption(const gfx::Point& point);
+ void InitializeTabStrip(TabStripModel& tab_strip_model);
+
// LayoutDelegate:
views::ProposedLayout CalculateProposedLayout(
const views::SizeBounds& size_bounds) const override;
+ // TabStripModelObserver:
+ void OnTabStripModelChanged(
+ TabStripModel* tab_strip_model,
+ const TabStripModelChange& change,
+ const TabStripSelectionChange& selection) override;
+
private:
views::View* AddScrollViewContents(std::unique_ptr<views::View> view);
void RemoveScrollViewContents(views::View* view);
+ void ResetCollectionNode();
+
+ // Called when the compositor has successfully presented the next frame
+ // after an activation of `tracked_view` in `scroll_view`.
+ void DidPresentFramePostActivation(
+ views::ScrollView* scroll_view,
+ std::unique_ptr<views::ViewTracker> tracked_view);
+ raw_ptr<TabCollectionNode> collection_node_;
raw_ptr<views::ScrollView> pinned_tabs_scroll_view_ = nullptr;
raw_ptr<VerticalPinnedTabContainerView> pinned_tabs_container_view_ = nullptr;
raw_ptr<views::Separator> tabs_separator_ = nullptr;
@@ -54,6 +74,7 @@ class VerticalTabStripView final : publi
raw_ptr<VerticalUnpinnedTabContainerView> unpinned_tabs_container_view_ =
nullptr;
bool is_collapsed_ = false;
+ base::CallbackListSubscription node_destroyed_subscription_;
};
#endif // CHROME_BROWSER_UI_VIEWS_TABS_VERTICAL_VERTICAL_TAB_STRIP_VIEW_H_
@@ -24,16 +24,16 @@ Cr-Commit-Position: refs/heads/main@{#1578138}
"vertical_tab_strip_bottom_container.h",
+ "vertical_tab_strip_scroll_bar.h",
"vertical_tab_strip_top_container.h",
"vertical_tab_strip_utils.h",
"vertical_tab_strip_view.h",
"vertical_unpinned_tab_container_view.h",
@@ -51,6 +52,7 @@ source_set("impl") {
@@ -52,6 +53,7 @@ source_set("impl") {
"vertical_tab_group_view.cc",
"vertical_tab_group_view.h",
"vertical_tab_strip_bottom_container.cc",
+ "vertical_tab_strip_scroll_bar.cc",
"vertical_tab_strip_top_container.cc",
"vertical_tab_strip_utils.cc",
"vertical_tab_strip_view.cc",
"vertical_tab_view.cc",
--- /dev/null
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_scroll_bar.cc
@@ -0,0 +1,157 @@
@@ -267,15 +267,15 @@ Cr-Commit-Position: refs/heads/main@{#1578138}
+#endif // CHROME_BROWSER_UI_VIEWS_TABS_VERTICAL_VERTICAL_TAB_STRIP_SCROLL_BAR_H_
--- a/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_view.cc
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_view.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/ui/layout_constants.h"
@@ -13,6 +13,7 @@
#include "chrome/browser/ui/views/tabs/vertical/tab_collection_node.h"
#include "chrome/browser/ui/views/tabs/vertical/vertical_pinned_tab_container_view.h"
#include "chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_utils.h"
+#include "chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_scroll_bar.h"
#include "chrome/browser/ui/views/tabs/vertical/vertical_unpinned_tab_container_view.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/color/color_id.h"
@@ -35,6 +36,8 @@ void SetScrollViewProperties(views::Scro
@@ -38,6 +39,8 @@ void SetScrollViewProperties(views::Scro
views::ScrollView::ScrollBarMode::kDisabled);
scroll_view->SetOverflowGradientMask(
views::ScrollView::GradientDirection::kVertical);
@@ -24,7 +24,7 @@ Cr-Commit-Position: refs/heads/main@{#1578230}
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -76,12 +76,17 @@ VerticalTabStripRegionView::VerticalTabS
@@ -82,12 +82,17 @@ VerticalTabStripRegionView::VerticalTabS
AddChildView(std::make_unique<VerticalTabStripTopContainer>(
state_controller_, root_action_item));
@@ -44,7 +44,7 @@ Cr-Commit-Position: refs/heads/main@{#1578230}
gemini_button_ = AddChildView(std::make_unique<views::View>());
resize_area_ = AddChildView(std::make_unique<views::ResizeArea>(this));
@@ -422,7 +427,7 @@ views::View* VerticalTabStripRegionView:
@@ -428,7 +433,7 @@ views::View* VerticalTabStripRegionView:
tab_strip_view_->SetProperty(
views::kFlexBehaviorKey,
views::FlexSpecification(views::MinimumFlexSizeRule::kScaleToZero,
@@ -52,7 +52,7 @@ Cr-Commit-Position: refs/heads/main@{#1578230}
+ views::MaximumFlexSizeRule::kPreferred));
tab_strip_view_->SetProperty(views::kMarginsKey,
gfx::Insets::VH(kRegionVerticalPadding, 0));
std::optional<size_t> separator_index = GetIndexOf(top_button_separator_);
tab_strip_view_->InitializeTabStrip(*tab_strip_model_);
--- a/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_bottom_container.cc
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_bottom_container.cc
@@ -114,6 +114,9 @@ void VerticalTabStripBottomContainer::Up
@@ -67,7 +67,7 @@ Cr-Commit-Position: refs/heads/main@{#1578230}
// If collapsed, the tab group button and the new tab button share the same
--- a/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_view.cc
+++ b/chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_view.cc
@@ -26,9 +26,6 @@
@@ -29,9 +29,6 @@
#include "ui/views/view_utils.h"
namespace {
@@ -77,7 +77,7 @@ Cr-Commit-Position: refs/heads/main@{#1578230}
void SetScrollViewProperties(views::ScrollView* scroll_view) {
scroll_view->SetUseContentsPreferredSize(true);
scroll_view->SetBackgroundColor(std::nullopt);
@@ -69,49 +66,75 @@ VerticalTabStripView::~VerticalTabStripV
@@ -77,49 +74,75 @@ VerticalTabStripView::~VerticalTabStripV
views::ProposedLayout VerticalTabStripView::CalculateProposedLayout(
const views::SizeBounds& size_bounds) const {
views::ProposedLayout layouts;
@@ -176,7 +176,7 @@ Cr-Commit-Position: refs/heads/main@{#1578230}
int separator_width =
size_bounds.width().value() - 2 * region_horizontal_padding;
gfx::Rect tabs_separator_bounds(
@@ -120,7 +143,7 @@ views::ProposedLayout VerticalTabStripVi
@@ -128,7 +151,7 @@ views::ProposedLayout VerticalTabStripVi
layouts.child_layouts.emplace_back(tabs_separator_.get(), true,
tabs_separator_bounds);
@@ -185,7 +185,7 @@ Cr-Commit-Position: refs/heads/main@{#1578230}
} else {
layouts.child_layouts.emplace_back(tabs_separator_.get(), false,
gfx::Rect());
@@ -131,13 +154,17 @@ views::ProposedLayout VerticalTabStripVi
@@ -139,13 +162,17 @@ views::ProposedLayout VerticalTabStripVi
// strip is collapsed, tab groups need to draw the group colored line in this
// space.
gfx::Rect unpinned_container_bounds(0, y, size_bounds.width().value(),
@@ -55,7 +55,7 @@ Cr-Commit-Position: refs/heads/main@{#1578463}
virtual const TabRendererData& GetTabRendererData(int tab_index) = 0;
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -222,14 +222,6 @@ bool VerticalTabStripRegionView::IsTabSt
@@ -228,14 +228,6 @@ bool VerticalTabStripRegionView::IsTabSt
return !drag_controller || drag_controller->IsMovingLastTab();
}
@@ -17,7 +17,7 @@ Cr-Commit-Position: refs/heads/main@{#1579815}
--- a/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
+++ b/chrome/browser/ui/views/frame/vertical_tab_strip_region_view.cc
@@ -383,6 +383,10 @@ bool VerticalTabStripRegionView::IsPosit
@@ -389,6 +389,10 @@ bool VerticalTabStripRegionView::IsPosit
if (child == tab_strip_view_) {
return tab_strip_view_->IsPositionInWindowCaption(point_in_child);
}
@@ -0,0 +1,33 @@
--- a/chrome/browser/ui/views/tabs/tab_icon.cc
+++ b/chrome/browser/ui/views/tabs/tab_icon.cc
@@ -13,17 +13,12 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/favicon/favicon_utils.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/browser_finder.h"
-#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_renderer_data.h"
-#include "chrome/browser/ui/user_education/browser_user_education_interface.h"
#include "chrome/browser/ui/views/dotted_icon.h"
#include "chrome/common/webui_url_constants.h"
-#include "components/feature_engagement/public/feature_constants.h"
#include "components/grit/components_scaled_resources.h"
#include "components/performance_manager/public/user_tuning/prefs.h"
#include "components/prefs/pref_service.h"
@@ -478,12 +473,6 @@ void TabIcon::SetDiscarded(bool discarde
gfx::Animation::RichAnimationDuration(base::Seconds(1)));
tab_discard_animation_.Start();
favicon_size_animation_.Hide();
-
- // Potentially show an IPH if a tab was discarded.
- Browser* browser = chrome::FindBrowserWithUiElementContext(
- views::ElementTrackerViews::GetInstance()->GetContextForView(this));
- BrowserUserEducationInterface::From(browser)->MaybeShowFeaturePromo(
- feature_engagement::kIPHDiscardRingFeature);
} else {
tab_discard_animation_.Stop();
favicon_size_animation_.Show();
+1 -1
View File
@@ -1 +1 @@
2
3