OLD | NEW |
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 "ui/app_list/page_switcher.h" | 5 #include "ui/app_list/page_switcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "third_party/skia/include/core/SkPath.h" | 9 #include "third_party/skia/include/core/SkPath.h" |
10 #include "ui/app_list/pagination_model.h" | 10 #include "ui/app_list/pagination_model.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 std::max(kMinButtonWidth, button_width)); | 168 std::max(kMinButtonWidth, button_width)); |
169 | 169 |
170 for (int i = 0; i < button_count; ++i) { | 170 for (int i = 0; i < button_count; ++i) { |
171 PageSwitcherButton* button = | 171 PageSwitcherButton* button = |
172 static_cast<PageSwitcherButton*>(buttons_->child_at(i)); | 172 static_cast<PageSwitcherButton*>(buttons_->child_at(i)); |
173 button->set_button_width(button_width); | 173 button->set_button_width(button_width); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 void PageSwitcher::ButtonPressed(views::Button* sender, | 177 void PageSwitcher::ButtonPressed(views::Button* sender, |
178 const views::Event& event) { | 178 const ui::Event& event) { |
179 for (int i = 0; i < buttons_->child_count(); ++i) { | 179 for (int i = 0; i < buttons_->child_count(); ++i) { |
180 if (sender == static_cast<views::Button*>(buttons_->child_at(i))) { | 180 if (sender == static_cast<views::Button*>(buttons_->child_at(i))) { |
181 model_->SelectPage(i, true /* animate */); | 181 model_->SelectPage(i, true /* animate */); |
182 break; | 182 break; |
183 } | 183 } |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 void PageSwitcher::TotalPagesChanged() { | 187 void PageSwitcher::TotalPagesChanged() { |
188 buttons_->RemoveAllChildViews(true); | 188 buttons_->RemoveAllChildViews(true); |
(...skipping 24 matching lines...) Expand all Loading... |
213 remaining = -remaining; | 213 remaining = -remaining; |
214 progress = -progress; | 214 progress = -progress; |
215 } | 215 } |
216 | 216 |
217 GetButtonByIndex(buttons_, current_page)->SetSelectedRange(remaining); | 217 GetButtonByIndex(buttons_, current_page)->SetSelectedRange(remaining); |
218 if (model_->is_valid_page(target_page)) | 218 if (model_->is_valid_page(target_page)) |
219 GetButtonByIndex(buttons_, target_page)->SetSelectedRange(progress); | 219 GetButtonByIndex(buttons_, target_page)->SetSelectedRange(progress); |
220 } | 220 } |
221 | 221 |
222 } // namespace app_list | 222 } // namespace app_list |
OLD | NEW |