OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/importer/import_lock_dialog_view.h" | 5 #include "chrome/browser/ui/views/importer/import_lock_dialog_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/importer/importer_lock_dialog.h" | 10 #include "chrome/browser/importer/importer_lock_dialog.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 const base::Callback<void(bool)>& callback) { | 29 const base::Callback<void(bool)>& callback) { |
30 ImportLockDialogView::Show(parent, callback); | 30 ImportLockDialogView::Show(parent, callback); |
31 content::RecordAction(UserMetricsAction("ImportLockDialogView_Shown")); | 31 content::RecordAction(UserMetricsAction("ImportLockDialogView_Shown")); |
32 } | 32 } |
33 | 33 |
34 } // namespace importer | 34 } // namespace importer |
35 | 35 |
36 // static | 36 // static |
37 void ImportLockDialogView::Show(gfx::NativeWindow parent, | 37 void ImportLockDialogView::Show(gfx::NativeWindow parent, |
38 const base::Callback<void(bool)>& callback) { | 38 const base::Callback<void(bool)>& callback) { |
39 views::Widget::CreateWindow(new ImportLockDialogView(callback))->Show(); | 39 views::DialogDelegate::CreateDialogWidget( |
| 40 new ImportLockDialogView(callback), NULL, NULL)->Show(); |
40 } | 41 } |
41 | 42 |
42 ImportLockDialogView::ImportLockDialogView( | 43 ImportLockDialogView::ImportLockDialogView( |
43 const base::Callback<void(bool)>& callback) | 44 const base::Callback<void(bool)>& callback) |
44 : description_label_(NULL), | 45 : description_label_(NULL), |
45 callback_(callback) { | 46 callback_(callback) { |
46 description_label_ = new views::Label( | 47 description_label_ = new views::Label( |
47 l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT)); | 48 l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT)); |
48 description_label_->SetMultiLine(true); | 49 description_label_->SetMultiLine(true); |
49 description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 50 description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 base::MessageLoop::current()->PostTask(FROM_HERE, | 90 base::MessageLoop::current()->PostTask(FROM_HERE, |
90 base::Bind(callback_, true)); | 91 base::Bind(callback_, true)); |
91 return true; | 92 return true; |
92 } | 93 } |
93 | 94 |
94 bool ImportLockDialogView::Cancel() { | 95 bool ImportLockDialogView::Cancel() { |
95 base::MessageLoop::current()->PostTask(FROM_HERE, | 96 base::MessageLoop::current()->PostTask(FROM_HERE, |
96 base::Bind(callback_, false)); | 97 base::Bind(callback_, false)); |
97 return true; | 98 return true; |
98 } | 99 } |
OLD | NEW |