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 | #include "chrome/browser/app_modal_dialog_queue.h" |
| 6 | |
| 7 | #include "chrome/browser/browser_list.h" |
| 8 | |
| 9 | // static |
| 10 | std::queue<ChromeViews::AppModalDialogDelegate*>* |
| 11 | AppModalDialogQueue::app_modal_dialog_queue_ = NULL; |
| 12 | |
| 13 | // static |
| 14 | void AppModalDialogQueue::AddDialog( |
| 15 | ChromeViews::AppModalDialogDelegate* dialog) { |
| 16 | DCHECK(dialog->IsModal()); |
| 17 | if (!app_modal_dialog_queue_) { |
| 18 | app_modal_dialog_queue_ = |
| 19 | new std::queue<ChromeViews::AppModalDialogDelegate*>; |
| 20 | ShowModalDialog(dialog); |
| 21 | } |
| 22 | |
| 23 | app_modal_dialog_queue_->push(dialog); |
| 24 | } |
| 25 | |
| 26 | // static |
| 27 | void AppModalDialogQueue::ShowNextDialog() { |
| 28 | app_modal_dialog_queue_->pop(); |
| 29 | BrowserList::SetIsShowingAppModalDialog(false); |
| 30 | if (!app_modal_dialog_queue_->empty()) { |
| 31 | ShowModalDialog(app_modal_dialog_queue_->front()); |
| 32 | } else { |
| 33 | delete app_modal_dialog_queue_; |
| 34 | app_modal_dialog_queue_ = NULL; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // static |
| 39 | void AppModalDialogQueue::ActivateModalDialog() { |
| 40 | if (!app_modal_dialog_queue_->empty()) |
| 41 | app_modal_dialog_queue_->front()->ActivateModalDialog(); |
| 42 | } |
| 43 | |
| 44 | // static |
| 45 | void AppModalDialogQueue::ShowModalDialog( |
| 46 | ChromeViews::AppModalDialogDelegate* dialog) { |
| 47 | dialog->ShowModalDialog(); |
| 48 | BrowserList::SetIsShowingAppModalDialog(true); |
| 49 | } |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame^] | 50 | |