From 0dbdc16b6ee0fc58c501fb729a4a375265fffcb1 Mon Sep 17 00:00:00 2001 From: sergei Date: Tue, 24 Jan 2023 12:52:39 +0300 Subject: [PATCH] Use last opened panel when selecting sidepanel button in toolbar --- .../ui/views/side_panel/side_panel_coordinator.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/chromium_src/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc b/chromium_src/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc index 28acca3d55d2..3073f7400290 100644 --- a/chromium_src/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc +++ b/chromium_src/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc @@ -29,11 +29,14 @@ absl::optional GetDefaultEntryId(Profile* profile) { // Choose Brave's own default, and exclude items that user has removed // from sidebar. If none are enabled, do nothing. -#define BRAVE_SIDE_PANEL_COORDINATOR_SHOW \ - if (!entry_id.has_value()) { \ - entry_id = GetDefaultEntryId(browser_view_->GetProfile()); \ - if (!entry_id.has_value()) \ - return; \ +#define BRAVE_SIDE_PANEL_COORDINATOR_SHOW \ + if (!entry_id.has_value()) { \ + auto last_active_entry = GetLastActiveEntryKey(); \ + entry_id = last_active_entry.has_value() \ + ? last_active_entry.value().id() \ + : GetDefaultEntryId(browser_view_->GetProfile()); \ + if (!entry_id.has_value()) \ + return; \ } #include "src/chrome/browser/ui/views/side_panel/side_panel_coordinator.cc"