Chromium Code Reviews| Index: ui/app_list/views/apps_container_view.cc |
| diff --git a/ui/app_list/views/apps_container_view.cc b/ui/app_list/views/apps_container_view.cc |
| index ff117a0d5011560f7949da9b6cb3a188de0b1e72..e2aa3e2b6f86bbe221b3148e635209993744e358 100644 |
| --- a/ui/app_list/views/apps_container_view.cc |
| +++ b/ui/app_list/views/apps_container_view.cc |
| @@ -24,7 +24,8 @@ AppsContainerView::AppsContainerView(AppListMainView* app_list_main_view, |
| content::WebContents* start_page_contents) |
| : model_(model), |
| show_state_(SHOW_APPS), |
| - top_icon_animation_pending_count_(0) { |
| + top_icon_animation_pending_count_(0), |
| + show_apps_with_animation_(false) { |
| apps_grid_view_ = new AppsGridView( |
| app_list_main_view, pagination_model, start_page_contents); |
| apps_grid_view_->SetLayout(kPreferredIconDimension, |
| @@ -51,14 +52,14 @@ AppsContainerView::~AppsContainerView() { |
| void AppsContainerView::ShowActiveFolder(AppListFolderItem* folder_item) { |
| app_list_folder_view_->SetAppListFolderItem(folder_item); |
| - SetShowState(SHOW_ACTIVE_FOLDER); |
| + SetShowState(SHOW_ACTIVE_FOLDER, false); |
| CreateViewsForFolderTopItemsAnimation(folder_item, true); |
| } |
| void AppsContainerView::ShowApps(AppListFolderItem* folder_item) { |
| PrepareToShowApps(folder_item); |
| - SetShowState(SHOW_APPS); |
| + SetShowState(SHOW_APPS, true); |
| } |
| void AppsContainerView::SetDragAndDropHostOfCurrentAppList( |
| @@ -71,7 +72,7 @@ void AppsContainerView::SetDragAndDropHostOfCurrentAppList( |
| void AppsContainerView::ReparentFolderItemTransit( |
| AppListFolderItem* folder_item) { |
| PrepareToShowApps(folder_item); |
| - SetShowState(SHOW_ITEM_REPARENT); |
| + SetShowState(SHOW_ITEM_REPARENT, false); |
| } |
| gfx::Size AppsContainerView::GetPreferredSize() { |
| @@ -91,9 +92,15 @@ void AppsContainerView::Layout() { |
| switch (show_state_) { |
| case SHOW_APPS: |
| folder_background_view_->SetVisible(false); |
| - app_list_folder_view_->ScheduleShowHideAnimation(false, false); |
| + if (show_apps_with_animation_) |
| + app_list_folder_view_->ScheduleShowHideAnimation(false, false); |
| + else |
| + app_list_folder_view_->HideViewImmediately(); |
| apps_grid_view_->SetBoundsRect(rect); |
| - apps_grid_view_->ScheduleShowHideAnimation(true); |
| + if (show_apps_with_animation_) |
| + apps_grid_view_->ScheduleShowHideAnimation(true); |
| + else |
| + apps_grid_view_->SetVisible(true); |
|
xiyuan
2014/02/13 22:53:42
Can we move the animation and show/hide code into
jennyz
2014/02/13 23:42:59
Done.
|
| break; |
| case SHOW_ACTIVE_FOLDER: |
| folder_background_view_->SetBoundsRect(rect); |
| @@ -136,11 +143,13 @@ void AppsContainerView::OnTopIconAnimationsComplete() { |
| } |
| } |
| -void AppsContainerView::SetShowState(ShowState show_state) { |
| +void AppsContainerView::SetShowState(ShowState show_state, |
| + bool show_apps_with_animation) { |
| if (show_state_ == show_state) |
| return; |
| show_state_ = show_state; |
| + show_apps_with_animation_ = show_apps_with_animation; |
| Layout(); |
| } |