diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 02:07:08 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-24 02:07:08 +0000 |
commit | 171ae9218c16399b557ebb15523e7dbad74fd72f (patch) | |
tree | c0d48f3715de362838470b8fa88095981a94db5d | |
parent | e0a568f4be1e151b4569b25df5c66f80100de98c (diff) | |
download | chromium_src-171ae9218c16399b557ebb15523e7dbad74fd72f.zip chromium_src-171ae9218c16399b557ebb15523e7dbad74fd72f.tar.gz chromium_src-171ae9218c16399b557ebb15523e7dbad74fd72f.tar.bz2 |
Preparation for mac content confirmation dialog. More tidy in general as well.
Patch mostly by sky.
BUG=34894
Review URL: http://codereview.chromium.org/652178
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39840 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/app_modal_dialog_queue.cc | 16 | ||||
-rw-r--r-- | chrome/browser/app_modal_dialog_queue.h | 6 |
2 files changed, 20 insertions, 2 deletions
diff --git a/chrome/browser/app_modal_dialog_queue.cc b/chrome/browser/app_modal_dialog_queue.cc index 3d4f2da..bcf1859 100644 --- a/chrome/browser/app_modal_dialog_queue.cc +++ b/chrome/browser/app_modal_dialog_queue.cc @@ -23,13 +23,27 @@ void AppModalDialogQueue::ShowNextDialog() { } void AppModalDialogQueue::ActivateModalDialog() { + if (showing_modal_dialog_) { + // As part of showing a modal dialog we may end up back in this method + // (showing a dialog activates the TabContents, which can trigger a call + // to ActivateModalDialog). We ignore such a request as after the call to + // activate the tab contents the dialog is shown. + return; + } if (active_dialog_) active_dialog_->ActivateModalDialog(); } void AppModalDialogQueue::ShowModalDialog(AppModalDialog* dialog) { - dialog->ShowModalDialog(); + // Be sure and set the active_dialog_ field first, otherwise if + // ShowModalDialog triggers a call back to the queue they'll get the old + // dialog. Also, if the dialog calls |ShowNextDialog()| before returning, that + // would write NULL into |active_dialog_| and this function would then undo + // that. active_dialog_ = dialog; + showing_modal_dialog_ = true; + dialog->ShowModalDialog(); + showing_modal_dialog_ = false; } AppModalDialog* AppModalDialogQueue::GetNextDialog() { diff --git a/chrome/browser/app_modal_dialog_queue.h b/chrome/browser/app_modal_dialog_queue.h index 66ba3ff..b9709b3 100644 --- a/chrome/browser/app_modal_dialog_queue.h +++ b/chrome/browser/app_modal_dialog_queue.h @@ -54,7 +54,7 @@ class AppModalDialogQueue { private: friend struct DefaultSingletonTraits<AppModalDialogQueue>; - AppModalDialogQueue() : active_dialog_(NULL) {} + AppModalDialogQueue() : active_dialog_(NULL), showing_modal_dialog_(false) {} // Shows |dialog| and notifies the BrowserList that a modal dialog is showing. void ShowModalDialog(AppModalDialog* dialog); @@ -73,6 +73,10 @@ class AppModalDialogQueue { // active app-modal dialog box. AppModalDialog* active_dialog_; + // Stores if |ShowModalDialog()| is currently being called on an app-modal + // dialog. + bool showing_modal_dialog_; + DISALLOW_COPY_AND_ASSIGN(AppModalDialogQueue); }; |