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

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

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Final feedback addressed Created 3 years, 8 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
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.cc ('k') | chrome/browser/ui/views/login_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
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/views/harmony/layout_delegate.h" 14 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
15 #include "chrome/grit/chromium_strings.h" 15 #include "chrome/grit/chromium_strings.h"
16 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
17 #include "chrome/grit/locale_settings.h" 17 #include "chrome/grit/locale_settings.h"
18 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/views/controls/label.h" 19 #include "ui/views/controls/label.h"
20 #include "ui/views/layout/layout_constants.h" 20 #include "ui/views/layout/layout_constants.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 using base::UserMetricsAction; 23 using base::UserMetricsAction;
24 24
(...skipping 30 matching lines...) Expand all
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 bounds.Inset(views::kButtonHEdgeMarginNew,
65 LayoutDelegate::Get()->GetMetric( 65 ChromeLayoutProvider::Get()->GetDistanceMetric(
66 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN)); 66 DISTANCE_PANEL_CONTENT_MARGIN));
67 description_label_->SetBoundsRect(bounds); 67 description_label_->SetBoundsRect(bounds);
68 } 68 }
69 69
70 base::string16 ImportLockDialogView::GetDialogButtonLabel( 70 base::string16 ImportLockDialogView::GetDialogButtonLabel(
71 ui::DialogButton button) const { 71 ui::DialogButton button) const {
72 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? 72 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ?
73 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); 73 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL);
74 } 74 }
75 75
76 base::string16 ImportLockDialogView::GetWindowTitle() const { 76 base::string16 ImportLockDialogView::GetWindowTitle() const {
77 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); 77 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE);
78 } 78 }
79 79
80 bool ImportLockDialogView::Accept() { 80 bool ImportLockDialogView::Accept() {
81 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 81 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
82 base::Bind(callback_, true)); 82 base::Bind(callback_, true));
83 return true; 83 return true;
84 } 84 }
85 85
86 bool ImportLockDialogView::Cancel() { 86 bool ImportLockDialogView::Cancel() {
87 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 87 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
88 base::Bind(callback_, false)); 88 base::Bind(callback_, false));
89 return true; 89 return true;
90 } 90 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.cc ('k') | chrome/browser/ui/views/login_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698