Resolves https://github.com/brave/brave-browser/issues/54158 Adds a new `enable_sidebar_v2` GN arg (default: false) to allow building Brave with upstream's SidePanel class instead of Brave's custom replacement. When `enable_sidebar_v2=true`: - Upstream's SidePanel is compiled in via the chromium_src override mechanism - Brave's custom side_panel.cc and side_panel_resize_widget.cc/.h are excluded via `sources -=` - `kSidebarV2` runtime flag defaults to enabled, and a CHECK at startup asserts it stays that way — disabling it would route into V1-only code paths that no longer exist in this build - Call sites of Brave-specific SidePanel methods (SetHorizontalAlignment, set_fixed_contents_width, UpdateBorder and etc) are guarded with `#if !BUILDFLAG(ENABLE_SIDEBAR_V2)` The default build (enable_sidebar_v2=false) is unchanged. To build: `npm run build -- --gn "enable_sidebar_v2:true"` NOTE: As this PR only enable upstream's SidePanel, our layout/style is not applied yet.
24 lines
785 B
C++
24 lines
785 B
C++
// Copyright (c) 2026 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/.
|
|
|
|
#include "brave/browser/ui/sidebar/features.h"
|
|
|
|
#include "brave/browser/ui/sidebar/buildflags/buildflags.h"
|
|
#include "build/buildflag.h"
|
|
|
|
namespace sidebar::features {
|
|
|
|
// kSidebarV2 is enabled by default when ENABLE_SIDEBAR_V2 buildflag is on,
|
|
// since that build uses upstream's SidePanel and requires V2 behavior.
|
|
BASE_FEATURE(kSidebarV2,
|
|
#if BUILDFLAG(ENABLE_SIDEBAR_V2)
|
|
base::FEATURE_ENABLED_BY_DEFAULT
|
|
#else
|
|
base::FEATURE_DISABLED_BY_DEFAULT
|
|
#endif
|
|
);
|
|
|
|
} // namespace sidebar::features
|