| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 ContentsView::ContentsView(AppListMainView* app_list_main_view, | 32 ContentsView::ContentsView(AppListMainView* app_list_main_view, |
| 33 AppListView* app_list_view) | 33 AppListView* app_list_view) |
| 34 : model_(nullptr), | 34 : model_(nullptr), |
| 35 apps_container_view_(nullptr), | 35 apps_container_view_(nullptr), |
| 36 search_results_page_view_(nullptr), | 36 search_results_page_view_(nullptr), |
| 37 start_page_view_(nullptr), | 37 start_page_view_(nullptr), |
| 38 custom_page_view_(nullptr), | 38 custom_page_view_(nullptr), |
| 39 app_list_main_view_(app_list_main_view), | 39 app_list_main_view_(app_list_main_view), |
| 40 app_list_view_(app_list_view), | 40 app_list_view_(app_list_view), |
| 41 page_before_search_(0) { | 41 page_before_search_(0), |
| 42 is_fullscreen_app_list_enabled_(features::IsFullscreenAppListEnabled()) { |
| 42 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, | 43 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, |
| 43 kOverscrollPageTransitionDurationMs); | 44 kOverscrollPageTransitionDurationMs); |
| 44 pagination_model_.AddObserver(this); | 45 pagination_model_.AddObserver(this); |
| 45 } | 46 } |
| 46 | 47 |
| 47 ContentsView::~ContentsView() { | 48 ContentsView::~ContentsView() { |
| 48 pagination_model_.RemoveObserver(this); | 49 pagination_model_.RemoveObserver(this); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void ContentsView::Init(AppListModel* model) { | 52 void ContentsView::Init(AppListModel* model) { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (it != view_to_state_.end()) | 204 if (it != view_to_state_.end()) |
| 204 state = it->second; | 205 state = it->second; |
| 205 | 206 |
| 206 app_list_pages_[GetActivePageIndex()]->OnWillBeShown(); | 207 app_list_pages_[GetActivePageIndex()]->OnWillBeShown(); |
| 207 | 208 |
| 208 app_list_main_view_->model()->SetState(state); | 209 app_list_main_view_->model()->SetState(state); |
| 209 | 210 |
| 210 DCHECK(start_page_view_); | 211 DCHECK(start_page_view_); |
| 211 | 212 |
| 212 // Set the visibility of the search box's back button. | 213 // Set the visibility of the search box's back button. |
| 213 if (!features::IsFullscreenAppListEnabled()) { | 214 const bool folder_active = state == AppListModel::STATE_APPS && |
| 215 apps_container_view_->IsInFolderView(); |
| 216 |
| 217 if (!is_fullscreen_app_list_enabled_) { |
| 214 app_list_main_view_->search_box_view()->back_button()->SetVisible( | 218 app_list_main_view_->search_box_view()->back_button()->SetVisible( |
| 215 state != AppListModel::STATE_START); | 219 state != AppListModel::STATE_START); |
| 216 app_list_main_view_->search_box_view()->Layout(); | 220 app_list_main_view_->search_box_view()->Layout(); |
| 217 bool folder_active = (state == AppListModel::STATE_APPS) | |
| 218 ? apps_container_view_->IsInFolderView() | |
| 219 : false; | |
| 220 app_list_main_view_->search_box_view()->SetBackButtonLabel(folder_active); | 221 app_list_main_view_->search_box_view()->SetBackButtonLabel(folder_active); |
| 221 } | 222 } |
| 222 | 223 |
| 223 // Whenever the page changes, the custom launcher page is considered to have | 224 // Whenever the page changes, the custom launcher page is considered to have |
| 224 // been reset. | 225 // been reset. |
| 225 app_list_main_view_->model()->ClearCustomLauncherPageSubpages(); | 226 app_list_main_view_->model()->ClearCustomLauncherPageSubpages(); |
| 226 app_list_main_view_->search_box_view()->ResetTabFocus(false); | 227 app_list_main_view_->search_box_view()->ResetTabFocus(false); |
| 227 } | 228 } |
| 228 | 229 |
| 229 void ContentsView::ShowSearchResults(bool show) { | 230 void ContentsView::ShowSearchResults(bool show) { |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 } | 486 } |
| 486 | 487 |
| 487 void ContentsView::TransitionStarted() { | 488 void ContentsView::TransitionStarted() { |
| 488 } | 489 } |
| 489 | 490 |
| 490 void ContentsView::TransitionChanged() { | 491 void ContentsView::TransitionChanged() { |
| 491 UpdatePageBounds(); | 492 UpdatePageBounds(); |
| 492 } | 493 } |
| 493 | 494 |
| 494 } // namespace app_list | 495 } // namespace app_list |
| OLD | NEW |