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