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

Unified Diff: chrome/browser/views/jsmessage_box_dialog.cc

Issue 341089: Implement window.alert() and its cousins for extensions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
Index: chrome/browser/views/jsmessage_box_dialog.cc
===================================================================
--- chrome/browser/views/jsmessage_box_dialog.cc (revision 30970)
+++ chrome/browser/views/jsmessage_box_dialog.cc (working copy)
@@ -37,10 +37,15 @@
}
void JavascriptMessageBoxDialog::ShowModalDialog() {
- HWND root_hwnd = GetAncestor(tab_contents()->GetNativeView(),
- GA_ROOT);
- dialog_ = views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this);
- dialog_->Show();
+ gfx::NativeWindow root_hwnd = client()->GetMessageBoxRootWindow();
+ // GetMessageBoxRootWindow() will be NULL if there's no selected tab (e.g.,
+ // during shutdown), in which case we simply skip showing this dialog.
+ if (!root_hwnd) {
+ Cancel();
+ } else {
+ dialog_ = views::Window::CreateChromeWindow(root_hwnd, gfx::Rect(), this);
+ dialog_->Show();
+ }
}
void JavascriptMessageBoxDialog::ActivateModalDialog() {
@@ -72,13 +77,12 @@
}
std::wstring JavascriptMessageBoxDialog::GetWindowTitle() const {
- return parent_->title();;
+ return parent_->title();
}
void JavascriptMessageBoxDialog::WindowClosing() {
dialog_ = NULL;
-
}
void JavascriptMessageBoxDialog::DeleteDelegate() {

Powered by Google App Engine
This is Rietveld 408576698