Commit 5a6bfbd4 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

InfoBarObserver must handle manager shutdown.

This prevents a DCHECK failure when running infobar browser tests and manually
closing the window with the infobar in it.

BUG=none
TEST=none

Change-Id: Iad50464a5a538d9d6e167f7a2c1a22905902770d
Reviewed-on: https://chromium-review.googlesource.com/991468Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548170}
parent 42441949
......@@ -32,6 +32,12 @@ void InfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
OnNotified(Type::kInfoBarReplaced);
}
void InfoBarObserver::OnManagerShuttingDown(infobars::InfoBarManager* manager) {
if (run_loop_.running())
run_loop_.Quit();
infobar_observer_.Remove(manager);
}
void InfoBarObserver::OnNotified(Type type) {
if (type == type_)
run_loop_.Quit();
......
......@@ -35,6 +35,7 @@ class InfoBarObserver : public infobars::InfoBarManager::Observer {
void OnInfoBarRemoved(infobars::InfoBar* infobar, bool animate) override;
void OnInfoBarReplaced(infobars::InfoBar* old_infobar,
infobars::InfoBar* new_infobar) override;
void OnManagerShuttingDown(infobars::InfoBarManager* manager) override;
void OnNotified(Type type);
......
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