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

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

Issue 2785683003: views: implement width snapping for DialogDelegateViews (Closed)
Patch Set: 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
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 description_label_ = new views::Label( 46 description_label_ = new views::Label(
47 l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT)); 47 l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT));
48 description_label_->SetMultiLine(true); 48 description_label_->SetMultiLine(true);
49 description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 49 description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
50 AddChildView(description_label_); 50 AddChildView(description_label_);
51 } 51 }
52 52
53 ImportLockDialogView::~ImportLockDialogView() { 53 ImportLockDialogView::~ImportLockDialogView() {
54 } 54 }
55 55
56 gfx::Size ImportLockDialogView::GetPreferredSize() const { 56 gfx::Size ImportLockDialogView::GetUnsnappedPreferredSize() 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 LayoutDelegate::Get()->GetMetric(
66 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN)); 66 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN));
(...skipping 14 matching lines...) Expand all
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

Powered by Google App Engine
This is Rietveld 408576698