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

Unified Diff: chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc

Issue 360213002: Add Flex to views::BoxLayout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc
index 9bdcfe808eb906aa082896582f86ca653f1f2b0f..1eaf1f6ad4bd53385d09f2d27aaf0c7e95366b39 100644
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc
@@ -112,36 +112,14 @@ void AppInfoHeaderPanel::CreateControls() {
void AppInfoHeaderPanel::LayoutAppNameAndVersionInto(views::View* parent_view) {
views::View* view = new views::View();
- // We need a horizontal BoxLayout here to ensure that the GridLayout does
- // not stretch beyond the size of its content.
- view->SetLayoutManager(
- new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
+ views::BoxLayout* layout = new views::BoxLayout(
+ views::BoxLayout::kHorizontal, 0, 0, kSpacingBetweenAppTitleAndVersion);
+ view->SetLayoutManager(layout);
- views::View* container_view = new views::View();
- view->AddChildView(container_view);
- views::GridLayout* layout = new views::GridLayout(container_view);
- container_view->SetLayoutManager(layout);
-
- static const int kColumnId = 1;
- views::ColumnSet* column_set = layout->AddColumnSet(kColumnId);
- column_set->AddColumn(views::GridLayout::LEADING,
- views::GridLayout::TRAILING,
- 1, // Stretch the title to as wide as needed
- views::GridLayout::USE_PREF,
- 0,
- 0);
- column_set->AddPaddingColumn(0, kSpacingBetweenAppTitleAndVersion);
- column_set->AddColumn(views::GridLayout::LEADING,
- views::GridLayout::TRAILING,
- 0, // Do not stretch the version
- views::GridLayout::USE_PREF,
- 0,
- 0);
-
- layout->StartRow(1, kColumnId);
- layout->AddView(app_name_label_);
+ layout->SetFlexForViewAt(0, 1);
+ view->AddChildView(app_name_label_);
if (app_version_label_)
- layout->AddView(app_version_label_);
+ view->AddChildView(app_version_label_);
parent_view->AddChildView(view);
}

Powered by Google App Engine
This is Rietveld 408576698