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 "ui/app_list/app_list_constants.h" | 9 #include "ui/app_list/app_list_constants.h" |
| 10 #include "ui/app_list/pagination_model.h" | 10 #include "ui/app_list/pagination_model.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 PaginationModel* pagination_model) | 48 PaginationModel* pagination_model) |
| 49 : show_state_(SHOW_APPS), | 49 : show_state_(SHOW_APPS), |
| 50 pagination_model_(pagination_model), | 50 pagination_model_(pagination_model), |
| 51 view_model_(new views::ViewModel), | 51 view_model_(new views::ViewModel), |
| 52 ALLOW_THIS_IN_INITIALIZER_LIST( | 52 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 53 bounds_animator_(new views::BoundsAnimator(this))) { | 53 bounds_animator_(new views::BoundsAnimator(this))) { |
| 54 pagination_model_->SetTransitionDurations( | 54 pagination_model_->SetTransitionDurations( |
| 55 kPageTransitionDurationInMs, | 55 kPageTransitionDurationInMs, |
| 56 kOverscrollPageTransitionDurationMs); | 56 kOverscrollPageTransitionDurationMs); |
| 57 | 57 |
| 58 AppsGridView* apps_grid_view = new AppsGridView(app_list_main_view, | 58 apps_grid_view_ = new AppsGridView(app_list_main_view, |
| 59 pagination_model); | 59 pagination_model); |
|
James Cook
2013/04/29 22:08:29
indentation
Mr4D (OOO till 08-26)
2013/04/30 16:59:01
Done.
| |
| 60 apps_grid_view->SetLayout(kPreferredIconDimension, | 60 apps_grid_view_->SetLayout(kPreferredIconDimension, |
| 61 kPreferredCols, | 61 kPreferredCols, |
| 62 kPreferredRows); | 62 kPreferredRows); |
| 63 AddChildView(apps_grid_view); | 63 AddChildView(apps_grid_view_); |
| 64 view_model_->Add(apps_grid_view, kIndexAppsGrid); | 64 view_model_->Add(apps_grid_view_, kIndexAppsGrid); |
| 65 | 65 |
| 66 SearchResultListView* search_results_view = new SearchResultListView( | 66 SearchResultListView* search_results_view = new SearchResultListView( |
| 67 app_list_main_view); | 67 app_list_main_view); |
| 68 AddChildView(search_results_view); | 68 AddChildView(search_results_view); |
| 69 view_model_->Add(search_results_view, kIndexSearchResults); | 69 view_model_->Add(search_results_view, kIndexSearchResults); |
| 70 } | 70 } |
| 71 | 71 |
| 72 ContentsView::~ContentsView() { | 72 ContentsView::~ContentsView() { |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ContentsView::SetModel(AppListModel* model) { | 75 void ContentsView::SetModel(AppListModel* model) { |
| 76 if (model) { | 76 if (model) { |
| 77 GetAppsGridView(view_model_.get())->SetModel(model); | 77 GetAppsGridView(view_model_.get())->SetModel(model); |
| 78 GetSearchResultListView(view_model_.get())->SetResults(model->results()); | 78 GetSearchResultListView(view_model_.get())->SetResults(model->results()); |
| 79 } else { | 79 } else { |
| 80 GetAppsGridView(view_model_.get())->SetModel(NULL); | 80 GetAppsGridView(view_model_.get())->SetModel(NULL); |
| 81 GetSearchResultListView(view_model_.get())->SetResults(NULL); | 81 GetSearchResultListView(view_model_.get())->SetResults(NULL); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ContentsView::SetAppListDnDHost(app_list::ApplicationDnDHost* dnd_host) { | |
| 86 apps_grid_view_->SetAppListDnDHost(dnd_host); | |
| 87 } | |
| 88 | |
| 85 void ContentsView::SetShowState(ShowState show_state) { | 89 void ContentsView::SetShowState(ShowState show_state) { |
| 86 if (show_state_ == show_state) | 90 if (show_state_ == show_state) |
| 87 return; | 91 return; |
| 88 | 92 |
| 89 show_state_ = show_state; | 93 show_state_ = show_state; |
| 90 ShowStateChanged(); | 94 ShowStateChanged(); |
| 91 } | 95 } |
| 92 | 96 |
| 93 void ContentsView::ShowStateChanged() { | 97 void ContentsView::ShowStateChanged() { |
| 94 if (show_state_ == SHOW_SEARCH_RESULTS) { | 98 if (show_state_ == SHOW_SEARCH_RESULTS) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 237 |
| 234 if (!pagination_model_->has_transition()) { | 238 if (!pagination_model_->has_transition()) { |
| 235 pagination_model_->SelectPageRelative(event->x_offset() > 0 ? -1 : 1, | 239 pagination_model_->SelectPageRelative(event->x_offset() > 0 ? -1 : 1, |
| 236 true); | 240 true); |
| 237 } | 241 } |
| 238 event->SetHandled(); | 242 event->SetHandled(); |
| 239 event->StopPropagation(); | 243 event->StopPropagation(); |
| 240 } | 244 } |
| 241 | 245 |
| 242 } // namespace app_list | 246 } // namespace app_list |
| OLD | NEW |