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

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

Issue 2713803002: Views/Harmony: Use LayoutDelegate::GetMetric for views::kPanelVertMargin. (Closed)
Patch Set: Fix many crashes. Created 3 years, 9 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/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/browser/importer/importer_lock_dialog.h" 12 #include "chrome/browser/importer/importer_lock_dialog.h"
13 #include "chrome/browser/ui/views/harmony/layout_delegate.h"
13 #include "chrome/grit/chromium_strings.h" 14 #include "chrome/grit/chromium_strings.h"
14 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
15 #include "chrome/grit/locale_settings.h" 16 #include "chrome/grit/locale_settings.h"
16 #include "content/public/browser/user_metrics.h" 17 #include "content/public/browser/user_metrics.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
18 #include "ui/views/controls/label.h" 19 #include "ui/views/controls/label.h"
19 #include "ui/views/layout/layout_constants.h" 20 #include "ui/views/layout/layout_constants.h"
20 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
21 22
22 using base::UserMetricsAction; 23 using base::UserMetricsAction;
(...skipping 30 matching lines...) Expand all
53 } 54 }
54 55
55 gfx::Size ImportLockDialogView::GetPreferredSize() const { 56 gfx::Size ImportLockDialogView::GetPreferredSize() const {
56 return gfx::Size(views::Widget::GetLocalizedContentsSize( 57 return gfx::Size(views::Widget::GetLocalizedContentsSize(
57 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS, 58 IDS_IMPORTLOCK_DIALOG_WIDTH_CHARS,
58 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES)); 59 IDS_IMPORTLOCK_DIALOG_HEIGHT_LINES));
59 } 60 }
60 61
61 void ImportLockDialogView::Layout() { 62 void ImportLockDialogView::Layout() {
62 gfx::Rect bounds(GetLocalBounds()); 63 gfx::Rect bounds(GetLocalBounds());
63 bounds.Inset(views::kButtonHEdgeMargin, views::kPanelVertMargin); 64 bounds.Inset(views::kButtonHEdgeMargin,
tapted 2017/02/27 03:24:51 This should probably be using the "new" edge margi
Peter Kasting 2017/02/28 02:21:39 +1 to all this
Patti Lor 2017/03/03 08:24:39 Done.
65 LayoutDelegate::Get()->GetMetric(
66 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN));
64 description_label_->SetBoundsRect(bounds); 67 description_label_->SetBoundsRect(bounds);
65 } 68 }
66 69
67 base::string16 ImportLockDialogView::GetDialogButtonLabel( 70 base::string16 ImportLockDialogView::GetDialogButtonLabel(
68 ui::DialogButton button) const { 71 ui::DialogButton button) const {
69 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? 72 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ?
70 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); 73 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL);
71 } 74 }
72 75
73 base::string16 ImportLockDialogView::GetWindowTitle() const { 76 base::string16 ImportLockDialogView::GetWindowTitle() const {
74 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); 77 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE);
75 } 78 }
76 79
77 bool ImportLockDialogView::Accept() { 80 bool ImportLockDialogView::Accept() {
78 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 81 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
79 base::Bind(callback_, true)); 82 base::Bind(callback_, true));
80 return true; 83 return true;
81 } 84 }
82 85
83 bool ImportLockDialogView::Cancel() { 86 bool ImportLockDialogView::Cancel() {
84 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 87 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
85 base::Bind(callback_, false)); 88 base::Bind(callback_, false));
86 return true; 89 return true;
87 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698