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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm

Issue 2589663002: Mac: Add CHECK() in ConstrainedWindowMac::GetDialogManager(). (Closed)
Patch Set: Created 4 years 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/cocoa/constrained_window/constrained_window_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
index c0aa06be491d0de019213de2572a25e1411239ce..4df3304d5bdc81228de507edac19e255e6c05efc 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
@@ -81,5 +81,12 @@ bool ConstrainedWindowMac::DialogWasShown() {
WebContentsModalDialogManager* ConstrainedWindowMac::GetDialogManager() {
DCHECK(web_contents_);
- return WebContentsModalDialogManager::FromWebContents(web_contents_);
+ WebContentsModalDialogManager* dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ // If WebContentsModalDialogManager::CreateForWebContents(web_contents_) was
+ // never called, then the manager will be null. E.g., for browser tabs,
+ // TabHelpers::AttachTabHelpers() calls CreateForWebContents(). It is invalid
+ // to show a dialog on some kinds of WebContents. Crash cleanly in that case.
+ CHECK(dialog_manager);
+ return dialog_manager;
}
« no previous file with comments | « chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698