Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3389)

Unified Diff: chrome/browser/ui/browser.cc

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_commands.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_commands.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698