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,7 +31,8 @@ ReopenTabInProductHelp::ReopenTabInProductHelp(Profile* profile, ...@@ -31,7 +31,8 @@ ReopenTabInProductHelp::ReopenTabInProductHelp(Profile* profile,
// currently living browsers. // currently living browsers.
BrowserList::AddObserver(this); BrowserList::AddObserver(this);
for (Browser* browser : *BrowserList::GetInstance()) { for (Browser* browser : *BrowserList::GetInstance()) {
active_tab_tracker_.AddTabStripModel(browser->tab_strip_model()); if (browser->profile() == profile_)
active_tab_tracker_.AddTabStripModel(browser->tab_strip_model());
} }
// |base::Unretained| is safe here since this is a member. // |base::Unretained| is safe here since this is a member.
...@@ -42,7 +43,8 @@ ReopenTabInProductHelp::ReopenTabInProductHelp(Profile* profile, ...@@ -42,7 +43,8 @@ ReopenTabInProductHelp::ReopenTabInProductHelp(Profile* profile,
ReopenTabInProductHelp::~ReopenTabInProductHelp() { ReopenTabInProductHelp::~ReopenTabInProductHelp() {
BrowserList::RemoveObserver(this); BrowserList::RemoveObserver(this);
for (Browser* browser : *BrowserList::GetInstance()) { for (Browser* browser : *BrowserList::GetInstance()) {
active_tab_tracker_.RemoveTabStripModel(browser->tab_strip_model()); if (browser->profile() == profile_)
active_tab_tracker_.RemoveTabStripModel(browser->tab_strip_model());
} }
} }
...@@ -71,11 +73,13 @@ void ReopenTabInProductHelp::OnShowHelp() { ...@@ -71,11 +73,13 @@ void ReopenTabInProductHelp::OnShowHelp() {
} }
void ReopenTabInProductHelp::OnBrowserAdded(Browser* browser) { void ReopenTabInProductHelp::OnBrowserAdded(Browser* browser) {
active_tab_tracker_.AddTabStripModel(browser->tab_strip_model()); if (browser->profile() == profile_)
active_tab_tracker_.AddTabStripModel(browser->tab_strip_model());
} }
void ReopenTabInProductHelp::OnBrowserRemoved(Browser* browser) { void ReopenTabInProductHelp::OnBrowserRemoved(Browser* browser) {
active_tab_tracker_.RemoveTabStripModel(browser->tab_strip_model()); if (browser->profile() == profile_)
active_tab_tracker_.RemoveTabStripModel(browser->tab_strip_model());
} }
feature_engagement::Tracker* ReopenTabInProductHelp::GetTracker() { feature_engagement::Tracker* ReopenTabInProductHelp::GetTracker() {
......
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