OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <deque> | 9 #include <deque> |
10 | 10 |
11 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 11 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
12 | 12 |
13 template <typename T> struct DefaultSingletonTraits; | 13 template <typename T> struct DefaultSingletonTraits; |
14 | 14 |
15 // Keeps a queue of AppModalDialogs, making sure only one app modal | 15 // Keeps a queue of AppModalDialogs, making sure only one app modal |
16 // dialog is shown at a time. | 16 // dialog is shown at a time. |
17 // This class is a singleton. | 17 // This class is a singleton. |
18 class AppModalDialogQueue { | 18 class AppModalDialogQueue { |
19 public: | 19 public: |
20 // Returns the singleton instance. | 20 // Returns the singleton instance. |
21 static AppModalDialogQueue* GetInstance(); | 21 static AppModalDialogQueue* GetInstance(); |
22 | 22 |
23 // 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 |
24 // 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 |
25 // most recently active browser window (or whichever is currently active) | 25 // most recently active browser window (or whichever is currently active) |
26 // 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 |
27 // activate any other browser windows. So the dialog being shown should | 27 // activate any other browser windows. |
28 // assure it is the child of BrowserList::GetLastActive() so that it is | |
29 // activated as well. See browser_list.h for more notes about our somewhat | |
30 // sloppy app modality. | |
31 // Note: The AppModalDialog |dialog| must be window modal before it | 28 // Note: The AppModalDialog |dialog| must be window modal before it |
32 // can be added as app modal. | 29 // can be added as app modal. |
33 void AddDialog(AppModalDialog* dialog); | 30 void AddDialog(AppModalDialog* dialog); |
34 | 31 |
35 // Removes the current dialog in the queue (the one that is being shown). | 32 // Removes the current dialog in the queue (the one that is being shown). |
36 // Shows the next dialog in the queue, if any is present. This does not | 33 // Shows the next dialog in the queue, if any is present. This does not |
37 // ensure that the currently showing dialog is closed, it just makes it no | 34 // ensure that the currently showing dialog is closed, it just makes it no |
38 // longer app modal. | 35 // longer app modal. |
39 void ShowNextDialog(); | 36 void ShowNextDialog(); |
40 | 37 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 AppModalDialog* active_dialog_; | 88 AppModalDialog* active_dialog_; |
92 | 89 |
93 // Stores if |ShowModalDialog()| is currently being called on an app-modal | 90 // Stores if |ShowModalDialog()| is currently being called on an app-modal |
94 // dialog. | 91 // dialog. |
95 bool showing_modal_dialog_; | 92 bool showing_modal_dialog_; |
96 | 93 |
97 DISALLOW_COPY_AND_ASSIGN(AppModalDialogQueue); | 94 DISALLOW_COPY_AND_ASSIGN(AppModalDialogQueue); |
98 }; | 95 }; |
99 | 96 |
100 #endif // CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_QUEUE_H_ | 97 #endif // CHROME_BROWSER_UI_APP_MODAL_DIALOGS_APP_MODAL_DIALOG_QUEUE_H_ |
OLD | NEW |