| 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 "ash/wm/app_list_controller.h" | 5 #include "ash/wm/app_list_controller.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 void AppListController::TransitionChanged() { | 331 void AppListController::TransitionChanged() { |
| 332 // |view_| could be NULL when app list is closed with a running transition. | 332 // |view_| could be NULL when app list is closed with a running transition. |
| 333 if (!view_) | 333 if (!view_) |
| 334 return; | 334 return; |
| 335 | 335 |
| 336 const app_list::PaginationModel::Transition& transition = | 336 const app_list::PaginationModel::Transition& transition = |
| 337 pagination_model_->transition(); | 337 pagination_model_->transition(); |
| 338 if (pagination_model_->is_valid_page(transition.target_page)) | 338 if (pagination_model_->is_valid_page(transition.target_page)) |
| 339 return; | 339 return; |
| 340 | 340 |
| 341 if (pagination_model_->scrolling()) { | 341 if (!pagination_model_->IsRevertingCurrentTransition()) { |
| 342 const int current_page = pagination_model_->selected_page(); | 342 const int current_page = pagination_model_->selected_page(); |
| 343 const int dir = transition.target_page > current_page ? -1 : 1; | 343 const int dir = transition.target_page > current_page ? -1 : 1; |
| 344 | 344 |
| 345 const double progress = 1.0 - pow(1.0 - transition.progress, 4); | 345 const double progress = 1.0 - pow(1.0 - transition.progress, 4); |
| 346 const int shift = kMaxOverScrollShift * progress * dir; | 346 const int shift = kMaxOverScrollShift * progress * dir; |
| 347 | 347 |
| 348 gfx::Rect shifted(view_bounds_); | 348 gfx::Rect shifted(view_bounds_); |
| 349 shifted.set_x(shifted.x() + shift); | 349 shifted.set_x(shifted.x() + shift); |
| 350 view_->GetWidget()->SetBounds(shifted); | 350 view_->GetWidget()->SetBounds(shifted); |
| 351 should_snap_back_ = true; | 351 should_snap_back_ = true; |
| 352 } else if (should_snap_back_) { | 352 } else if (should_snap_back_) { |
| 353 should_snap_back_ = false; | 353 should_snap_back_ = false; |
| 354 ui::Layer* layer = GetLayer(view_->GetWidget()); | 354 ui::Layer* layer = GetLayer(view_->GetWidget()); |
| 355 ui::ScopedLayerAnimationSettings animation(layer->GetAnimator()); | 355 ui::ScopedLayerAnimationSettings animation(layer->GetAnimator()); |
| 356 animation.SetTransitionDuration( | 356 animation.SetTransitionDuration( |
| 357 base::TimeDelta::FromMilliseconds(kSnapBackAnimationDurationMs)); | 357 base::TimeDelta::FromMilliseconds(kSnapBackAnimationDurationMs)); |
| 358 layer->SetBounds(view_bounds_); | 358 layer->SetBounds(view_bounds_); |
| 359 } | 359 } |
| 360 } | 360 } |
| 361 | 361 |
| 362 } // namespace internal | 362 } // namespace internal |
| 363 } // namespace ash | 363 } // namespace ash |
| OLD | NEW |