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

Side by Side Diff: ui/app_list/contents_view.cc

Issue 11275320: app_list: Make over scroll animation faster. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/apps_grid_view_unittest.cc ('k') | ui/app_list/pagination_model.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 "ui/app_list/contents_view.h" 5 #include "ui/app_list/contents_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/app_list/app_list_constants.h"
9 #include "ui/app_list/app_list_view.h" 10 #include "ui/app_list/app_list_view.h"
10 #include "ui/app_list/apps_grid_view.h" 11 #include "ui/app_list/apps_grid_view.h"
11 #include "ui/app_list/pagination_model.h" 12 #include "ui/app_list/pagination_model.h"
12 #include "ui/app_list/search_result_list_view.h" 13 #include "ui/app_list/search_result_list_view.h"
13 #include "ui/base/events/event.h" 14 #include "ui/base/events/event.h"
14 #include "ui/views/animation/bounds_animator.h" 15 #include "ui/views/animation/bounds_animator.h"
15 #include "ui/views/view_model.h" 16 #include "ui/views/view_model.h"
16 #include "ui/views/view_model_utils.h" 17 #include "ui/views/view_model_utils.h"
17 18
18 namespace app_list { 19 namespace app_list {
19 20
20 namespace { 21 namespace {
21 22
22 const int kPreferredIconDimension = 48; 23 const int kPreferredIconDimension = 48;
23 const int kPreferredCols = 4; 24 const int kPreferredCols = 4;
24 const int kPreferredRows = 4; 25 const int kPreferredRows = 4;
25 26
26 // Indexes of interesting views in ViewModel of ContentsView. 27 // Indexes of interesting views in ViewModel of ContentsView.
27 const int kIndexAppsGrid = 0; 28 const int kIndexAppsGrid = 0;
28 const int kIndexSearchResults = 1; 29 const int kIndexSearchResults = 1;
29 30
30 const int kMinMouseWheelToSwitchPage = 20; 31 const int kMinMouseWheelToSwitchPage = 20;
31 const int kMinScrollToSwitchPage = 20; 32 const int kMinScrollToSwitchPage = 20;
32 const int kMinHorizVelocityToSwitchPage = 800; 33 const int kMinHorizVelocityToSwitchPage = 800;
33 34
34 const double kFinishTransitionThreshold = 0.33; 35 const double kFinishTransitionThreshold = 0.33;
35 const int kTransitionAnimationDurationInMs = 180;
36 36
37 // Helpers to get certain child view from |model|. 37 // Helpers to get certain child view from |model|.
38 AppsGridView* GetAppsGridView(views::ViewModel* model) { 38 AppsGridView* GetAppsGridView(views::ViewModel* model) {
39 return static_cast<AppsGridView*>(model->view_at(kIndexAppsGrid)); 39 return static_cast<AppsGridView*>(model->view_at(kIndexAppsGrid));
40 } 40 }
41 41
42 SearchResultListView* GetSearchResultListView(views::ViewModel* model) { 42 SearchResultListView* GetSearchResultListView(views::ViewModel* model) {
43 return static_cast<SearchResultListView*>( 43 return static_cast<SearchResultListView*>(
44 model->view_at(kIndexSearchResults)); 44 model->view_at(kIndexSearchResults));
45 } 45 }
46 46
47 } // namespace 47 } // namespace
48 48
49 ContentsView::ContentsView(AppListView* app_list_view, 49 ContentsView::ContentsView(AppListView* app_list_view,
50 PaginationModel* pagination_model) 50 PaginationModel* pagination_model)
51 : show_state_(SHOW_APPS), 51 : show_state_(SHOW_APPS),
52 pagination_model_(pagination_model), 52 pagination_model_(pagination_model),
53 view_model_(new views::ViewModel), 53 view_model_(new views::ViewModel),
54 ALLOW_THIS_IN_INITIALIZER_LIST( 54 ALLOW_THIS_IN_INITIALIZER_LIST(
55 bounds_animator_(new views::BoundsAnimator(this))) { 55 bounds_animator_(new views::BoundsAnimator(this))) {
56 pagination_model_->SetTransitionDuration(kTransitionAnimationDurationInMs); 56 pagination_model_->SetTransitionDurations(
57 kPageTransitionDurationInMs,
58 kOverscrollPageTransitionDurationMs);
57 59
58 AppsGridView* apps_grid_view = new AppsGridView(app_list_view, 60 AppsGridView* apps_grid_view = new AppsGridView(app_list_view,
59 pagination_model); 61 pagination_model);
60 apps_grid_view->SetLayout(kPreferredIconDimension, 62 apps_grid_view->SetLayout(kPreferredIconDimension,
61 kPreferredCols, 63 kPreferredCols,
62 kPreferredRows); 64 kPreferredRows);
63 AddChildView(apps_grid_view); 65 AddChildView(apps_grid_view);
64 view_model_->Add(apps_grid_view, kIndexAppsGrid); 66 view_model_->Add(apps_grid_view, kIndexAppsGrid);
65 67
66 SearchResultListView* search_results_view = new SearchResultListView( 68 SearchResultListView* search_results_view = new SearchResultListView(
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 pagination_model_->SelectPageRelative(event->x_offset() > 0 ? -1 : 1, 228 pagination_model_->SelectPageRelative(event->x_offset() > 0 ? -1 : 1,
227 true); 229 true);
228 } 230 }
229 return ui::ER_HANDLED; 231 return ui::ER_HANDLED;
230 } 232 }
231 233
232 return ui::ER_UNHANDLED; 234 return ui::ER_UNHANDLED;
233 } 235 }
234 236
235 } // namespace app_list 237 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/apps_grid_view_unittest.cc ('k') | ui/app_list/pagination_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698