| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list_main_view.h" | 5 #include "ui/app_list/views/app_list_main_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 if (icon_loading_wait_timer_.IsRunning()) | 137 if (icon_loading_wait_timer_.IsRunning()) |
| 138 return; | 138 return; |
| 139 | 139 |
| 140 icon_loading_wait_timer_.Start( | 140 icon_loading_wait_timer_.Start( |
| 141 FROM_HERE, | 141 FROM_HERE, |
| 142 base::TimeDelta::FromMilliseconds(kMaxIconLoadingWaitTimeInMs), | 142 base::TimeDelta::FromMilliseconds(kMaxIconLoadingWaitTimeInMs), |
| 143 this, &AppListMainView::OnIconLoadingWaitTimer); | 143 this, &AppListMainView::OnIconLoadingWaitTimer); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void AppListMainView::ResetForShow() { | 146 void AppListMainView::ResetForShow() { |
| 147 if (switches::IsExperimentalAppListEnabled()) { | 147 if (switches::IsExperimentalAppListEnabled()) |
| 148 contents_view_->SetActivePage( | 148 contents_view_->SetActivePage(AppListModel::STATE_START); |
| 149 contents_view_->GetPageIndexForState(AppListModel::STATE_START)); | 149 |
| 150 } | |
| 151 contents_view_->apps_container_view()->ResetForShowApps(); | 150 contents_view_->apps_container_view()->ResetForShowApps(); |
| 152 // We clear the search when hiding so when app list appears it is not showing | 151 // We clear the search when hiding so when app list appears it is not showing |
| 153 // search results. | 152 // search results. |
| 154 search_box_view_->ClearSearch(); | 153 search_box_view_->ClearSearch(); |
| 155 } | 154 } |
| 156 | 155 |
| 157 void AppListMainView::Close() { | 156 void AppListMainView::Close() { |
| 158 icon_loading_wait_timer_.Stop(); | 157 icon_loading_wait_timer_.Stop(); |
| 159 contents_view_->CancelDrag(); | 158 contents_view_->CancelDrag(); |
| 160 } | 159 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 250 } |
| 252 | 251 |
| 253 void AppListMainView::UpdateCustomLauncherPageVisibility() { | 252 void AppListMainView::UpdateCustomLauncherPageVisibility() { |
| 254 if (ShouldShowCustomLauncherPage()) { | 253 if (ShouldShowCustomLauncherPage()) { |
| 255 // Make the custom page view visible again. | 254 // Make the custom page view visible again. |
| 256 contents_view_->custom_page_view()->SetVisible(true); | 255 contents_view_->custom_page_view()->SetVisible(true); |
| 257 } else if (contents_view_->IsStateActive( | 256 } else if (contents_view_->IsStateActive( |
| 258 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) { | 257 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) { |
| 259 // Animate to the start page if currently on the custom page view. The view | 258 // Animate to the start page if currently on the custom page view. The view |
| 260 // will hide on animation completion. | 259 // will hide on animation completion. |
| 261 contents_view_->SetActivePage( | 260 contents_view_->SetActivePage(AppListModel::STATE_START); |
| 262 contents_view_->GetPageIndexForState(AppListModel::STATE_START)); | |
| 263 } else { | 261 } else { |
| 264 // Hide the view immediately otherwise. | 262 // Hide the view immediately otherwise. |
| 265 contents_view_->custom_page_view()->SetVisible(false); | 263 contents_view_->custom_page_view()->SetVisible(false); |
| 266 } | 264 } |
| 267 } | 265 } |
| 268 | 266 |
| 269 void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) { | 267 void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) { |
| 270 if (enabled) { | 268 if (enabled) { |
| 271 // Make the custom page view visible again. | 269 // Make the custom page view visible again. |
| 272 contents_view_->custom_page_view()->SetVisible(true); | 270 contents_view_->custom_page_view()->SetVisible(true); |
| 273 } else if (contents_view_->IsStateActive( | 271 } else if (contents_view_->IsStateActive( |
| 274 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) { | 272 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) { |
| 275 // Animate to the start page if currently on the custom page view. The view | 273 // Animate to the start page if currently on the custom page view. The view |
| 276 // will hide on animation completion. | 274 // will hide on animation completion. |
| 277 contents_view_->SetActivePage( | 275 contents_view_->SetActivePage(AppListModel::STATE_START); |
| 278 contents_view_->GetPageIndexForState(AppListModel::STATE_START)); | |
| 279 } else { | 276 } else { |
| 280 // Hide the view immediately otherwise. | 277 // Hide the view immediately otherwise. |
| 281 contents_view_->custom_page_view()->SetVisible(false); | 278 contents_view_->custom_page_view()->SetVisible(false); |
| 282 } | 279 } |
| 283 } | 280 } |
| 284 | 281 |
| 285 void AppListMainView::OnSearchEngineIsGoogleChanged(bool is_google) { | 282 void AppListMainView::OnSearchEngineIsGoogleChanged(bool is_google) { |
| 286 if (contents_view_->custom_page_view()) | 283 if (contents_view_->custom_page_view()) |
| 287 OnCustomLauncherPageEnabledStateChanged(is_google); | 284 OnCustomLauncherPageEnabledStateChanged(is_google); |
| 288 | 285 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 contents_view_->search_results_page_view()->SetSelection(select); | 328 contents_view_->search_results_page_view()->SetSelection(select); |
| 332 } | 329 } |
| 333 | 330 |
| 334 void AppListMainView::OnResultInstalled(SearchResult* result) { | 331 void AppListMainView::OnResultInstalled(SearchResult* result) { |
| 335 // Clears the search to show the apps grid. The last installed app | 332 // Clears the search to show the apps grid. The last installed app |
| 336 // should be highlighted and made visible already. | 333 // should be highlighted and made visible already. |
| 337 search_box_view_->ClearSearch(); | 334 search_box_view_->ClearSearch(); |
| 338 } | 335 } |
| 339 | 336 |
| 340 } // namespace app_list | 337 } // namespace app_list |
| OLD | NEW |