Skip to content

Commit

Permalink
SharedPinnedTabService should not consider ignored Browsers in Browse…
Browse files Browse the repository at this point in the history
…rListObserver events
  • Loading branch information
petemill committed Apr 17, 2023
1 parent 04f3d15 commit 3d752e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions browser/ui/tabs/shared_pinned_tab_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ void SharedPinnedTabService::Shutdown() {
}

void SharedPinnedTabService::OnBrowserAdded(Browser* browser) {
DVLOG(1) << "Browser added: " << browser->type();
if (profile_ != browser->profile()) {
return;
}
Expand All @@ -195,14 +196,16 @@ void SharedPinnedTabService::OnBrowserAdded(Browser* browser) {
}

void SharedPinnedTabService::OnBrowserSetLastActive(Browser* browser) {
if (profile_ != browser->profile()) {
if (!base::Contains(browsers_, browser)) {
// Browser could be different profile or not a type we're
// looking for. Let |OnBrowserAdded| decide which to look for.
DCHECK(!browser->is_type_normal() || profile_ != browser->profile())
<< "We expect a Browser to be created before set active";
return;
}

auto* model = browser->tab_strip_model();
DVLOG(2) << __FUNCTION__ << " " << model->count();
DCHECK(base::Contains(browsers_, browser))
<< "We expect a browser created first and then activated";
DCHECK_LT(0, model->count()) << "We're assuming that browser has tabs";

SynchronizeNewBrowser(browser);
Expand Down

0 comments on commit 3d752e5

Please sign in to comment.