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

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

Issue 13925019: fix GridLayout::CreatePanel for new style dialogs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | Annotate | Revision Log
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/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/importer/importer_host.h" 10 #include "chrome/browser/importer/importer_host.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ImportLockDialogView::~ImportLockDialogView() { 53 ImportLockDialogView::~ImportLockDialogView() {
54 } 54 }
55 55
56 gfx::Size ImportLockDialogView::GetPreferredSize() { 56 gfx::Size ImportLockDialogView::GetPreferredSize() {
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 description_label_->SetBounds( 63 if (DialogDelegate::UseNewStyle()) {
msw 2013/04/16 01:58:24 nit: I prefer the pattern of setting a local first
64 views::kPanelHorizMargin, 64 description_label_->SetBounds(
65 views::kPanelVertMargin, 65 views::kButtonHEdgeMargin,
66 width() - 2 * views::kPanelHorizMargin, 66 views::kPanelVertMargin,
67 height() - 2 * views::kPanelVertMargin); 67 width() - 2 * views::kButtonHEdgeMargin,
68 height() - 2 * views::kPanelVertMargin);
69 } else {
70 description_label_->SetBounds(
71 views::kPanelHorizMargin,
72 views::kPanelVertMargin,
73 width() - 2 * views::kPanelHorizMargin,
74 height() - 2 * views::kPanelVertMargin);
75 }
68 } 76 }
69 77
70 string16 ImportLockDialogView::GetDialogButtonLabel( 78 string16 ImportLockDialogView::GetDialogButtonLabel(
71 ui::DialogButton button) const { 79 ui::DialogButton button) const {
72 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ? 80 return l10n_util::GetStringUTF16((button == ui::DIALOG_BUTTON_OK) ?
73 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL); 81 IDS_IMPORTER_LOCK_OK : IDS_IMPORTER_LOCK_CANCEL);
74 } 82 }
75 83
76 string16 ImportLockDialogView::GetWindowTitle() const { 84 string16 ImportLockDialogView::GetWindowTitle() const {
77 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE); 85 return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE);
78 } 86 }
79 87
80 bool ImportLockDialogView::Accept() { 88 bool ImportLockDialogView::Accept() {
81 MessageLoop::current()->PostTask( 89 MessageLoop::current()->PostTask(
82 FROM_HERE, 90 FROM_HERE,
83 base::Bind(&ImporterHost::OnImportLockDialogEnd, 91 base::Bind(&ImporterHost::OnImportLockDialogEnd,
84 importer_host_.get(), true)); 92 importer_host_.get(), true));
85 return true; 93 return true;
86 } 94 }
87 95
88 bool ImportLockDialogView::Cancel() { 96 bool ImportLockDialogView::Cancel() {
89 MessageLoop::current()->PostTask( 97 MessageLoop::current()->PostTask(
90 FROM_HERE, 98 FROM_HERE,
91 base::Bind(&ImporterHost::OnImportLockDialogEnd, 99 base::Bind(&ImporterHost::OnImportLockDialogEnd,
92 importer_host_.get(), false)); 100 importer_host_.get(), false));
93 return true; 101 return true;
94 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698