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 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/app_list/app_list_constants.h" | 10 #include "ui/app_list/app_list_constants.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 model->view_at(kIndexSearchResults)); | 46 model->view_at(kIndexSearchResults)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 StartPageView* GetStartPageView(views::ViewModel* model) { | 49 StartPageView* GetStartPageView(views::ViewModel* model) { |
| 50 return static_cast<StartPageView*>(model->view_at(kIndexStartPage)); | 50 return static_cast<StartPageView*>(model->view_at(kIndexStartPage)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace | 53 } // namespace |
| 54 | 54 |
| 55 ContentsView::ContentsView(AppListMainView* app_list_main_view, | 55 ContentsView::ContentsView(AppListMainView* app_list_main_view, |
| 56 PaginationModel* pagination_model, | |
| 57 AppListModel* model, | 56 AppListModel* model, |
| 58 AppListViewDelegate* view_delegate) | 57 AppListViewDelegate* view_delegate) |
| 59 : show_state_(SHOW_APPS), | 58 : show_state_(SHOW_APPS), |
| 60 pagination_model_(pagination_model), | 59 pagination_model_(NULL), |
| 61 start_page_view_(NULL), | 60 start_page_view_(NULL), |
| 62 app_list_main_view_(app_list_main_view), | 61 app_list_main_view_(app_list_main_view), |
| 63 view_model_(new views::ViewModel), | 62 view_model_(new views::ViewModel), |
| 64 bounds_animator_(new views::BoundsAnimator(this)) { | 63 bounds_animator_(new views::BoundsAnimator(this)) { |
| 65 DCHECK(model); | 64 DCHECK(model); |
| 66 pagination_model_->SetTransitionDurations( | |
| 67 kPageTransitionDurationInMs, | |
| 68 kOverscrollPageTransitionDurationMs); | |
| 69 | 65 |
| 70 apps_container_view_ = | 66 apps_container_view_ = new AppsContainerView(app_list_main_view, model); |
| 71 new AppsContainerView(app_list_main_view, pagination_model, model); | |
| 72 AddChildView(apps_container_view_); | 67 AddChildView(apps_container_view_); |
| 73 view_model_->Add(apps_container_view_, kIndexAppsContainer); | 68 view_model_->Add(apps_container_view_, kIndexAppsContainer); |
| 74 | 69 |
| 70 pagination_model_ = | |
| 71 apps_container_view_->apps_grid_view()->GetPaginationModel(); | |
| 72 pagination_model_->SetTransitionDurations( | |
|
tapted
2014/06/02 04:02:21
This would be nicer in AppsGridView IMO (or even e
Matt Giuca
2014/06/02 07:11:23
Done.
| |
| 73 kPageTransitionDurationInMs, kOverscrollPageTransitionDurationMs); | |
| 74 | |
| 75 SearchResultListView* search_results_view = new SearchResultListView( | 75 SearchResultListView* search_results_view = new SearchResultListView( |
| 76 app_list_main_view, view_delegate); | 76 app_list_main_view, view_delegate); |
| 77 AddChildView(search_results_view); | 77 AddChildView(search_results_view); |
| 78 view_model_->Add(search_results_view, kIndexSearchResults); | 78 view_model_->Add(search_results_view, kIndexSearchResults); |
| 79 | 79 |
| 80 if (app_list::switches::IsExperimentalAppListEnabled()) { | 80 if (app_list::switches::IsExperimentalAppListEnabled()) { |
| 81 start_page_view_ = new StartPageView(app_list_main_view, view_delegate); | 81 start_page_view_ = new StartPageView(app_list_main_view, view_delegate); |
| 82 AddChildView(start_page_view_); | 82 AddChildView(start_page_view_); |
| 83 view_model_->Add(start_page_view_, kIndexStartPage); | 83 view_model_->Add(start_page_view_, kIndexStartPage); |
| 84 } | 84 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 if (!pagination_model_->has_transition()) { | 310 if (!pagination_model_->has_transition()) { |
| 311 pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1, | 311 pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1, |
| 312 true); | 312 true); |
| 313 } | 313 } |
| 314 event->SetHandled(); | 314 event->SetHandled(); |
| 315 event->StopPropagation(); | 315 event->StopPropagation(); |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 | 318 |
| 319 } // namespace app_list | 319 } // namespace app_list |
| OLD | NEW |