[SxS] Fixing split view insets when infobar is shown

Bug: 421204794
Change-Id: Ic3b9f5e25a418979848bcce00b072ce4478bac1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6606716
Reviewed-by: Caroline Rising <corising@chromium.org>
Commit-Queue: Eshwar Stalin <estalin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1467612}
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 179e9aba..0852d88 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -849,17 +849,25 @@
   void UpdateSplitViewInsets() override {
     CHECK(browser_view_->multi_contents_view());
 
-    browser_view_->multi_contents_view()->start_contents_view_inset().set_left(
-        browser_view_->unified_side_panel()->GetVisible() &&
-                !browser_view_->unified_side_panel()->IsRightAligned()
-            ? 0
-            : MultiContentsView::kSplitViewContentInset);
+    bool side_panel_visible = browser_view_->unified_side_panel()->GetVisible();
+    bool right_aligned = browser_view_->unified_side_panel()->IsRightAligned();
+    bool infobar_visible = browser_view_->infobar_container()->GetVisible();
 
-    browser_view_->multi_contents_view()->end_contents_view_inset().set_right(
-        browser_view_->unified_side_panel()->GetVisible() &&
-                browser_view_->unified_side_panel()->IsRightAligned()
-            ? 0
-            : MultiContentsView::kSplitViewContentInset);
+    browser_view_->multi_contents_view()
+        ->start_contents_view_inset()
+        .set_left(side_panel_visible && !right_aligned
+                      ? 0
+                      : MultiContentsView::kSplitViewContentInset)
+        .set_top(!infobar_visible ? 0
+                                  : MultiContentsView::kSplitViewContentInset);
+
+    browser_view_->multi_contents_view()
+        ->end_contents_view_inset()
+        .set_right(side_panel_visible && right_aligned
+                       ? 0
+                       : MultiContentsView::kSplitViewContentInset)
+        .set_top(!infobar_visible ? 0
+                                  : MultiContentsView::kSplitViewContentInset);
   }
 
   ExclusiveAccessBubbleViews* GetExclusiveAccessBubble() const override {