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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 if (!should_snap_back_ && !widget_animator->is_animating()) | 502 if (!should_snap_back_ && !widget_animator->is_animating()) |
503 view_bounds_ = widget->GetWindowBoundsInScreen(); | 503 view_bounds_ = widget->GetWindowBoundsInScreen(); |
504 | 504 |
505 const int current_page = pagination_model->selected_page(); | 505 const int current_page = pagination_model->selected_page(); |
506 const int dir = transition.target_page > current_page ? -1 : 1; | 506 const int dir = transition.target_page > current_page ? -1 : 1; |
507 | 507 |
508 const double progress = 1.0 - pow(1.0 - transition.progress, 4); | 508 const double progress = 1.0 - pow(1.0 - transition.progress, 4); |
509 const int shift = kMaxOverScrollShift * progress * dir; | 509 const int shift = kMaxOverScrollShift * progress * dir; |
510 | 510 |
511 gfx::Rect shifted(view_bounds_); | 511 gfx::Rect shifted(view_bounds_); |
512 shifted.set_x(shifted.x() + shift); | 512 // Experimental app list scrolls vertically, so make the overscroll |
| 513 // vertical. |
| 514 if (app_list::switches::IsExperimentalAppListEnabled()) |
| 515 shifted.set_y(shifted.y() + shift); |
| 516 else |
| 517 shifted.set_x(shifted.x() + shift); |
513 widget->SetBounds(shifted); | 518 widget->SetBounds(shifted); |
514 should_snap_back_ = true; | 519 should_snap_back_ = true; |
515 } else if (should_snap_back_) { | 520 } else if (should_snap_back_) { |
516 should_snap_back_ = false; | 521 should_snap_back_ = false; |
517 ui::ScopedLayerAnimationSettings animation(widget_animator); | 522 ui::ScopedLayerAnimationSettings animation(widget_animator); |
518 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 523 animation.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
519 app_list::kOverscrollPageTransitionDurationMs)); | 524 app_list::kOverscrollPageTransitionDurationMs)); |
520 widget->SetBounds(view_bounds_); | 525 widget->SetBounds(view_bounds_); |
521 } | 526 } |
522 } | 527 } |
523 | 528 |
524 } // namespace ash | 529 } // namespace ash |
OLD | NEW |