OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app_list/views/contents_switcher_view.h" | 5 #include "ui/app_list/views/contents_switcher_view.h" |
6 | 6 |
7 #include "ui/app_list/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
8 #include "ui/app_list/views/contents_view.h" | 8 #include "ui/app_list/views/contents_view.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/views/controls/button/custom_button.h" | 10 #include "ui/views/controls/button/custom_button.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 ContentsSwitcherView::ContentsSwitcherView(ContentsView* contents_view) | 61 ContentsSwitcherView::ContentsSwitcherView(ContentsView* contents_view) |
62 : contents_view_(contents_view), | 62 : contents_view_(contents_view), |
63 buttons_(new views::View) { | 63 buttons_(new views::View) { |
64 AddChildView(buttons_); | 64 AddChildView(buttons_); |
65 | 65 |
66 buttons_->SetLayoutManager(new views::BoxLayout( | 66 buttons_->SetLayoutManager(new views::BoxLayout( |
67 views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing)); | 67 views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing)); |
68 buttons_->AddChildView( | 68 buttons_->AddChildView( |
69 new ContentsSwitcherButton(this, ContentsView::SHOW_APPS)); | 69 new ContentsSwitcherButton(this, ContentsView::SHOW_APPS)); |
70 buttons_->AddChildView( | 70 buttons_->AddChildView( |
| 71 new ContentsSwitcherButton(this, ContentsView::SHOW_START_PAGE)); |
| 72 buttons_->AddChildView( |
71 new ContentsSwitcherButton(this, ContentsView::SHOW_SEARCH_RESULTS)); | 73 new ContentsSwitcherButton(this, ContentsView::SHOW_SEARCH_RESULTS)); |
72 } | 74 } |
73 | 75 |
74 ContentsSwitcherView::~ContentsSwitcherView() { | 76 ContentsSwitcherView::~ContentsSwitcherView() { |
75 } | 77 } |
76 | 78 |
77 gfx::Size ContentsSwitcherView::GetPreferredSize() { | 79 gfx::Size ContentsSwitcherView::GetPreferredSize() { |
78 return gfx::Size(buttons_->GetPreferredSize().width(), | 80 return gfx::Size(buttons_->GetPreferredSize().width(), |
79 kPreferredHeight); | 81 kPreferredHeight); |
80 } | 82 } |
(...skipping 10 matching lines...) Expand all Loading... |
91 buttons_->SetBoundsRect(gfx::IntersectRects(rect, buttons_bounds)); | 93 buttons_->SetBoundsRect(gfx::IntersectRects(rect, buttons_bounds)); |
92 } | 94 } |
93 | 95 |
94 void ContentsSwitcherView::ButtonPressed(views::Button* sender, | 96 void ContentsSwitcherView::ButtonPressed(views::Button* sender, |
95 const ui::Event& event) { | 97 const ui::Event& event) { |
96 contents_view_->SetShowState( | 98 contents_view_->SetShowState( |
97 static_cast<ContentsView::ShowState>(sender->tag())); | 99 static_cast<ContentsView::ShowState>(sender->tag())); |
98 } | 100 } |
99 | 101 |
100 } // namespace app_list | 102 } // namespace app_list |
OLD | NEW |