diff --git a/browser/ui/views/toolbar/brave_toolbar_view.cc b/browser/ui/views/toolbar/brave_toolbar_view.cc index def3768ecd9..2861e3d6db4 100644 --- a/browser/ui/views/toolbar/brave_toolbar_view.cc +++ b/browser/ui/views/toolbar/brave_toolbar_view.cc @@ -163,10 +163,10 @@ void BraveToolbarView::Init() { // See brave_non_client_hit_test_helper.h views::SetHitTestComponent(this, HTCAPTION); - DCHECK(location_bar_); - // Get ToolbarView's container_view as a parent of location_bar_ because + DCHECK(location_bar_view_); + // Get ToolbarView's container_view as a parent of location_bar_view_ because // container_view's type in ToolbarView is internal to toolbar_view.cc. - views::View* container_view = location_bar_->parent(); + views::View* container_view = location_bar_view_->parent(); DCHECK(container_view); views::SetHitTestComponent(container_view, HTCAPTION); @@ -258,7 +258,7 @@ void BraveToolbarView::Init() { bookmark_ = container_view->AddChildViewAt( std::make_unique( base::BindRepeating(callback, browser_, IDC_BOOKMARK_THIS_TAB)), - *container_view->GetIndexOf(location_bar_)); + *container_view->GetIndexOf(location_bar_view_)); bookmark_->SetTriggerableEventFlags(ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON); bookmark_->UpdateImageAndText(); @@ -440,10 +440,10 @@ void BraveToolbarView::UpdateHorizontalPadding() { return; } - // Get ToolbarView's container_view as a parent of location_bar_ because + // Get ToolbarView's container_view as a parent of location_bar_view_ because // container_view's type in ToolbarView is internal to toolbar_view.cc. - DCHECK(location_bar_ && location_bar_->parent()); - views::View* container_view = location_bar_->parent(); + DCHECK(location_bar_view_ && location_bar_view_->parent()); + views::View* container_view = location_bar_view_->parent(); if (!tabs::utils::ShouldShowBraveVerticalTabs(browser()) || tabs::utils::ShouldShowWindowTitleForVerticalTabs(browser())) { @@ -462,7 +462,7 @@ void BraveToolbarView::ShowBookmarkBubble(const GURL& url, // Show BookmarkBubble attached to Brave's bookmark button // or the location bar if there is no bookmark button // (i.e. in non-normal display mode). - views::View* anchor_view = location_bar_; + views::View* anchor_view = location_bar_view_; if (bookmark_ && bookmark_->GetVisible()) { anchor_view = bookmark_; } @@ -504,7 +504,7 @@ void BraveToolbarView::Layout(PassKey) { // if wide address bar option is off. // TODO(https://github.com/brave/brave-browser/issues/48810): Refactor to do // layout once. - LayoutGuard guard(static_cast(location_bar_)); + LayoutGuard guard(static_cast(location_bar_view_)); if (!location_bar_is_wide_.GetValue()) { guard.set_ignore_layout(true); } @@ -523,12 +523,13 @@ void BraveToolbarView::ResetLocationBarBounds() { // Calculate proper location bar's margin and set its bounds. const gfx::Insets margin = CalcLocationBarMargin( - width(), location_bar_->width(), location_bar_->GetMinimumSize().width(), - location_bar_->x()); + width(), location_bar_view_->width(), + location_bar_view_->GetMinimumSize().width(), location_bar_view_->x()); - location_bar_->SetBounds( - location_bar_->x() + margin.left(), location_bar_->y(), - location_bar_->width() - margin.width(), location_bar_->height()); + location_bar_view_->SetBounds(location_bar_view_->x() + margin.left(), + location_bar_view_->y(), + location_bar_view_->width() - margin.width(), + location_bar_view_->height()); } void BraveToolbarView::ResetBookmarkButtonBounds() { @@ -540,7 +541,7 @@ void BraveToolbarView::ResetBookmarkButtonBounds() { if (bookmark_ && bookmark_->GetVisible()) { const int bookmark_width = bookmark_->GetPreferredSize().width(); const int bookmark_x = - location_bar_->x() - bookmark_width - button_right_margin; + location_bar_view_->x() - bookmark_width - button_right_margin; bookmark_->SetX(bookmark_x); } } diff --git a/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view.h b/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view.h index 28f5e2e1fc2..011d1c1ed97 100644 --- a/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chromium_src/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -6,15 +6,22 @@ #ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ #define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ -#define BRAVE_LOCATION_BAR_VIEW_H_ \ +#include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" +#include "third_party/metrics_proto/omnibox_event.pb.h" + +#define GetBackgroundColorForTesting \ + Unused(); \ + \ private: \ friend class BraveLocationBarView; \ \ public: \ virtual views::View* GetSearchPromotionButton() const; \ virtual std::vector GetRightMostTrailingViews(); \ - virtual std::vector GetLeftMostTrailingViews(); + virtual std::vector GetLeftMostTrailingViews(); \ + SkColor GetBackgroundColorForTesting +#define Init virtual Init #define OnOmniboxBlurred virtual OnOmniboxBlurred #define GetBorderRadius virtual GetBorderRadius #define RefreshBackground virtual RefreshBackground @@ -22,6 +29,7 @@ #undef RefreshBackground #undef GetBorderRadius #undef OnOmniboxBlurred -#undef BRAVE_LOCATION_BAR_VIEW_H_ +#undef Init +#undef GetBackgroundColorForTesting #endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_BAR_VIEW_H_ diff --git a/patches/chrome-browser-ui-views-location_bar-location_bar_view.h.patch b/patches/chrome-browser-ui-views-location_bar-location_bar_view.h.patch deleted file mode 100644 index 02d149a5e5b..00000000000 --- a/patches/chrome-browser-ui-views-location_bar-location_bar_view.h.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h -index 7b11704e9f09fcf6500feabe000754a056762c5f..778680a9a805311be70fd07561b71cc1bd8000b8 100644 ---- a/chrome/browser/ui/views/location_bar/location_bar_view.h -+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h -@@ -138,6 +138,7 @@ class LocationBarView - int GetBorderRadius() const; - - // Initializes the LocationBarView. -+ virtual - void Init(); - - bool in_popup_state_transition() const { return in_popup_state_transition_; } -@@ -201,6 +202,7 @@ class LocationBarView - - // Updates the controller, and, if |contents| is non-null, restores saved - // state that the tab holds. -+ virtual - void Update(content::WebContents* contents); - - // Clears the location bar's state for |contents|. -@@ -299,6 +301,7 @@ class LocationBarView - GetContentSettingViewsForTest() { - return content_setting_views_; - } -+ BRAVE_LOCATION_BAR_VIEW_H_ - - SkColor GetBackgroundColorForTesting() const { return background_color_; } -