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

Unified Diff: chrome/browser/app_modal_dialog_queue.h

Issue 113932: Clean-up of the app modal dialog queue (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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/app_modal_dialog.cc ('k') | chrome/browser/app_modal_dialog_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/app_modal_dialog_queue.h
===================================================================
--- chrome/browser/app_modal_dialog_queue.h (revision 17006)
+++ chrome/browser/app_modal_dialog_queue.h (working copy)
@@ -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 @@
// 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 @@
// 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__
« no previous file with comments | « chrome/browser/app_modal_dialog.cc ('k') | chrome/browser/app_modal_dialog_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698