BraveConfirmInfoBar used to inherit from InfoBarView, so its layout changed with upstream's features::kInfobarRefresh — vertical centering, label/link gaps, icon offset and multi-line height all shifted between the flag-off and flag-on states. As we're using BraveConfirmInfoBar for our specific info bar only, we don't need to get suffer from upstream's view change over time. We can go with our own custom view based on infobars::InfoBar interface. Replace the base class with direct multi-inheritance from infobars::InfoBar, views::View and views::ExternalFocusTracker, and implement Layout / CalculatePreferredSize / OnThemeChanged / PlatformSpecific* ourselves. The visual is now identical regardless of the upstream flag and we no longer depend on InfoBarView's internal structure. Resolves - subtask of brave/brave-browser#48822 No regressions on existing infobars that uses BraveConfirmInfoBar.
29 lines
1.1 KiB
C++
29 lines
1.1 KiB
C++
/* Copyright (c) 2025 The Brave Authors. All rights reserved.
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef BRAVE_CHROMIUM_SRC_UI_VIEWS_VIEW_H_
|
|
#define BRAVE_CHROMIUM_SRC_UI_VIEWS_VIEW_H_
|
|
|
|
class BraveConfirmInfoBar;
|
|
class SharedPinnedTabDummyView;
|
|
|
|
// DO NOT ADD TO THIS LIST!
|
|
// These existing cases are "grandfathered in", but there shouldn't be more.
|
|
// See comments atop View class in ui/views/view.h.
|
|
//
|
|
// BraveConfirmInfoBar is added here for the same reason ::InfoBarView is on
|
|
// upstream's list: it is an infobars::InfoBar implementation whose lifetime
|
|
// is governed by infobars::InfoBarManager, not by its parent View.
|
|
// Remove when upstream resolves ownership issue from ConfirmInfoBar.
|
|
#define BRAVE_VIEW_OWNED_BY_CLIENT_PASS_KEY \
|
|
friend class ::BraveConfirmInfoBar; \
|
|
friend class ::SharedPinnedTabDummyView;
|
|
|
|
#include <ui/views/view.h> // IWYU pragma: export
|
|
|
|
#undef BRAVE_VIEW_OWNED_BY_CLIENT_PASS_KEY
|
|
|
|
#endif // BRAVE_CHROMIUM_SRC_UI_VIEWS_VIEW_H_
|