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

Side by Side Diff: ui/views/controls/message_box_view.cc

Issue 10933085: Update ConstrainedWindowViews appearance according to mock (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Browser test fixes Created 8 years, 2 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 "ui/views/controls/message_box_view.h" 5 #include "ui/views/controls/message_box_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } // namespace 59 } // namespace
60 60
61 namespace views { 61 namespace views {
62 62
63 /////////////////////////////////////////////////////////////////////////////// 63 ///////////////////////////////////////////////////////////////////////////////
64 // MessageBoxView, public: 64 // MessageBoxView, public:
65 65
66 MessageBoxView::InitParams::InitParams(const string16& message) 66 MessageBoxView::InitParams::InitParams(const string16& message)
67 : options(NO_OPTIONS), 67 : options(NO_OPTIONS),
68 message(message), 68 message(message),
69 message_width(kDefaultMessageWidth) { 69 message_width(kDefaultMessageWidth),
70 top_inset(kPanelVertMargin),
71 bottom_inset(kPanelVertMargin),
72 left_inset(kPanelHorizMargin),
73 right_inset(kPanelHorizMargin),
74 inter_row_vertical_spacing(kRelatedControlVerticalSpacing)
75 {
70 } 76 }
71 77
72 MessageBoxView::InitParams::~InitParams() { 78 MessageBoxView::InitParams::~InitParams() {
73 } 79 }
74 80
75 MessageBoxView::MessageBoxView(const InitParams& params) 81 MessageBoxView::MessageBoxView(const InitParams& params)
76 : prompt_field_(NULL), 82 : prompt_field_(NULL),
77 icon_(NULL), 83 icon_(NULL),
78 checkbox_(NULL), 84 checkbox_(NULL),
79 message_width_(params.message_width) { 85 message_width_(params.message_width) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 message_label->SetAllowCharacterBreak(true); 187 message_label->SetAllowCharacterBreak(true);
182 message_label->SetHorizontalAlignment(Label::ALIGN_LEFT); 188 message_label->SetHorizontalAlignment(Label::ALIGN_LEFT);
183 message_labels_.push_back(message_label); 189 message_labels_.push_back(message_label);
184 } 190 }
185 191
186 if (params.options & HAS_PROMPT_FIELD) { 192 if (params.options & HAS_PROMPT_FIELD) {
187 prompt_field_ = new Textfield; 193 prompt_field_ = new Textfield;
188 prompt_field_->SetText(params.default_prompt); 194 prompt_field_->SetText(params.default_prompt);
189 } 195 }
190 196
197 top_inset_ = params.top_inset;
198 bottom_inset_ = params.bottom_inset;
199 left_inset_ = params.left_inset;
200 right_inset_ = params.right_inset;
201 inter_row_vertical_spacing_ = params.inter_row_vertical_spacing;
202
191 ResetLayoutManager(); 203 ResetLayoutManager();
192 } 204 }
193 205
194 void MessageBoxView::ResetLayoutManager() { 206 void MessageBoxView::ResetLayoutManager() {
195 // Initialize the Grid Layout Manager used for this dialog box. 207 // Initialize the Grid Layout Manager used for this dialog box.
196 GridLayout* layout = GridLayout::CreatePanel(this); 208 GridLayout* layout = GridLayout::CreatePanel(this);
209 layout->SetInsets(top_inset_, bottom_inset_, left_inset_, right_inset_);
197 SetLayoutManager(layout); 210 SetLayoutManager(layout);
198 211
199 gfx::Size icon_size; 212 gfx::Size icon_size;
200 if (icon_) 213 if (icon_)
201 icon_size = icon_->GetPreferredSize(); 214 icon_size = icon_->GetPreferredSize();
202 215
203 // Add the column set for the message displayed at the top of the dialog box. 216 // Add the column set for the message displayed at the top of the dialog box.
204 // And an icon, if one has been set. 217 // And an icon, if one has been set.
205 const int message_column_view_set_id = 0; 218 const int message_column_view_set_id = 0;
206 ColumnSet* column_set = layout->AddColumnSet(message_column_view_set_id); 219 ColumnSet* column_set = layout->AddColumnSet(message_column_view_set_id);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 if (icon_) { 255 if (icon_) {
243 if (i == 0) 256 if (i == 0)
244 layout->AddView(icon_); 257 layout->AddView(icon_);
245 else 258 else
246 layout->SkipColumns(1); 259 layout->SkipColumns(1);
247 } 260 }
248 layout->AddView(message_labels_[i]); 261 layout->AddView(message_labels_[i]);
249 } 262 }
250 263
251 if (prompt_field_) { 264 if (prompt_field_) {
252 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 265 layout->AddPaddingRow(0, inter_row_vertical_spacing_);
253 layout->StartRow(0, textfield_column_view_set_id); 266 layout->StartRow(0, textfield_column_view_set_id);
254 layout->AddView(prompt_field_); 267 layout->AddView(prompt_field_);
255 } 268 }
256 269
257 if (checkbox_) { 270 if (checkbox_) {
258 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 271 layout->AddPaddingRow(0, inter_row_vertical_spacing_);
259 layout->StartRow(0, checkbox_column_view_set_id); 272 layout->StartRow(0, checkbox_column_view_set_id);
260 layout->AddView(checkbox_); 273 layout->AddView(checkbox_);
261 } 274 }
262 275
263 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 276 layout->AddPaddingRow(0, inter_row_vertical_spacing_);
264 } 277 }
265 278
266 } // namespace views 279 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698