From bcdd114f548197347afb5fd2e43c909360929116 Mon Sep 17 00:00:00 2001 From: Simon Hong Date: Tue, 30 Jan 2024 06:12:12 +0900 Subject: [PATCH] Omnibox changes (location bar height, inkdrop color, icon changes) (uplift to 1.62.x) (#21761) * Merge pull request #21722 from brave/update_http_icon Updated http icon * Updated omnibox chip button's background color in light mode (#21637) fix https://github.com/brave/brave-browser/issues/35358 * Merge pull request #21721 from brave/adjust_location_bar_height Use 32px for location bar height * Merge pull request #21729 from brave/brave_actions_highlight Fixed to have proper inkdrop size for browser actions --- browser/ui/brave_layout_constants.cc | 5 +++-- browser/ui/color/brave_color_mixer.cc | 6 ++++++ .../brave_actions/brave_actions_container.cc | 15 +++++++-------- .../views/brave_actions/brave_actions_container.h | 1 + .../brave_actions/brave_rewards_action_view.cc | 4 ++-- .../brave_actions/brave_shields_action_view.cc | 2 +- .../ui/views/location_bar/location_bar_view.cc | 4 ++-- vector_icons/leo_overrides.json | 2 +- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/browser/ui/brave_layout_constants.cc b/browser/ui/brave_layout_constants.cc index b8b45177c1da..7554e9cf20d0 100644 --- a/browser/ui/brave_layout_constants.cc +++ b/browser/ui/brave_layout_constants.cc @@ -37,9 +37,10 @@ absl::optional GetBraveLayoutConstant(LayoutConstant constant) { return 24; } case LOCATION_BAR_HEIGHT: - return touch ? 36 : 34; + // Consider adjust below element padding also when this height is changed. + return 32; case LOCATION_BAR_ELEMENT_PADDING: - return 4; + return 2; default: break; } diff --git a/browser/ui/color/brave_color_mixer.cc b/browser/ui/color/brave_color_mixer.cc index 4388de002d08..34891f43d856 100644 --- a/browser/ui/color/brave_color_mixer.cc +++ b/browser/ui/color/brave_color_mixer.cc @@ -242,6 +242,12 @@ void AddChromeLightThemeColorMixer(ui::ColorProvider* provider, ui::kColorFocusableBorderFocused}; mixer[kColorTabFocusRingActive] = {ui::kColorFocusableBorderFocused}; mixer[kColorTabFocusRingInactive] = {ui::kColorFocusableBorderFocused}; + + // Upstream uses tab's background color as omnibox chip background color. + // In our light mode, there is no difference between location bar's bg + // color and tab's bg color. So, it looks like chip's bg color is transparent. + // Use frame color as chip background to have different bg color. + mixer[kColorOmniboxChipBackground] = {kLightFrame}; } void AddChromeDarkThemeColorMixer(ui::ColorProvider* provider, diff --git a/browser/ui/views/brave_actions/brave_actions_container.cc b/browser/ui/views/brave_actions/brave_actions_container.cc index 66f501b24764..82fc5a9b42ba 100644 --- a/browser/ui/views/brave_actions/brave_actions_container.cc +++ b/browser/ui/views/brave_actions/brave_actions_container.cc @@ -23,12 +23,6 @@ #include "ui/views/layout/box_layout.h" #include "ui/views/view.h" -namespace { - -constexpr gfx::Size kToolbarActionSize(34, 30); - -} // namespace - BraveActionsContainer::BraveActionsContainer(Browser* browser, Profile* profile) : browser_(browser) {} @@ -84,14 +78,14 @@ void BraveActionsContainer::AddActionViewForShields() { AddChildViewAt(std::make_unique( *browser_->profile(), *browser_->tab_strip_model()), 1); - shields_action_btn_->SetPreferredSize(kToolbarActionSize); + shields_action_btn_->SetPreferredSize(GetActionSize()); shields_action_btn_->Init(); } void BraveActionsContainer::AddActionViewForRewards() { auto button = std::make_unique(browser_); rewards_action_btn_ = AddChildViewAt(std::move(button), 2); - rewards_action_btn_->SetPreferredSize(kToolbarActionSize); + rewards_action_btn_->SetPreferredSize(GetActionSize()); rewards_action_btn_->SetVisible(ShouldShowBraveRewardsAction()); rewards_action_btn_->Update(); } @@ -125,6 +119,11 @@ void BraveActionsContainer::UpdateVisibility() { SetVisible(!should_hide_ && can_show); } +gfx::Size BraveActionsContainer::GetActionSize() const { + return {34, GetLayoutConstant(LOCATION_BAR_HEIGHT) - + 2 * GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING)}; +} + void BraveActionsContainer::SetShouldHide(bool should_hide) { should_hide_ = should_hide; Update(); diff --git a/browser/ui/views/brave_actions/brave_actions_container.h b/browser/ui/views/brave_actions/brave_actions_container.h index 49b626658005..3cdd10a3d084 100644 --- a/browser/ui/views/brave_actions/brave_actions_container.h +++ b/browser/ui/views/brave_actions/brave_actions_container.h @@ -61,6 +61,7 @@ class BraveActionsContainer : public views::View { void AddActionViewForShields(); void UpdateVisibility(); + gfx::Size GetActionSize() const; // Brave Rewards preferences change observers callback. void OnBraveRewardsPreferencesChanged(); diff --git a/browser/ui/views/brave_actions/brave_rewards_action_view.cc b/browser/ui/views/brave_actions/brave_rewards_action_view.cc index 925b9e3bf092..d833871b3694 100644 --- a/browser/ui/views/brave_actions/brave_rewards_action_view.cc +++ b/browser/ui/views/brave_actions/brave_rewards_action_view.cc @@ -68,8 +68,8 @@ class ButtonHighlightPathGenerator : public views::HighlightPathGenerator { auto* layout_provider = ChromeLayoutProvider::Get(); DCHECK(layout_provider); - int radius = layout_provider->GetCornerRadiusMetric( - views::Emphasis::kMaximum, rect.size()); + int radius = layout_provider->GetCornerRadiusMetric(views::Emphasis::kHigh, + rect.size()); SkPath path; path.addRoundRect(gfx::RectToSkRect(rect), radius, radius); diff --git a/browser/ui/views/brave_actions/brave_shields_action_view.cc b/browser/ui/views/brave_actions/brave_shields_action_view.cc index 623382c5614d..5576f1109e9c 100644 --- a/browser/ui/views/brave_actions/brave_shields_action_view.cc +++ b/browser/ui/views/brave_actions/brave_shields_action_view.cc @@ -112,7 +112,7 @@ SkPath BraveShieldsActionView::GetHighlightPath() const { gfx::Rect rect(GetPreferredSize()); rect.Inset(highlight_insets); const int radii = ChromeLayoutProvider::Get()->GetCornerRadiusMetric( - views::Emphasis::kMaximum, rect.size()); + views::Emphasis::kHigh, rect.size()); SkPath path; path.addRoundRect(gfx::RectToSkRect(rect), radii, radii); return path; diff --git a/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view.cc index 822d6769074c..65c08048d9b2 100644 --- a/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -10,13 +10,13 @@ #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" // |icon_left| - Padding between left border of location bar and first -// decoration. Use fixed 4px always. +// decoration. Use element padding. // |text_left| - Padding between omnibox view and last leading decoration. // If last decoration has label, it has sufficient padding inside. // If custom padding is provided(text_left is not null), respect // it. Otherwise, set our design value - 5px. #define BRAVE_LAYOUT_LEADING_DECORATIONS \ - icon_left = 4; \ + icon_left = GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING); \ if (text_left == 0 && !location_icon_view_->ShouldShowLabel()) { \ text_left = 5; \ } diff --git a/vector_icons/leo_overrides.json b/vector_icons/leo_overrides.json index 7067a0b40898..ee428a9af761 100644 --- a/vector_icons/leo_overrides.json +++ b/vector_icons/leo_overrides.json @@ -11,7 +11,7 @@ "//chrome/app/vector_icons/zoom_plus.icon": "leo_search_zoom_in", "//components/omnibox/browser/vector_icons/bookmark.icon": "leo_browser_bookmark_normal", "//components/omnibox/browser/vector_icons/find_in_page.icon": "leo_window_search", - "//components/omnibox/browser/vector_icons/http.icon": "leo_warning_circle_filled", + "//components/omnibox/browser/vector_icons/http.icon": "leo_info_filled", "//components/omnibox/browser/vector_icons/install_desktop.icon": "leo_pwa_install", "//components/omnibox/browser/vector_icons/share_mac.icon": "leo_share_macos", "//components/omnibox/browser/vector_icons/share_win.icon": "leo_share_windows",