| 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 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ui/app_list/views/search_result_list_view.h" | 22 #include "ui/app_list/views/search_result_list_view.h" |
| 23 #include "ui/app_list/views/search_result_page_view.h" | 23 #include "ui/app_list/views/search_result_page_view.h" |
| 24 #include "ui/app_list/views/search_result_tile_item_list_view.h" | 24 #include "ui/app_list/views/search_result_tile_item_list_view.h" |
| 25 #include "ui/app_list/views/start_page_view.h" | 25 #include "ui/app_list/views/start_page_view.h" |
| 26 #include "ui/events/event.h" | 26 #include "ui/events/event.h" |
| 27 #include "ui/views/view_model.h" | 27 #include "ui/views/view_model.h" |
| 28 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 29 | 29 |
| 30 namespace app_list { | 30 namespace app_list { |
| 31 | 31 |
| 32 ContentsView::ContentsView(AppListMainView* app_list_main_view) | 32 ContentsView::ContentsView(AppListMainView* app_list_main_view, |
| 33 AppListView* app_list_view) |
| 33 : model_(nullptr), | 34 : model_(nullptr), |
| 34 apps_container_view_(nullptr), | 35 apps_container_view_(nullptr), |
| 35 search_results_page_view_(nullptr), | 36 search_results_page_view_(nullptr), |
| 36 start_page_view_(nullptr), | 37 start_page_view_(nullptr), |
| 37 custom_page_view_(nullptr), | 38 custom_page_view_(nullptr), |
| 38 app_list_main_view_(app_list_main_view), | 39 app_list_main_view_(app_list_main_view), |
| 40 app_list_view_(app_list_view), |
| 39 page_before_search_(0) { | 41 page_before_search_(0) { |
| 40 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, | 42 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, |
| 41 kOverscrollPageTransitionDurationMs); | 43 kOverscrollPageTransitionDurationMs); |
| 42 pagination_model_.AddObserver(this); | 44 pagination_model_.AddObserver(this); |
| 43 } | 45 } |
| 44 | 46 |
| 45 ContentsView::~ContentsView() { | 47 ContentsView::~ContentsView() { |
| 46 pagination_model_.RemoveObserver(this); | 48 pagination_model_.RemoveObserver(this); |
| 47 } | 49 } |
| 48 | 50 |
| 49 void ContentsView::Init(AppListModel* model) { | 51 void ContentsView::Init(AppListModel* model) { |
| 50 DCHECK(model); | 52 DCHECK(model); |
| 51 model_ = model; | 53 model_ = model; |
| 52 | 54 |
| 53 AppListViewDelegate* view_delegate = app_list_main_view_->view_delegate(); | 55 AppListViewDelegate* view_delegate = app_list_main_view_->view_delegate(); |
| 54 | 56 |
| 55 std::vector<views::View*> custom_page_views = | 57 std::vector<views::View*> custom_page_views = |
| 56 view_delegate->CreateCustomPageWebViews(GetLocalBounds().size()); | 58 view_delegate->CreateCustomPageWebViews(GetLocalBounds().size()); |
| 57 // Only add the first custom page view as STATE_CUSTOM_LAUNCHER_PAGE. Ignore | 59 // Only add the first custom page view as STATE_CUSTOM_LAUNCHER_PAGE. Ignore |
| 58 // any subsequent custom pages. | 60 // any subsequent custom pages. |
| 59 if (!custom_page_views.empty()) { | 61 if (!custom_page_views.empty()) { |
| 60 custom_page_view_ = new CustomLauncherPageView(custom_page_views[0]); | 62 custom_page_view_ = new CustomLauncherPageView(custom_page_views[0]); |
| 61 | 63 |
| 62 AddLauncherPage(custom_page_view_, | 64 AddLauncherPage(custom_page_view_, |
| 63 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE); | 65 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE); |
| 64 } | 66 } |
| 65 | 67 |
| 66 // Start page. | 68 // Start page. |
| 67 start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); | 69 start_page_view_ = |
| 70 new StartPageView(app_list_main_view_, view_delegate, app_list_view_); |
| 68 AddLauncherPage(start_page_view_, AppListModel::STATE_START); | 71 AddLauncherPage(start_page_view_, AppListModel::STATE_START); |
| 69 | 72 |
| 70 // Search results UI. | 73 // Search results UI. |
| 71 search_results_page_view_ = new SearchResultPageView(); | 74 search_results_page_view_ = new SearchResultPageView(); |
| 72 | 75 |
| 73 // Search result containers. | 76 // Search result containers. |
| 74 AppListModel::SearchResults* results = view_delegate->GetModel()->results(); | 77 AppListModel::SearchResults* results = view_delegate->GetModel()->results(); |
| 75 | 78 |
| 76 if (features::IsAnswerCardEnabled()) { | 79 if (features::IsAnswerCardEnabled()) { |
| 77 search_results_page_view_->AddSearchResultContainerView( | 80 search_results_page_view_->AddSearchResultContainerView( |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 } | 483 } |
| 481 | 484 |
| 482 void ContentsView::TransitionStarted() { | 485 void ContentsView::TransitionStarted() { |
| 483 } | 486 } |
| 484 | 487 |
| 485 void ContentsView::TransitionChanged() { | 488 void ContentsView::TransitionChanged() { |
| 486 UpdatePageBounds(); | 489 UpdatePageBounds(); |
| 487 } | 490 } |
| 488 | 491 |
| 489 } // namespace app_list | 492 } // namespace app_list |
| OLD | NEW |