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.h" | 5 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
6 | 6 |
7 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" | 7 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" |
8 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 8 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
| 9 #include "chrome/common/chrome_notification_types.h" |
9 #include "content/browser/javascript_dialogs.h" | 10 #include "content/browser/javascript_dialogs.h" |
10 #include "content/browser/tab_contents/tab_contents.h" | 11 #include "content/browser/tab_contents/tab_contents.h" |
11 #include "content/common/notification_service.h" | 12 #include "content/common/notification_service.h" |
12 #include "content/common/notification_type.h" | |
13 | 13 |
14 AppModalDialog::AppModalDialog(content::DialogDelegate* delegate, | 14 AppModalDialog::AppModalDialog(content::DialogDelegate* delegate, |
15 const string16& title) | 15 const string16& title) |
16 : valid_(true), | 16 : valid_(true), |
17 delegate_(delegate), | 17 delegate_(delegate), |
18 native_dialog_(NULL), | 18 native_dialog_(NULL), |
19 title_(title) { | 19 title_(title) { |
20 } | 20 } |
21 | 21 |
22 AppModalDialog::~AppModalDialog() { | 22 AppModalDialog::~AppModalDialog() { |
23 } | 23 } |
24 | 24 |
25 void AppModalDialog::ShowModalDialog() { | 25 void AppModalDialog::ShowModalDialog() { |
26 if (delegate_) | 26 if (delegate_) |
27 delegate_->OnDialogShown(); | 27 delegate_->OnDialogShown(); |
28 | 28 |
29 CreateAndShowDialog(); | 29 CreateAndShowDialog(); |
30 | 30 |
31 NotificationService::current()->Notify( | 31 NotificationService::current()->Notify( |
32 NotificationType::APP_MODAL_DIALOG_SHOWN, | 32 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, |
33 Source<AppModalDialog>(this), | 33 Source<AppModalDialog>(this), |
34 NotificationService::NoDetails()); | 34 NotificationService::NoDetails()); |
35 } | 35 } |
36 | 36 |
37 void AppModalDialog::CreateAndShowDialog() { | 37 void AppModalDialog::CreateAndShowDialog() { |
38 native_dialog_ = CreateNativeDialog(); | 38 native_dialog_ = CreateNativeDialog(); |
39 native_dialog_->ShowAppModalDialog(); | 39 native_dialog_->ShowAppModalDialog(); |
40 } | 40 } |
41 | 41 |
42 bool AppModalDialog::IsValid() { | 42 bool AppModalDialog::IsValid() { |
(...skipping 18 matching lines...) Expand all Loading... |
61 } | 61 } |
62 | 62 |
63 void AppModalDialog::CloseModalDialog() { | 63 void AppModalDialog::CloseModalDialog() { |
64 DCHECK(native_dialog_); | 64 DCHECK(native_dialog_); |
65 native_dialog_->CloseAppModalDialog(); | 65 native_dialog_->CloseAppModalDialog(); |
66 } | 66 } |
67 | 67 |
68 void AppModalDialog::CompleteDialog() { | 68 void AppModalDialog::CompleteDialog() { |
69 AppModalDialogQueue::GetInstance()->ShowNextDialog(); | 69 AppModalDialogQueue::GetInstance()->ShowNextDialog(); |
70 } | 70 } |
OLD | NEW |