Revert "[Browser Layout] Switch to new frame layout API by default"
This reverts commit d031210359bc83e34633a9ec8ebf8fbd44687b69.
Reason for revert: Broke some tests, example failures https://ci.chromium.org/ui/p/chrome/builders/ci/linux-chromeos-chrome/54040/overview
Original change's description:
> [Browser Layout] Switch to new frame layout API by default
>
> This CL:
> - Makes the "use new layout" feature into an always-on killswitch
> - Renames BrowserViewLayoutDelegateImplNew to
> BrowserViewLayoutDelegateImpl
> - Removes references to the feature flag elsewhere
>
> The effect will be that in addition to the flag being on for all CQ
> testbots and ToT builds, it will also be on for Canary, Dev, and CI
> bots.
>
> This should allow us to collect error reports from more users and
> determine if there are any issues with the new logic.
>
> Bug: 443123625
> Change-Id: Id2d7f6818ed1aba1ed8842b24275e0e7dfe0488e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7011507
> Commit-Queue: Dana Fried <dfried@chromium.org>
> Reviewed-by: Darryl James <dljames@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1525685}
Bug: 443123625
Change-Id: Ic93ddf8fb9b49299ed8504ef4b75163db23e0d99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7016627
Auto-Submit: Ivan Šandrk <isandrk@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Ivan Šandrk <isandrk@chromium.org>
Commit-Queue: Ivan Šandrk <isandrk@chromium.org>
Owners-Override: Ivan Šandrk <isandrk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1526174}
diff --git a/chrome/browser/ui/ui_features.cc b/chrome/browser/ui/ui_features.cc
index 55a439d0..1e594bb5 100644
--- a/chrome/browser/ui/ui_features.cc
+++ b/chrome/browser/ui/ui_features.cc
@@ -44,6 +44,12 @@
BASE_FEATURE(kFewerUpdateConfirmations, base::FEATURE_ENABLED_BY_DEFAULT);
#endif
+#if !BUILDFLAG(IS_ANDROID)
+BASE_FEATURE(kDesktopNewTopAreaLayoutFeature,
+ "DesktopNewTopAreaLayout",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+#endif
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
BASE_FEATURE(kExtensionsCollapseMainMenu, base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/chrome/browser/ui/ui_features.h b/chrome/browser/ui/ui_features.h
index 5ba42f8..3c4c8cc0 100644
--- a/chrome/browser/ui/ui_features.h
+++ b/chrome/browser/ui/ui_features.h
@@ -34,6 +34,11 @@
BASE_DECLARE_FEATURE(kFewerUpdateConfirmations);
#endif
+#if !BUILDFLAG(IS_ANDROID)
+// Feature that manages the transition between old and new browser layout.
+BASE_DECLARE_FEATURE(kDesktopNewTopAreaLayoutFeature);
+#endif
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Controls how extensions show up in the main menu. When enabled, if the
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index 37972c8..9cacfda 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -886,7 +886,7 @@
private:
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
// interface to keep these two classes decoupled and testable.
- friend class BrowserViewLayoutDelegateImpl;
+ friend class BrowserViewLayoutDelegateImplNew;
friend class BrowserViewLayoutDelegateImplOld;
friend class BrowserViewLayoutDelegateImplBrowsertest;
friend class TopControlsSlideControllerTest;
diff --git a/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl.cc b/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl.cc
index 74e1638..96f32b6d 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl.cc
+++ b/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl.cc
@@ -20,19 +20,11 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/views/view.h"
-namespace {
-
-// Feature that manages the transition between old and current browser layout
-// delegate. This feature is on by default and provided only as a killswitch.
-BASE_FEATURE(kDesktopNewTopAreaLayoutFeature, base::FEATURE_ENABLED_BY_DEFAULT);
-
-} // namespace
-
// static
std::unique_ptr<BrowserViewLayoutDelegate>
BrowserViewLayoutDelegateImplBase::CreateDelegate(BrowserView& browser_view) {
- if (base::FeatureList::IsEnabled(kDesktopNewTopAreaLayoutFeature)) {
- return std::make_unique<BrowserViewLayoutDelegateImpl>(browser_view);
+ if (base::FeatureList::IsEnabled(features::kDesktopNewTopAreaLayoutFeature)) {
+ return std::make_unique<BrowserViewLayoutDelegateImplNew>(browser_view);
}
return std::make_unique<BrowserViewLayoutDelegateImplOld>(browser_view);
}
@@ -233,13 +225,14 @@
return gfx::ToEnclosingRect(bounds_f);
}
-BrowserViewLayoutDelegateImpl::BrowserViewLayoutDelegateImpl(
+BrowserViewLayoutDelegateImplNew::BrowserViewLayoutDelegateImplNew(
BrowserView& browser_view)
: BrowserViewLayoutDelegateImplBase(browser_view) {}
-BrowserViewLayoutDelegateImpl::~BrowserViewLayoutDelegateImpl() = default;
+BrowserViewLayoutDelegateImplNew::~BrowserViewLayoutDelegateImplNew() = default;
gfx::Rect
-BrowserViewLayoutDelegateImpl::GetBoundsForTabStripRegionInBrowserView() const {
+BrowserViewLayoutDelegateImplNew::GetBoundsForTabStripRegionInBrowserView()
+ const {
const gfx::Size tabstrip_minimum_size =
browser_view().tab_strip_view()->GetMinimumSize();
const auto layout = GetFrameView()->GetBrowserLayoutParams();
@@ -267,7 +260,7 @@
}
gfx::Rect
-BrowserViewLayoutDelegateImpl::GetBoundsForToolbarInVerticalTabBrowserView()
+BrowserViewLayoutDelegateImplNew::GetBoundsForToolbarInVerticalTabBrowserView()
const {
const gfx::Size toolbar_preferred_size =
browser_view().toolbar()->GetPreferredSize();
@@ -293,7 +286,7 @@
}
gfx::Rect
-BrowserViewLayoutDelegateImpl::GetBoundsForWebAppFrameToolbarInBrowserView()
+BrowserViewLayoutDelegateImplNew::GetBoundsForWebAppFrameToolbarInBrowserView()
const {
if (!GetFrameView()->ShouldShowWebAppFrameToolbar()) {
return gfx::Rect();
diff --git a/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl.h b/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl.h
index 7024047..8aa7c4c3 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl.h
+++ b/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl.h
@@ -77,10 +77,11 @@
// The new implementation of the layout delegate; uses new BrowserLayoutParams
// API.
-class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegateImplBase {
+class BrowserViewLayoutDelegateImplNew
+ : public BrowserViewLayoutDelegateImplBase {
public:
- explicit BrowserViewLayoutDelegateImpl(BrowserView& browser_view);
- ~BrowserViewLayoutDelegateImpl() override;
+ explicit BrowserViewLayoutDelegateImplNew(BrowserView& browser_view);
+ ~BrowserViewLayoutDelegateImplNew() override;
gfx::Rect GetBoundsForTabStripRegionInBrowserView() const override;
gfx::Rect GetBoundsForToolbarInVerticalTabBrowserView() const override;
diff --git a/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl_browsertest.cc b/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl_browsertest.cc
index 1086bc2..7610dabe 100644
--- a/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl_browsertest.cc
+++ b/chrome/browser/ui/views/frame/browser_view_layout_delegate_impl_browsertest.cc
@@ -157,7 +157,7 @@
auto* const layout = browser_view->GetBrowserViewLayout();
if (use_new_delegate) {
layout->SetDelegateForTesting(
- std::make_unique<BrowserViewLayoutDelegateImpl>(*browser_view));
+ std::make_unique<BrowserViewLayoutDelegateImplNew>(*browser_view));
} else {
layout->SetDelegateForTesting(
std::make_unique<BrowserViewLayoutDelegateImplOld>(*browser_view));
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
index 78da6ba..419e86c1 100644
--- a/testing/variations/fieldtrial_testing_config.json
+++ b/testing/variations/fieldtrial_testing_config.json
@@ -8488,6 +8488,24 @@
]
}
],
+ "DesktopNewTopAreaLayout": [
+ {
+ "platforms": [
+ "chromeos",
+ "linux",
+ "mac",
+ "windows"
+ ],
+ "experiments": [
+ {
+ "name": "Enabled",
+ "enable_features": [
+ "DesktopNewTopAreaLayout"
+ ]
+ }
+ ]
+ }
+ ],
"DesktopNtpDriveCache": [
{
"platforms": [