Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: ash/wm/app_list_controller.cc

Issue 491973004: Make apps grid view scroll vertically in experimental app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@calamity-ares-vertical-scroll
Patch Set: Rename width to size. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/app_list/views/apps_grid_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/views/apps_grid_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698