OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_QUEUE_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_QUEUE_H_ |
6 #define CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_QUEUE_H_ | 6 #define CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_QUEUE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
11 #include "base/singleton.h" | |
12 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 11 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
13 | 12 |
| 13 template <typename T> struct DefaultSingletonTraits; |
| 14 |
14 // Keeps a queue of AppModalDialogs, making sure only one app modal | 15 // Keeps a queue of AppModalDialogs, making sure only one app modal |
15 // dialog is shown at a time. | 16 // dialog is shown at a time. |
16 // This class is a singleton. | 17 // This class is a singleton. |
17 class AppModalDialogQueue { | 18 class AppModalDialogQueue { |
18 public: | 19 public: |
| 20 // Returns the singleton instance. |
| 21 static AppModalDialogQueue* GetInstance(); |
| 22 |
19 // Adds a modal dialog to the queue, if there are no other dialogs in the | 23 // Adds a modal dialog to the queue, if there are no other dialogs in the |
20 // queue, the dialog will be shown immediately. Once it is shown, the | 24 // queue, the dialog will be shown immediately. Once it is shown, the |
21 // most recently active browser window (or whichever is currently active) | 25 // most recently active browser window (or whichever is currently active) |
22 // will be app modal, meaning it will be activated if the user tries to | 26 // will be app modal, meaning it will be activated if the user tries to |
23 // activate any other browser windows. So the dialog being shown should | 27 // activate any other browser windows. So the dialog being shown should |
24 // assure it is the child of BrowserList::GetLastActive() so that it is | 28 // assure it is the child of BrowserList::GetLastActive() so that it is |
25 // activated as well. See browser_list.h for more notes about our somewhat | 29 // activated as well. See browser_list.h for more notes about our somewhat |
26 // sloppy app modality. | 30 // sloppy app modality. |
27 // Note: The AppModalDialog |dialog| must be window modal before it | 31 // Note: The AppModalDialog |dialog| must be window modal before it |
28 // can be added as app modal. | 32 // can be added as app modal. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 AppModalDialog* active_dialog_; | 80 AppModalDialog* active_dialog_; |
77 | 81 |
78 // Stores if |ShowModalDialog()| is currently being called on an app-modal | 82 // Stores if |ShowModalDialog()| is currently being called on an app-modal |
79 // dialog. | 83 // dialog. |
80 bool showing_modal_dialog_; | 84 bool showing_modal_dialog_; |
81 | 85 |
82 DISALLOW_COPY_AND_ASSIGN(AppModalDialogQueue); | 86 DISALLOW_COPY_AND_ASSIGN(AppModalDialogQueue); |
83 }; | 87 }; |
84 | 88 |
85 #endif // CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_QUEUE_H_ | 89 #endif // CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_QUEUE_H_ |
OLD | NEW |