-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::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_);
- if (app_version_label_)
- layout->AddView(app_version_label_);
-
- parent_view->AddChildView(view);
-}
-