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 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 5 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 | 8 |
9 void AppModalDialogQueue::AddDialog(AppModalDialog* dialog) { | 9 void AppModalDialogQueue::AddDialog(AppModalDialog* dialog) { |
10 if (!active_dialog_) { | 10 if (!active_dialog_) { |
11 ShowModalDialog(dialog); | 11 ShowModalDialog(dialog); |
12 return; | 12 return; |
13 } | 13 } |
14 app_modal_dialog_queue_.push(dialog); | 14 app_modal_dialog_queue_.push_back(dialog); |
15 } | 15 } |
16 | 16 |
17 void AppModalDialogQueue::ShowNextDialog() { | 17 void AppModalDialogQueue::ShowNextDialog() { |
18 AppModalDialog* dialog = GetNextDialog(); | 18 AppModalDialog* dialog = GetNextDialog(); |
19 if (dialog) | 19 if (dialog) |
20 ShowModalDialog(dialog); | 20 ShowModalDialog(dialog); |
21 else | 21 else |
22 active_dialog_ = NULL; | 22 active_dialog_ = NULL; |
23 } | 23 } |
24 | 24 |
(...skipping 28 matching lines...) Expand all Loading... |
53 // that. | 53 // that. |
54 active_dialog_ = dialog; | 54 active_dialog_ = dialog; |
55 showing_modal_dialog_ = true; | 55 showing_modal_dialog_ = true; |
56 dialog->ShowModalDialog(); | 56 dialog->ShowModalDialog(); |
57 showing_modal_dialog_ = false; | 57 showing_modal_dialog_ = false; |
58 } | 58 } |
59 | 59 |
60 AppModalDialog* AppModalDialogQueue::GetNextDialog() { | 60 AppModalDialog* AppModalDialogQueue::GetNextDialog() { |
61 while (!app_modal_dialog_queue_.empty()) { | 61 while (!app_modal_dialog_queue_.empty()) { |
62 AppModalDialog* dialog = app_modal_dialog_queue_.front(); | 62 AppModalDialog* dialog = app_modal_dialog_queue_.front(); |
63 app_modal_dialog_queue_.pop(); | 63 app_modal_dialog_queue_.pop_front(); |
64 if (dialog->IsValid()) | 64 if (dialog->IsValid()) |
65 return dialog; | 65 return dialog; |
66 delete dialog; | 66 delete dialog; |
67 } | 67 } |
68 return NULL; | 68 return NULL; |
69 } | 69 } |
OLD | NEW |