Commit eedf4293 authored by Nicolas Ouellet-Payeur's avatar Nicolas Ouellet-Payeur Committed by Commit Bot

[IPH] Don't listen to new-tab/close-tab events from other profiles

Previously, IPH code would listen to other profiles' events, for the
"reopen tab" feature. This is overkill, since events from a second
profile shouldn't trigger IPH in the first profile.

Bug: 1134314
Change-Id: I95cf63ab90949d03532f951c29b4db17f34cd654
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2443756Reviewed-by: default avatarCollin Baker <collinbaker@google.com>
Reviewed-by: default avatarCollin Baker <collinbaker@chromium.org>
Commit-Queue: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813166}
parent 7512c315
......@@ -31,6 +31,7 @@ ReopenTabInProductHelp::ReopenTabInProductHelp(Profile* profile,
// currently living browsers.
BrowserList::AddObserver(this);
for (Browser* browser : *BrowserList::GetInstance()) {
if (browser->profile() == profile_)
active_tab_tracker_.AddTabStripModel(browser->tab_strip_model());
}
......@@ -42,6 +43,7 @@ ReopenTabInProductHelp::ReopenTabInProductHelp(Profile* profile,
ReopenTabInProductHelp::~ReopenTabInProductHelp() {
BrowserList::RemoveObserver(this);
for (Browser* browser : *BrowserList::GetInstance()) {
if (browser->profile() == profile_)
active_tab_tracker_.RemoveTabStripModel(browser->tab_strip_model());
}
}
......@@ -71,10 +73,12 @@ void ReopenTabInProductHelp::OnShowHelp() {
}
void ReopenTabInProductHelp::OnBrowserAdded(Browser* browser) {
if (browser->profile() == profile_)
active_tab_tracker_.AddTabStripModel(browser->tab_strip_model());
}
void ReopenTabInProductHelp::OnBrowserRemoved(Browser* browser) {
if (browser->profile() == profile_)
active_tab_tracker_.RemoveTabStripModel(browser->tab_strip_model());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment