summaryrefslogtreecommitdiffstats
path: root/chrome/browser/app_modal_dialog_queue.h
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 17:02:07 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 17:02:07 +0000
commit1f46007516b8ab87a9089bfab64621595b869e54 (patch)
tree7542b70956c2811c4d3ef6be53c38bbc97dabec4 /chrome/browser/app_modal_dialog_queue.h
parent2a4fab98a8dd8a65f16d64acb1f51d8a0076a25f (diff)
downloadchromium_src-1f46007516b8ab87a9089bfab64621595b869e54.zip
chromium_src-1f46007516b8ab87a9089bfab64621595b869e54.tar.gz
chromium_src-1f46007516b8ab87a9089bfab64621595b869e54.tar.bz2
This CL is a clean-up of the app_modal_dialog_queue.cc in an attempt to fix a bug 10699.
Not sure what is causing the crasher. Hopefully after this clean-up we'll get a different stack-trace that might help. BUG=10699 TEST=Make sure alert/confirm boxes work properly. make sure a background tab that shows a (delayed) alert box works. Same with a background browser. Review URL: http://codereview.chromium.org/113932 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_modal_dialog_queue.h')
-rw-r--r--chrome/browser/app_modal_dialog_queue.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/chrome/browser/app_modal_dialog_queue.h b/chrome/browser/app_modal_dialog_queue.h
index bfe755c..8053342 100644
--- a/chrome/browser/app_modal_dialog_queue.h
+++ b/chrome/browser/app_modal_dialog_queue.h
@@ -7,10 +7,12 @@
#include <queue>
+#include "base/singleton.h"
#include "chrome/browser/app_modal_dialog.h"
// Keeps a queue of AppModalDialogs, making sure only one app modal
// dialog is shown at a time.
+// This class is a singleton.
class AppModalDialogQueue {
public:
// Adds a modal dialog to the queue, if there are no other dialogs in the
@@ -23,13 +25,13 @@ class AppModalDialogQueue {
// sloppy app modality.
// Note: The AppModalDialog |dialog| must be window modal before it
// can be added as app modal.
- static void AddDialog(AppModalDialog* dialog);
+ void AddDialog(AppModalDialog* dialog);
// Removes the current dialog in the queue (the one that is being shown).
// Shows the next dialog in the queue, if any is present. This does not
// ensure that the currently showing dialog is closed, it just makes it no
// longer app modal.
- static void ShowNextDialog();
+ void ShowNextDialog();
// Activates and shows the current dialog, if the user clicks on one of the
// windows disabled by the presence of an app modal dialog. This forces
@@ -37,29 +39,35 @@ class AppModalDialogQueue {
// opened the dialog on another virtual desktop. Assumes there is currently a
// dialog being shown. (Call BrowserList::IsShowingAppModalDialog to test
// this condition).
- static void ActivateModalDialog();
+ void ActivateModalDialog();
// Returns true if there is currently an active app modal dialog box.
- static bool HasActiveDialog() {
+ bool HasActiveDialog() {
return active_dialog_ != NULL;
}
// Accessor for |active_dialog_|.
- static AppModalDialog* active_dialog() {
+ AppModalDialog* active_dialog() {
return active_dialog_;
}
private:
+ friend struct DefaultSingletonTraits<AppModalDialogQueue>;
+
+ AppModalDialogQueue() : active_dialog_(NULL) { }
+
// Shows |dialog| and notifies the BrowserList that a modal dialog is showing.
- static void ShowModalDialog(AppModalDialog* dialog);
+ void ShowModalDialog(AppModalDialog* dialog);
// Contains all app modal dialogs which are waiting to be shown, with the
// currently modal dialog at the front of the queue.
- static std::queue<AppModalDialog*>* app_modal_dialog_queue_;
+ std::queue<AppModalDialog*> app_modal_dialog_queue_;
// The currently active app-modal dialog box's delegate. NULL if there is no
// active app-modal dialog box.
- static AppModalDialog* active_dialog_;
+ AppModalDialog* active_dialog_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppModalDialogQueue);
};
#endif // CHROME_BROWSER_APP_MODAL_DIALOG_QUEUE_H__