Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/ui/views/importer/import_lock_dialog_view.cc

Issue 2888563004: Delete panel metrics and define insets in terms of distance metrics. (Closed)
Patch Set: edits 2 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 gfx::Size ImportLockDialogView::GetPreferredSize() const { 56 gfx::Size ImportLockDialogView::GetPreferredSize() const {
57 return gfx::Size(views::Widget::GetLocalizedContentsSize( 57 return gfx::Size(views::Widget::GetLocalizedContentsSize(
58 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS, 58 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS,
59 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES)); 59 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES));
60 } 60 }
61 61
62 void ImportLockDialogView::Layout() { 62 void ImportLockDialogView::Layout() {
63 gfx::Rect bounds(GetLocalBounds()); 63 gfx::Rect bounds(GetLocalBounds());
64 bounds.Inset(views::kButtonHEdgeMarginNew, 64 const ChromeLayoutProvider* provider = ChromeLayoutProvider::Get();
65 ChromeLayoutProvider::Get()->GetDistanceMetric( 65 bounds.Inset(provider->GetDistanceMetric(
66 DISTANCE_PANEL_CONTENT_MARGIN)); 66 views::DISTANCE_DIALOG_CONTENTS_HORIZONTAL_MARGIN),
67 provider->GetDistanceMetric(
68 views::DISTANCE_DIALOG_CONTENTS_VERTICAL_MARGIN));
67 description_label_->SetBoundsRect(bounds); 69 description_label_->SetBoundsRect(bounds);
68 } 70 }
69 71
70 base::string16 ImportLockDialogView::GetDialogButtonLabel( 72 base::string16 ImportLockDialogView::GetDialogButtonLabel(
71 ui::DialogButton button) const { 73 ui::DialogButton button) const {
72 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? 74 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ?
73 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); 75 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL);
74 } 76 }
75 77
76 base::string16 ImportLockDialogView::GetWindowTitle() const { 78 base::string16 ImportLockDialogView::GetWindowTitle() const {
77 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); 79 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE);
78 } 80 }
79 81
80 bool ImportLockDialogView::Accept() { 82 bool ImportLockDialogView::Accept() {
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698