| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 PageSwitcherButton* GetButtonByIndex(views::View* buttons, int index) { | 116 PageSwitcherButton* GetButtonByIndex(views::View* buttons, int index) { |
| 117 return static_cast<PageSwitcherButton*>(buttons->child_at(index)); | 117 return static_cast<PageSwitcherButton*>(buttons->child_at(index)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace | 120 } // namespace |
| 121 | 121 |
| 122 namespace app_list { | 122 namespace app_list { |
| 123 | 123 |
| 124 PageSwitcher::PageSwitcher(PaginationModel* model) | 124 PageSwitcher::PageSwitcher(PaginationModel* model) |
| 125 : model_(model), | 125 : model_(model), |
| 126 buttons_(NULL) { | 126 buttons_(new views::View) { |
| 127 buttons_ = new views::View; | |
| 128 buttons_->SetLayoutManager(new views::BoxLayout( | 127 buttons_->SetLayoutManager(new views::BoxLayout( |
| 129 views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing)); | 128 views::BoxLayout::kHorizontal, 0, 0, kButtonSpacing)); |
| 130 AddChildView(buttons_); | 129 AddChildView(buttons_); |
| 131 | 130 |
| 132 TotalPagesChanged(); | 131 TotalPagesChanged(); |
| 133 SelectedPageChanged(-1, model->selected_page()); | 132 SelectedPageChanged(-1, model->selected_page()); |
| 134 model_->AddObserver(this); | 133 model_->AddObserver(this); |
| 135 } | 134 } |
| 136 | 135 |
| 137 PageSwitcher::~PageSwitcher() { | 136 PageSwitcher::~PageSwitcher() { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 remaining = -remaining; | 213 remaining = -remaining; |
| 215 progress = -progress; | 214 progress = -progress; |
| 216 } | 215 } |
| 217 | 216 |
| 218 GetButtonByIndex(buttons_, current_page)->SetSelectedRange(remaining); | 217 GetButtonByIndex(buttons_, current_page)->SetSelectedRange(remaining); |
| 219 if (model_->is_valid_page(target_page)) | 218 if (model_->is_valid_page(target_page)) |
| 220 GetButtonByIndex(buttons_, target_page)->SetSelectedRange(progress); | 219 GetButtonByIndex(buttons_, target_page)->SetSelectedRange(progress); |
| 221 } | 220 } |
| 222 | 221 |
| 223 } // namespace app_list | 222 } // namespace app_list |
| OLD | NEW |