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

Unified Diff: ui/app_list/views/contents_switcher_view.cc

Issue 392133002: Remove Layout code from ContentsSwitcherView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@land_return_to_page
Patch Set: 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
« no previous file with comments | « ui/app_list/views/contents_switcher_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/contents_switcher_view.cc
diff --git a/ui/app_list/views/contents_switcher_view.cc b/ui/app_list/views/contents_switcher_view.cc
index ec0643ec0b0fa31874da105b12f86e92c5f87e2d..4a628639520545c7712f6e145e59a9b2c1e95ff4 100644
--- a/ui/app_list/views/contents_switcher_view.cc
+++ b/ui/app_list/views/contents_switcher_view.cc
@@ -36,11 +36,11 @@ class ContentsPageIndicatorView : public views::View {
} // namespace
ContentsSwitcherView::ContentsSwitcherView(ContentsView* contents_view)
- : contents_view_(contents_view), buttons_(new views::View) {
- AddChildView(buttons_);
-
- buttons_->SetLayoutManager(new views::BoxLayout(
- views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing));
+ : contents_view_(contents_view) {
+ views::BoxLayout* layout = new views::BoxLayout(
+ views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing);
+ layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER);
+ SetLayoutManager(layout);
}
ContentsSwitcherView::~ContentsSwitcherView() {}
@@ -77,24 +77,7 @@ void ContentsSwitcherView::AddSwitcherButton(int resource_id, int page_index) {
button_container->AddChildView(indicator_container);
button_container->AddChildView(button);
- buttons_->AddChildView(button_container);
-}
-
-gfx::Size ContentsSwitcherView::GetPreferredSize() const {
- return gfx::Size(buttons_->GetPreferredSize().width(),
- kButtonImageSize + kContentsSwitcherSeparatorHeight);
-}
-
-void ContentsSwitcherView::Layout() {
- gfx::Rect rect(GetContentsBounds());
-
- // Makes |buttons_| horizontally center and vertically fill.
- gfx::Size buttons_size(buttons_->GetPreferredSize());
- gfx::Rect buttons_bounds(rect.CenterPoint().x() - buttons_size.width() / 2,
- rect.y(),
- buttons_size.width(),
- rect.height());
- buttons_->SetBoundsRect(gfx::IntersectRects(rect, buttons_bounds));
+ AddChildView(button_container);
}
void ContentsSwitcherView::ButtonPressed(views::Button* sender,
« no previous file with comments | « ui/app_list/views/contents_switcher_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698