| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 views::View* const search_results_page_view_; | 56 views::View* const search_results_page_view_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(SearchAnswerContainerView); | 58 DISALLOW_COPY_AND_ASSIGN(SearchAnswerContainerView); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| 62 | 62 |
| 63 ContentsView::ContentsView(AppListMainView* app_list_main_view) | 63 ContentsView::ContentsView(AppListMainView* app_list_main_view, |
| 64 AppListView* app_list_view) |
| 64 : model_(nullptr), | 65 : model_(nullptr), |
| 65 apps_container_view_(nullptr), | 66 apps_container_view_(nullptr), |
| 66 search_results_page_view_(nullptr), | 67 search_results_page_view_(nullptr), |
| 67 start_page_view_(nullptr), | 68 start_page_view_(nullptr), |
| 68 custom_page_view_(nullptr), | 69 custom_page_view_(nullptr), |
| 69 search_answer_container_view_(nullptr), | 70 search_answer_container_view_(nullptr), |
| 70 app_list_main_view_(app_list_main_view), | 71 app_list_main_view_(app_list_main_view), |
| 72 app_list_view_(app_list_view), |
| 71 page_before_search_(0) { | 73 page_before_search_(0) { |
| 72 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, | 74 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, |
| 73 kOverscrollPageTransitionDurationMs); | 75 kOverscrollPageTransitionDurationMs); |
| 74 pagination_model_.AddObserver(this); | 76 pagination_model_.AddObserver(this); |
| 75 } | 77 } |
| 76 | 78 |
| 77 ContentsView::~ContentsView() { | 79 ContentsView::~ContentsView() { |
| 78 pagination_model_.RemoveObserver(this); | 80 pagination_model_.RemoveObserver(this); |
| 79 if (model_) | 81 if (model_) |
| 80 model_->RemoveObserver(this); | 82 model_->RemoveObserver(this); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 91 // Only add the first custom page view as STATE_CUSTOM_LAUNCHER_PAGE. Ignore | 93 // Only add the first custom page view as STATE_CUSTOM_LAUNCHER_PAGE. Ignore |
| 92 // any subsequent custom pages. | 94 // any subsequent custom pages. |
| 93 if (!custom_page_views.empty()) { | 95 if (!custom_page_views.empty()) { |
| 94 custom_page_view_ = new CustomLauncherPageView(custom_page_views[0]); | 96 custom_page_view_ = new CustomLauncherPageView(custom_page_views[0]); |
| 95 | 97 |
| 96 AddLauncherPage(custom_page_view_, | 98 AddLauncherPage(custom_page_view_, |
| 97 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE); | 99 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE); |
| 98 } | 100 } |
| 99 | 101 |
| 100 // Start page. | 102 // Start page. |
| 101 start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); | 103 start_page_view_ = |
| 104 new StartPageView(app_list_main_view_, view_delegate, app_list_view_); |
| 102 AddLauncherPage(start_page_view_, AppListModel::STATE_START); | 105 AddLauncherPage(start_page_view_, AppListModel::STATE_START); |
| 103 | 106 |
| 104 // Search results UI. | 107 // Search results UI. |
| 105 search_results_page_view_ = new SearchResultPageView(); | 108 search_results_page_view_ = new SearchResultPageView(); |
| 106 | 109 |
| 107 // Search answer container UI. | 110 // Search answer container UI. |
| 108 search_answer_container_view_ = | 111 search_answer_container_view_ = |
| 109 new SearchAnswerContainerView(search_results_page_view_); | 112 new SearchAnswerContainerView(search_results_page_view_); |
| 110 search_answer_container_view_->SetVisible(false); | 113 search_answer_container_view_->SetVisible(false); |
| 111 views::View* search_answer_view = view_delegate->GetSearchAnswerWebView(); | 114 views::View* search_answer_view = view_delegate->GetSearchAnswerWebView(); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 529 |
| 527 void ContentsView::OnSearchAnswerAvailableChanged(bool has_answer) { | 530 void ContentsView::OnSearchAnswerAvailableChanged(bool has_answer) { |
| 528 if (has_answer == search_answer_container_view_->visible()) | 531 if (has_answer == search_answer_container_view_->visible()) |
| 529 return; | 532 return; |
| 530 | 533 |
| 531 search_answer_container_view_->SetVisible(has_answer); | 534 search_answer_container_view_->SetVisible(has_answer); |
| 532 search_results_page_view_->Layout(); | 535 search_results_page_view_->Layout(); |
| 533 } | 536 } |
| 534 | 537 |
| 535 } // namespace app_list | 538 } // namespace app_list |
| OLD | NEW |