Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Side by Side Diff: chrome/browser/app_modal_dialog_queue.cc

Issue 27080: AppModalDialogQueue shouldn't depend on views. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 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 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/app_modal_dialog_queue.h" 5 #include "chrome/browser/app_modal_dialog_queue.h"
6 6
7 #include "chrome/browser/browser_list.h" 7 #include "chrome/browser/browser_list.h"
8 8
9 // static 9 // static
10 std::queue<views::AppModalDialogDelegate*>* 10 std::queue<AppModalDialogDelegate*>*
11 AppModalDialogQueue::app_modal_dialog_queue_ = NULL; 11 AppModalDialogQueue::app_modal_dialog_queue_ = NULL;
12 views::AppModalDialogDelegate* AppModalDialogQueue::active_dialog_ = NULL; 12 AppModalDialogDelegate* AppModalDialogQueue::active_dialog_ = NULL;
13 13
14 // static 14 // static
15 void AppModalDialogQueue::AddDialog(views::AppModalDialogDelegate* dialog) { 15 void AppModalDialogQueue::AddDialog(AppModalDialogDelegate* dialog) {
16 DCHECK(dialog->IsModal());
17 if (!app_modal_dialog_queue_) { 16 if (!app_modal_dialog_queue_) {
18 app_modal_dialog_queue_ = new std::queue<views::AppModalDialogDelegate*>; 17 app_modal_dialog_queue_ = new std::queue<AppModalDialogDelegate*>;
19 ShowModalDialog(dialog); 18 ShowModalDialog(dialog);
20 } 19 }
21 20
22 app_modal_dialog_queue_->push(dialog); 21 app_modal_dialog_queue_->push(dialog);
23 } 22 }
24 23
25 // static 24 // static
26 void AppModalDialogQueue::ShowNextDialog() { 25 void AppModalDialogQueue::ShowNextDialog() {
27 app_modal_dialog_queue_->pop(); 26 app_modal_dialog_queue_->pop();
28 active_dialog_ = NULL; 27 active_dialog_ = NULL;
29 if (!app_modal_dialog_queue_->empty()) { 28 if (!app_modal_dialog_queue_->empty()) {
30 ShowModalDialog(app_modal_dialog_queue_->front()); 29 ShowModalDialog(app_modal_dialog_queue_->front());
31 } else { 30 } else {
32 delete app_modal_dialog_queue_; 31 delete app_modal_dialog_queue_;
33 app_modal_dialog_queue_ = NULL; 32 app_modal_dialog_queue_ = NULL;
34 } 33 }
35 } 34 }
36 35
37 // static 36 // static
38 void AppModalDialogQueue::ActivateModalDialog() { 37 void AppModalDialogQueue::ActivateModalDialog() {
39 if (!app_modal_dialog_queue_->empty()) 38 if (!app_modal_dialog_queue_->empty())
40 app_modal_dialog_queue_->front()->ActivateModalDialog(); 39 app_modal_dialog_queue_->front()->ActivateModalDialog();
41 } 40 }
42 41
43 // static 42 // static
44 void AppModalDialogQueue::ShowModalDialog( 43 void AppModalDialogQueue::ShowModalDialog(AppModalDialogDelegate* dialog) {
45 views::AppModalDialogDelegate* dialog) {
46 dialog->ShowModalDialog(); 44 dialog->ShowModalDialog();
47 active_dialog_ = dialog; 45 active_dialog_ = dialog;
48 } 46 }
OLDNEW
« no previous file with comments | « chrome/browser/app_modal_dialog_queue.h ('k') | chrome/browser/app_modal_dialog_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698