| 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" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 gfx::Size ImportLockDialogView::GetPreferredSize() const { | 58 gfx::Size ImportLockDialogView::GetPreferredSize() const { |
| 59 return gfx::Size(views::Widget::GetLocalizedContentsSize( | 59 return gfx::Size(views::Widget::GetLocalizedContentsSize( |
| 60 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS, | 60 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS, |
| 61 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES)); | 61 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void ImportLockDialogView::Layout() { | 64 void ImportLockDialogView::Layout() { |
| 65 gfx::Rect bounds(GetLocalBounds()); | 65 gfx::Rect bounds(GetLocalBounds()); |
| 66 bounds.Inset(views::kButtonHEdgeMarginNew, | 66 const ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
| 67 ChromeLayoutProvider::Get()->GetDistanceMetric( | 67 bounds.Inset(provider->GetDistanceMetric( |
| 68 DISTANCE_PANEL_CONTENT_MARGIN)); | 68 views::DISTANCE_DIALOG_CONTENTS_HORIZONTAL_MARGIN), |
| 69 provider->GetDistanceMetric( |
| 70 views::DISTANCE_DIALOG_CONTENTS_VERTICAL_MARGIN)); |
| 69 description_label_->SetBoundsRect(bounds); | 71 description_label_->SetBoundsRect(bounds); |
| 70 } | 72 } |
| 71 | 73 |
| 72 base::string16 ImportLockDialogView::GetDialogButtonLabel( | 74 base::string16 ImportLockDialogView::GetDialogButtonLabel( |
| 73 ui::DialogButton button) const { | 75 ui::DialogButton button) const { |
| 74 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? | 76 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? |
| 75 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); | 77 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); |
| 76 } | 78 } |
| 77 | 79 |
| 78 base::string16 ImportLockDialogView::GetWindowTitle() const { | 80 base::string16 ImportLockDialogView::GetWindowTitle() const { |
| 79 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); | 81 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); |
| 80 } | 82 } |
| 81 | 83 |
| 82 bool ImportLockDialogView::Accept() { | 84 bool ImportLockDialogView::Accept() { |
| 83 base::ThreadTaskRunnerHandle::Get()->PostTask( | 85 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 84 FROM_HERE, base::BindOnce(callback_, true)); | 86 FROM_HERE, base::BindOnce(callback_, true)); |
| 85 return true; | 87 return true; |
| 86 } | 88 } |
| 87 | 89 |
| 88 bool ImportLockDialogView::Cancel() { | 90 bool ImportLockDialogView::Cancel() { |
| 89 base::ThreadTaskRunnerHandle::Get()->PostTask( | 91 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 90 FROM_HERE, base::BindOnce(callback_, false)); | 92 FROM_HERE, base::BindOnce(callback_, false)); |
| 91 return true; | 93 return true; |
| 92 } | 94 } |
| OLD | NEW |