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

Side by Side Diff: chrome/browser/ui/views/extensions/media_galleries_dialog_views.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/extensions/media_galleries_dialog_views.h" 5 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/ui/views/constrained_window_views.h" 8 #include "chrome/browser/ui/views/constrained_window_views.h"
9 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" 9 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
10 #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h" 10 #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 web_contents_modal_dialog_manager->ShowDialog(window_->GetNativeView()); 94 web_contents_modal_dialog_manager->ShowDialog(window_->GetNativeView());
95 } 95 }
96 96
97 MediaGalleriesDialogViews::~MediaGalleriesDialogViews() {} 97 MediaGalleriesDialogViews::~MediaGalleriesDialogViews() {}
98 98
99 void MediaGalleriesDialogViews::InitChildViews() { 99 void MediaGalleriesDialogViews::InitChildViews() {
100 // Outer dialog layout. 100 // Outer dialog layout.
101 contents_->RemoveAllChildViews(true); 101 contents_->RemoveAllChildViews(true);
102 int dialog_content_width = views::Widget::GetLocalizedContentsWidth( 102 int dialog_content_width = views::Widget::GetLocalizedContentsWidth(
103 IDS_MEDIA_GALLERIES_DIALOG_CONTENT_WIDTH_CHARS); 103 IDS_MEDIA_GALLERIES_DIALOG_CONTENT_WIDTH_CHARS);
104 views::GridLayout* layout = new views::GridLayout(contents_); 104 views::GridLayout* layout = views::GridLayout::CreatePanel(contents_);
105 layout->SetInsets(views::kPanelVertMargin, views::kPanelHorizMargin, 105 contents_->SetLayoutManager(layout);
106 0, views::kPanelHorizMargin);
107 106
108 int column_set_id = 0; 107 int column_set_id = 0;
109 views::ColumnSet* columns = layout->AddColumnSet(column_set_id); 108 views::ColumnSet* columns = layout->AddColumnSet(column_set_id);
110 columns->AddColumn(views::GridLayout::LEADING, 109 columns->AddColumn(views::GridLayout::LEADING,
111 views::GridLayout::LEADING, 110 views::GridLayout::LEADING,
112 1, 111 1,
113 views::GridLayout::FIXED, 112 views::GridLayout::FIXED,
114 dialog_content_width, 113 dialog_content_width,
115 0); 114 0);
116 contents_->SetLayoutManager(layout);
117 contents_->set_border(views::Border::CreateEmptyBorder(
118 views::kPanelSubVerticalSpacing,
119 0,
120 views::kPanelSubVerticalSpacing,
121 0));
122 115
123 // Header text. 116 if (!DialogDelegate::UseNewStyle()) {
124 views::Label* header = new views::Label(controller_->GetHeader()); 117 // Header text.
125 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 118 views::Label* header = new views::Label(controller_->GetHeader());
126 header->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); 119 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
127 header->SetHorizontalAlignment(gfx::ALIGN_LEFT); 120 header->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
128 layout->StartRow(0, column_set_id); 121 header->SetHorizontalAlignment(gfx::ALIGN_LEFT);
129 layout->AddView(header); 122 layout->StartRow(0, column_set_id);
123 layout->AddView(header);
124 }
130 125
131 // Message text. 126 // Message text.
132 views::Label* subtext = new views::Label(controller_->GetSubtext()); 127 views::Label* subtext = new views::Label(controller_->GetSubtext());
133 subtext->SetMultiLine(true); 128 subtext->SetMultiLine(true);
134 subtext->SetHorizontalAlignment(gfx::ALIGN_LEFT); 129 subtext->SetHorizontalAlignment(gfx::ALIGN_LEFT);
135 layout->StartRowWithPadding(0, column_set_id, 130 layout->StartRowWithPadding(0, column_set_id,
136 0, views::kRelatedControlVerticalSpacing); 131 0, views::kRelatedControlVerticalSpacing);
137 layout->AddView(subtext); 132 layout->AddView(subtext);
138 133
139 // Scrollable area for checkboxes. 134 // Scrollable area for checkboxes.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 checkbox_map_[gallery] = checkbox; 299 checkbox_map_[gallery] = checkbox;
305 300
306 return true; 301 return true;
307 } 302 }
308 303
309 string16 MediaGalleriesDialogViews::GetWindowTitle() const { 304 string16 MediaGalleriesDialogViews::GetWindowTitle() const {
310 return controller_->GetHeader(); 305 return controller_->GetHeader();
311 } 306 }
312 307
313 bool MediaGalleriesDialogViews::ShouldShowWindowTitle() const { 308 bool MediaGalleriesDialogViews::ShouldShowWindowTitle() const {
314 return false; 309 return DialogDelegate::UseNewStyle();
msw 2013/04/16 01:58:24 I don't think this matters (not checked in DialogD
Evan Stade 2013/04/16 19:58:25 regardless, it seems correct, and is less confusin
315 } 310 }
316 311
317 void MediaGalleriesDialogViews::DeleteDelegate() { 312 void MediaGalleriesDialogViews::DeleteDelegate() {
318 controller_->DialogFinished(accepted_); 313 controller_->DialogFinished(accepted_);
319 } 314 }
320 315
321 views::Widget* MediaGalleriesDialogViews::GetWidget() { 316 views::Widget* MediaGalleriesDialogViews::GetWidget() {
322 return contents_->GetWidget(); 317 return contents_->GetWidget();
323 } 318 }
324 319
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 385
391 // MediaGalleriesDialogViewsController ----------------------------------------- 386 // MediaGalleriesDialogViewsController -----------------------------------------
392 387
393 // static 388 // static
394 MediaGalleriesDialog* MediaGalleriesDialog::Create( 389 MediaGalleriesDialog* MediaGalleriesDialog::Create(
395 MediaGalleriesDialogController* controller) { 390 MediaGalleriesDialogController* controller) {
396 return new MediaGalleriesDialogViews(controller); 391 return new MediaGalleriesDialogViews(controller);
397 } 392 }
398 393
399 } // namespace chrome 394 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698