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