Chromium Code Reviews| 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/views/contents_view.h" | 5 #include "ui/app_list/views/contents_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 double progress = 1; | 196 double progress = 1; |
| 197 if (pagination_model_.has_transition()) { | 197 if (pagination_model_.has_transition()) { |
| 198 const PaginationModel::Transition& transition = | 198 const PaginationModel::Transition& transition = |
| 199 pagination_model_.transition(); | 199 pagination_model_.transition(); |
| 200 if (pagination_model_.is_valid_page(transition.target_page)) { | 200 if (pagination_model_.is_valid_page(transition.target_page)) { |
| 201 target_page = transition.target_page; | 201 target_page = transition.target_page; |
| 202 progress = transition.progress; | 202 progress = transition.progress; |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 gfx::Rect incoming_target(rect); | 206 // A page's origin is its off-screen resting place (top). The start page's |
| 207 gfx::Rect outgoing_target(rect); | 207 // origin is above; all other pages' origins are below. |
| 208 int dir = target_page > current_page ? -1 : 1; | 208 int start_page = GetPageIndexForNamedPage(NAMED_PAGE_START); |
| 209 int page_height = rect.height(); | |
| 210 int current_page_origin = | |
| 211 current_page == start_page ? -page_height : page_height; | |
| 212 int target_page_origin = | |
| 213 target_page == start_page ? -page_height : page_height; | |
| 209 | 214 |
| 210 // Pages transition vertically. | 215 // Move |current_page| from 0 to its origin. Move |target_page| from its |
| 211 int page_height = rect.height(); | 216 // origin to 0. |
| 212 int transition_offset = progress * page_height * dir; | 217 gfx::Rect current_page_rect(rect); |
| 218 gfx::Rect target_page_rect(rect); | |
| 219 current_page_rect.set_y(progress * current_page_origin); | |
| 220 target_page_rect.set_y((1 - progress) * target_page_origin); | |
| 213 | 221 |
| 214 outgoing_target.set_y(transition_offset); | 222 view_model_->view_at(current_page)->SetBoundsRect(current_page_rect); |
| 215 incoming_target.set_y(dir < 0 ? transition_offset + page_height | 223 view_model_->view_at(target_page)->SetBoundsRect(target_page_rect); |
|
calamity
2014/09/09 09:13:21
I think you need to do an IsExperimentalAppListEna
Matt Giuca
2014/09/10 01:45:36
Done.
Whoops.
| |
| 216 : transition_offset - page_height); | |
| 217 | |
| 218 view_model_->view_at(current_page)->SetBoundsRect(outgoing_target); | |
| 219 view_model_->view_at(target_page)->SetBoundsRect(incoming_target); | |
| 220 } | 224 } |
| 221 | 225 |
| 222 PaginationModel* ContentsView::GetAppsPaginationModel() { | 226 PaginationModel* ContentsView::GetAppsPaginationModel() { |
| 223 return apps_container_view_->apps_grid_view()->pagination_model(); | 227 return apps_container_view_->apps_grid_view()->pagination_model(); |
| 224 } | 228 } |
| 225 | 229 |
| 226 void ContentsView::ShowFolderContent(AppListFolderItem* item) { | 230 void ContentsView::ShowFolderContent(AppListFolderItem* item) { |
| 227 apps_container_view_->ShowActiveFolder(item); | 231 apps_container_view_->ShowActiveFolder(item); |
| 228 } | 232 } |
| 229 | 233 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 } | 304 } |
| 301 | 305 |
| 302 void ContentsView::TransitionStarted() { | 306 void ContentsView::TransitionStarted() { |
| 303 } | 307 } |
| 304 | 308 |
| 305 void ContentsView::TransitionChanged() { | 309 void ContentsView::TransitionChanged() { |
| 306 UpdatePageBounds(); | 310 UpdatePageBounds(); |
| 307 } | 311 } |
| 308 | 312 |
| 309 } // namespace app_list | 313 } // namespace app_list |
| OLD | NEW |