blob: 4a3ce46378ffe93d2615819918c1f1fd9b9d9790 [file] [log] [blame]
license.botbf09a502008-08-24 00:55:551// 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.commit09911bf2008-07-26 23:55:294
5#include "chrome/browser/app_modal_dialog_queue.h"
6
7#include "chrome/browser/browser_list.h"
8
9// static
10std::queue<ChromeViews::AppModalDialogDelegate*>*
11 AppModalDialogQueue::app_modal_dialog_queue_ = NULL;
12
13// static
14void 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
27void 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
39void AppModalDialogQueue::ActivateModalDialog() {
40 if (!app_modal_dialog_queue_->empty())
41 app_modal_dialog_queue_->front()->ActivateModalDialog();
42}
43
44// static
45void AppModalDialogQueue::ShowModalDialog(
46 ChromeViews::AppModalDialogDelegate* dialog) {
47 dialog->ShowModalDialog();
48 BrowserList::SetIsShowingAppModalDialog(true);
49}
license.botbf09a502008-08-24 00:55:5550