| 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/metrics/user_metrics.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "chrome/browser/importer/importer_lock_dialog.h" | 13 #include "chrome/browser/importer/importer_lock_dialog.h" |
| 14 #include "chrome/browser/ui/browser_dialogs.h" |
| 14 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 15 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 15 #include "chrome/grit/chromium_strings.h" | 16 #include "chrome/grit/chromium_strings.h" |
| 16 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
| 17 #include "chrome/grit/locale_settings.h" | 18 #include "chrome/grit/locale_settings.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
| 20 #include "ui/views/layout/layout_constants.h" | 21 #include "ui/views/layout/layout_constants.h" |
| 21 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 22 | 23 |
| 23 using base::UserMetricsAction; | 24 using base::UserMetricsAction; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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); |
| 50 AddChildView(description_label_); | 51 AddChildView(description_label_); |
| 52 chrome::RecordDialogCreation(chrome::DialogIdentifier::IMPORT_LOCK); |
| 51 } | 53 } |
| 52 | 54 |
| 53 ImportLockDialogView::~ImportLockDialogView() { | 55 ImportLockDialogView::~ImportLockDialogView() { |
| 54 } | 56 } |
| 55 | 57 |
| 56 gfx::Size ImportLockDialogView::GetPreferredSize() const { | 58 gfx::Size ImportLockDialogView::GetPreferredSize() const { |
| 57 return gfx::Size(views::Widget::GetLocalizedContentsSize( | 59 return gfx::Size(views::Widget::GetLocalizedContentsSize( |
| 58 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS, | 60 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS, |
| 59 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES)); | 61 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES)); |
| 60 } | 62 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 81 base::ThreadTaskRunnerHandle::Get()->PostTask( | 83 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 82 FROM_HERE, base::BindOnce(callback_, true)); | 84 FROM_HERE, base::BindOnce(callback_, true)); |
| 83 return true; | 85 return true; |
| 84 } | 86 } |
| 85 | 87 |
| 86 bool ImportLockDialogView::Cancel() { | 88 bool ImportLockDialogView::Cancel() { |
| 87 base::ThreadTaskRunnerHandle::Get()->PostTask( | 89 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 88 FROM_HERE, base::BindOnce(callback_, false)); | 90 FROM_HERE, base::BindOnce(callback_, false)); |
| 89 return true; | 91 return true; |
| 90 } | 92 } |
| OLD | NEW |