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 ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
67 ChromeLayoutProvider::Get()->GetDistanceMetric( | 67 bounds.Inset(provider->GetDistanceMetric(DISTANCE_DIALOG_BUTTON_MARGIN), , |
68 DISTANCE_PANEL_CONTENT_MARGIN)); | 68 provider->GetDistanceMetric(DISTANCE_PANEL_CONTENT_MARGIN)); |
69 description_label_->SetBoundsRect(bounds); | 69 description_label_->SetBoundsRect(bounds); |
70 } | 70 } |
71 | 71 |
72 base::string16 ImportLockDialogView::GetDialogButtonLabel( | 72 base::string16 ImportLockDialogView::GetDialogButtonLabel( |
73 ui::DialogButton button) const { | 73 ui::DialogButton button) const { |
74 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? | 74 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? |
75 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); | 75 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); |
76 } | 76 } |
77 | 77 |
78 base::string16 ImportLockDialogView::GetWindowTitle() const { | 78 base::string16 ImportLockDialogView::GetWindowTitle() const { |
79 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); | 79 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); |
80 } | 80 } |
81 | 81 |
82 bool ImportLockDialogView::Accept() { | 82 bool ImportLockDialogView::Accept() { |
83 base::ThreadTaskRunnerHandle::Get()->PostTask( | 83 base::ThreadTaskRunnerHandle::Get()->PostTask( |
84 FROM_HERE, base::BindOnce(callback_, true)); | 84 FROM_HERE, base::BindOnce(callback_, true)); |
85 return true; | 85 return true; |
86 } | 86 } |
87 | 87 |
88 bool ImportLockDialogView::Cancel() { | 88 bool ImportLockDialogView::Cancel() { |
89 base::ThreadTaskRunnerHandle::Get()->PostTask( | 89 base::ThreadTaskRunnerHandle::Get()->PostTask( |
90 FROM_HERE, base::BindOnce(callback_, false)); | 90 FROM_HERE, base::BindOnce(callback_, false)); |
91 return true; | 91 return true; |
92 } | 92 } |
OLD | NEW |