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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/metrics/user_metrics.h" |
9 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
12 #include "chrome/browser/importer/importer_lock_dialog.h" | 13 #include "chrome/browser/importer/importer_lock_dialog.h" |
13 #include "chrome/browser/ui/views/harmony/layout_delegate.h" | 14 #include "chrome/browser/ui/views/harmony/layout_delegate.h" |
14 #include "chrome/grit/chromium_strings.h" | 15 #include "chrome/grit/chromium_strings.h" |
15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
16 #include "chrome/grit/locale_settings.h" | 17 #include "chrome/grit/locale_settings.h" |
17 #include "content/public/browser/user_metrics.h" | |
18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/views/controls/label.h" | 19 #include "ui/views/controls/label.h" |
20 #include "ui/views/layout/layout_constants.h" | 20 #include "ui/views/layout/layout_constants.h" |
21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
22 | 22 |
23 using base::UserMetricsAction; | 23 using base::UserMetricsAction; |
24 | 24 |
25 namespace importer { | 25 namespace importer { |
26 | 26 |
27 void ShowImportLockDialog(gfx::NativeWindow parent, | 27 void ShowImportLockDialog(gfx::NativeWindow parent, |
28 const base::Callback<void(bool)>& callback) { | 28 const base::Callback<void(bool)>& callback) { |
29 ImportLockDialogView::Show(parent, callback); | 29 ImportLockDialogView::Show(parent, callback); |
30 content::RecordAction(UserMetricsAction("ImportLockDialogView_Shown")); | 30 base::RecordAction(UserMetricsAction("ImportLockDialogView_Shown")); |
31 } | 31 } |
32 | 32 |
33 } // namespace importer | 33 } // namespace importer |
34 | 34 |
35 // static | 35 // static |
36 void ImportLockDialogView::Show(gfx::NativeWindow parent, | 36 void ImportLockDialogView::Show(gfx::NativeWindow parent, |
37 const base::Callback<void(bool)>& callback) { | 37 const base::Callback<void(bool)>& callback) { |
38 views::DialogDelegate::CreateDialogWidget( | 38 views::DialogDelegate::CreateDialogWidget( |
39 new ImportLockDialogView(callback), NULL, NULL)->Show(); | 39 new ImportLockDialogView(callback), NULL, NULL)->Show(); |
40 } | 40 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 81 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
82 base::Bind(callback_, true)); | 82 base::Bind(callback_, true)); |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 bool ImportLockDialogView::Cancel() { | 86 bool ImportLockDialogView::Cancel() { |
87 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 87 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
88 base::Bind(callback_, false)); | 88 base::Bind(callback_, false)); |
89 return true; | 89 return true; |
90 } | 90 } |
OLD | NEW |