license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame^] | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
| 5 | #ifndef CHROME_BROWSER_APP_MODAL_DIALOG_QUEUE_H__ |
| 6 | #define CHROME_BROWSER_APP_MODAL_DIALOG_QUEUE_H__ |
| 7 | |
| 8 | #include <queue> |
| 9 | |
| 10 | #include "chrome/views/app_modal_dialog_delegate.h" |
| 11 | |
| 12 | // Keeps a queue of AppModalDialogDelegates, making sure only one app modal |
| 13 | // dialog is shown at a time. |
| 14 | class AppModalDialogQueue { |
| 15 | public: |
| 16 | // Adds a modal dialog to the queue, if there are no other dialogs in the |
| 17 | // queue, the dialog will be shown immediately. Once it is shown, the |
| 18 | // most recently active browser window (or whichever is currently active) |
| 19 | // will be app modal, meaning it will be activated if the user tries to |
| 20 | // activate any other browser windows. So the dialog being shown should |
| 21 | // assure it is the child of BrowserList::GetLastActive() so that it is |
| 22 | // activated as well. See browser_list.h for more notes about our somewhat |
| 23 | // sloppy app modality. |
| 24 | // Note: The AppModalDialogDelegate |dialog| must be window modal before it |
| 25 | // can be added as app modal. |
| 26 | static void AddDialog(ChromeViews::AppModalDialogDelegate* dialog); |
| 27 | |
| 28 | // Removes the current dialog in the queue (the one that is being shown). |
| 29 | // Shows the next dialog in the queue, if any is present. This does not |
| 30 | // ensure that the currently showing dialog is closed, it just makes it no |
| 31 | // longer app modal. |
| 32 | static void ShowNextDialog(); |
| 33 | |
| 34 | // Activates and shows the current dialog, if the user clicks on one of the |
| 35 | // windows disabled by the presence of an app modal dialog. This forces |
| 36 | // the window to be visible on the display even if desktop manager software |
| 37 | // opened the dialog on another virtual desktop. Assumes there is currently a |
| 38 | // dialog being shown. (Call BrowserList::IsShowingAppModalDialog to test |
| 39 | // this condition). |
| 40 | static void ActivateModalDialog(); |
| 41 | |
| 42 | private: |
| 43 | // Shows |dialog| and notifies the BrowserList that a modal dialog is showing. |
| 44 | static void ShowModalDialog(ChromeViews::AppModalDialogDelegate* dialog); |
| 45 | |
| 46 | // Contains all app modal dialogs which are waiting to be shown, with the |
| 47 | // currently modal dialog at the front of the queue. |
| 48 | static std::queue<ChromeViews::AppModalDialogDelegate*>* |
| 49 | app_modal_dialog_queue_; |
| 50 | }; |
| 51 | |
| 52 | #endif // CHROME_BROWSER_APP_MODAL_DIALOG_QUEUE_H__ |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame^] | 53 | |