| 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/apps_container_view.h" | 5 #include "ui/app_list/views/apps_container_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 app_list_folder_view_ = new AppListFolderView( | 46 app_list_folder_view_ = new AppListFolderView( |
| 47 this, | 47 this, |
| 48 model, | 48 model, |
| 49 app_list_main_view, | 49 app_list_main_view, |
| 50 start_page_contents); | 50 start_page_contents); |
| 51 AddChildView(app_list_folder_view_); | 51 AddChildView(app_list_folder_view_); |
| 52 | 52 |
| 53 apps_grid_view_->SetModel(model_); | 53 apps_grid_view_->SetModel(model_); |
| 54 apps_grid_view_->SetItemList(model_->item_list()); | 54 apps_grid_view_->SetItemList(model_->item_list()); |
| 55 SetShowState(SHOW_APPS, | |
| 56 false); /* show apps without animation */ | |
| 57 } | 55 } |
| 58 | 56 |
| 59 AppsContainerView::~AppsContainerView() { | 57 AppsContainerView::~AppsContainerView() { |
| 60 } | 58 } |
| 61 | 59 |
| 62 void AppsContainerView::ShowActiveFolder(AppListFolderItem* folder_item) { | 60 void AppsContainerView::ShowActiveFolder(AppListFolderItem* folder_item) { |
| 63 app_list_folder_view_->SetAppListFolderItem(folder_item); | 61 app_list_folder_view_->SetAppListFolderItem(folder_item); |
| 64 SetShowState(SHOW_ACTIVE_FOLDER, false); | 62 SetShowState(SHOW_ACTIVE_FOLDER, false); |
| 65 | 63 |
| 66 CreateViewsForFolderTopItemsAnimation(folder_item, true); | 64 CreateViewsForFolderTopItemsAnimation(folder_item, true); |
| 67 } | 65 } |
| 68 | 66 |
| 69 void AppsContainerView::ShowApps(AppListFolderItem* folder_item) { | 67 void AppsContainerView::ShowApps(AppListFolderItem* folder_item) { |
| 70 PrepareToShowApps(folder_item); | 68 PrepareToShowApps(folder_item); |
| 71 SetShowState(SHOW_APPS, | 69 SetShowState(SHOW_APPS, |
| 72 true); /* show apps with animation */ | 70 true); /* show apps with animation */ |
| 73 } | 71 } |
| 74 | 72 |
| 73 void AppsContainerView::ResetForShow() { |
| 74 SetShowState(SHOW_APPS, false /* show apps without animation */); |
| 75 folder_background_view_->UpdateFolderContainerBubble( |
| 76 FolderBackgroundView::NO_BUBBLE); |
| 77 } |
| 78 |
| 75 void AppsContainerView::SetDragAndDropHostOfCurrentAppList( | 79 void AppsContainerView::SetDragAndDropHostOfCurrentAppList( |
| 76 ApplicationDragAndDropHost* drag_and_drop_host) { | 80 ApplicationDragAndDropHost* drag_and_drop_host) { |
| 77 apps_grid_view()->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); | 81 apps_grid_view()->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); |
| 78 app_list_folder_view()->items_grid_view()-> | 82 app_list_folder_view()->items_grid_view()-> |
| 79 SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); | 83 SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); |
| 80 } | 84 } |
| 81 | 85 |
| 82 void AppsContainerView::ReparentFolderItemTransit( | 86 void AppsContainerView::ReparentFolderItemTransit( |
| 83 AppListFolderItem* folder_item) { | 87 AppListFolderItem* folder_item) { |
| 84 PrepareToShowApps(folder_item); | 88 PrepareToShowApps(folder_item); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 show_state_ = show_state; | 148 show_state_ = show_state; |
| 145 | 149 |
| 146 switch (show_state_) { | 150 switch (show_state_) { |
| 147 case SHOW_APPS: | 151 case SHOW_APPS: |
| 148 folder_background_view_->SetVisible(false); | 152 folder_background_view_->SetVisible(false); |
| 149 if (show_apps_with_animation) { | 153 if (show_apps_with_animation) { |
| 150 app_list_folder_view_->ScheduleShowHideAnimation(false, false); | 154 app_list_folder_view_->ScheduleShowHideAnimation(false, false); |
| 151 apps_grid_view_->ScheduleShowHideAnimation(true); | 155 apps_grid_view_->ScheduleShowHideAnimation(true); |
| 152 } else { | 156 } else { |
| 153 app_list_folder_view_->HideViewImmediately(); | 157 app_list_folder_view_->HideViewImmediately(); |
| 154 apps_grid_view_->SetVisible(true); | 158 apps_grid_view_->ResetForShow(); |
| 155 } | 159 } |
| 156 break; | 160 break; |
| 157 case SHOW_ACTIVE_FOLDER: | 161 case SHOW_ACTIVE_FOLDER: |
| 158 folder_background_view_->SetVisible(true); | 162 folder_background_view_->SetVisible(true); |
| 159 apps_grid_view_->ScheduleShowHideAnimation(false); | 163 apps_grid_view_->ScheduleShowHideAnimation(false); |
| 160 app_list_folder_view_->ScheduleShowHideAnimation(true, false); | 164 app_list_folder_view_->ScheduleShowHideAnimation(true, false); |
| 161 break; | 165 break; |
| 162 case SHOW_ITEM_REPARENT: | 166 case SHOW_ITEM_REPARENT: |
| 163 folder_background_view_->SetVisible(false); | 167 folder_background_view_->SetVisible(false); |
| 164 folder_background_view_->UpdateFolderContainerBubble( | 168 folder_background_view_->UpdateFolderContainerBubble( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void AppsContainerView::PrepareToShowApps(AppListFolderItem* folder_item) { | 214 void AppsContainerView::PrepareToShowApps(AppListFolderItem* folder_item) { |
| 211 if (folder_item) | 215 if (folder_item) |
| 212 CreateViewsForFolderTopItemsAnimation(folder_item, false); | 216 CreateViewsForFolderTopItemsAnimation(folder_item, false); |
| 213 | 217 |
| 214 // Hide the active folder item until the animation completes. | 218 // Hide the active folder item until the animation completes. |
| 215 if (apps_grid_view_->activated_item_view()) | 219 if (apps_grid_view_->activated_item_view()) |
| 216 apps_grid_view_->activated_item_view()->SetVisible(false); | 220 apps_grid_view_->activated_item_view()->SetVisible(false); |
| 217 } | 221 } |
| 218 | 222 |
| 219 } // namespace app_list | 223 } // namespace app_list |
| OLD | NEW |