| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // Animate to the start page if currently on the custom page view. The view | 259 // Animate to the start page if currently on the custom page view. The view |
| 260 // will hide on animation completion. | 260 // will hide on animation completion. |
| 261 contents_view_->SetActivePage( | 261 contents_view_->SetActivePage( |
| 262 contents_view_->GetPageIndexForState(AppListModel::STATE_START)); | 262 contents_view_->GetPageIndexForState(AppListModel::STATE_START)); |
| 263 } else { | 263 } else { |
| 264 // Hide the view immediately otherwise. | 264 // Hide the view immediately otherwise. |
| 265 contents_view_->custom_page_view()->SetVisible(false); | 265 contents_view_->custom_page_view()->SetVisible(false); |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 // If |folder_id| is open, this will remove AppItemList from the folder's |
| 270 // AppsGridView before the folder is deleted. |
| 271 void AppListMainView::OnSingleItemFolderWillBeDeleted( |
| 272 const std::string& folder_id) { |
| 273 AppListFolderView* folder_view = |
| 274 contents_view_->apps_container_view()->app_list_folder_view(); |
| 275 AppListFolderItem* open_folder_item = folder_view->folder_item(); |
| 276 |
| 277 if (open_folder_item && open_folder_item->id() == folder_id && |
| 278 contents_view_->apps_container_view()->IsInFolderView()) { |
| 279 AppsGridView* folder_grid_view = folder_view->items_grid_view(); |
| 280 if (folder_grid_view) |
| 281 folder_grid_view->SetItemList(nullptr); // removes observer |
| 282 } |
| 283 } |
| 284 |
| 269 void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) { | 285 void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) { |
| 270 views::View* custom_page = contents_view_->custom_page_view(); | 286 views::View* custom_page = contents_view_->custom_page_view(); |
| 271 if (!custom_page) | 287 if (!custom_page) |
| 272 return; | 288 return; |
| 273 | 289 |
| 274 if (ShouldShowCustomLauncherPage()) { | 290 if (ShouldShowCustomLauncherPage()) { |
| 275 // Make the custom page view visible again. | 291 // Make the custom page view visible again. |
| 276 custom_page->SetVisible(true); | 292 custom_page->SetVisible(true); |
| 277 } else if (contents_view_->IsStateActive( | 293 } else if (contents_view_->IsStateActive( |
| 278 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) { | 294 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 contents_view_->search_results_page_view()->SetSelection(select); | 351 contents_view_->search_results_page_view()->SetSelection(select); |
| 336 } | 352 } |
| 337 | 353 |
| 338 void AppListMainView::OnResultInstalled(SearchResult* result) { | 354 void AppListMainView::OnResultInstalled(SearchResult* result) { |
| 339 // Clears the search to show the apps grid. The last installed app | 355 // Clears the search to show the apps grid. The last installed app |
| 340 // should be highlighted and made visible already. | 356 // should be highlighted and made visible already. |
| 341 search_box_view_->ClearSearch(); | 357 search_box_view_->ClearSearch(); |
| 342 } | 358 } |
| 343 | 359 |
| 344 } // namespace app_list | 360 } // namespace app_list |
| OLD | NEW |