| Index: chrome/browser/ui/browser.cc
|
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
|
| index ab723e3f5d2e7e651d343049241523b8144ba540..d3a49fd1a3c92a1e24e79c44f06536e2389e3f65 100644
|
| --- a/chrome/browser/ui/browser.cc
|
| +++ b/chrome/browser/ui/browser.cc
|
| @@ -152,6 +152,7 @@
|
| #include "components/bookmarks/browser/bookmark_utils.h"
|
| #include "components/google/core/browser/google_url_tracker.h"
|
| #include "components/startup_metric_utils/startup_metric_utils.h"
|
| +#include "components/web_modal/popup_manager.h"
|
| #include "components/web_modal/web_contents_modal_dialog_manager.h"
|
| #include "content/public/browser/devtools_manager.h"
|
| #include "content/public/browser/download_item.h"
|
| @@ -444,6 +445,12 @@ Browser::Browser(const CreateParams& params)
|
| }
|
|
|
| fullscreen_controller_.reset(new FullscreenController(this));
|
| +
|
| + // Must be initialized after window_.
|
| + // Also: surprise! a modal dialog host is not necessary to host modal dialogs
|
| + // without a modal dialog host, so that value may be null.
|
| + popup_manager_.reset(new web_modal::PopupManager(
|
| + GetWebContentsModalDialogHost()));
|
| }
|
|
|
| Browser::~Browser() {
|
| @@ -892,6 +899,10 @@ void Browser::TabInsertedAt(WebContents* contents,
|
| int index,
|
| bool foreground) {
|
| SetAsDelegate(contents, true);
|
| +
|
| + if (popup_manager_)
|
| + popup_manager_->RegisterWith(contents);
|
| +
|
| SessionTabHelper* session_tab_helper =
|
| SessionTabHelper::FromWebContents(contents);
|
| session_tab_helper->SetWindowID(session_id());
|
| @@ -933,6 +944,9 @@ void Browser::TabClosingAt(TabStripModel* tab_strip_model,
|
| content::Source<NavigationController>(&contents->GetController()),
|
| content::NotificationService::NoDetails());
|
|
|
| + if (popup_manager_)
|
| + popup_manager_->UnregisterWith(contents);
|
| +
|
| // Sever the WebContents' connection back to us.
|
| SetAsDelegate(contents, false);
|
| }
|
| @@ -948,6 +962,10 @@ void Browser::TabDetachedAt(WebContents* contents, int index) {
|
| session_service->SetSelectedTabInWindow(session_id(),
|
| old_active_index - 1);
|
| }
|
| +
|
| + if (popup_manager_)
|
| + popup_manager_->UnregisterWith(contents);
|
| +
|
| TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH);
|
| }
|
|
|
|
|