Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / app_list / views / apps_container_view.cc
index a56b3a9..7e5adf7 100644 (file)
@@ -25,12 +25,13 @@ AppsContainerView::AppsContainerView(AppListMainView* app_list_main_view,
                                      PaginationModel* pagination_model,
                                      AppListModel* model)
     : model_(model),
-      show_state_(SHOW_APPS),
+      show_state_(SHOW_NONE),
       top_icon_animation_pending_count_(0) {
   apps_grid_view_ = new AppsGridView(app_list_main_view, pagination_model);
   int cols = kPreferredCols;
   int rows = kPreferredRows;
-  if (app_list::switches::IsExperimentalAppListPositionEnabled()) {
+  // ShouldCenterWindow also implies that it is wide instead of tall.
+  if (app_list_main_view->ShouldCenterWindow()) {
     cols = kExperimentalPreferredCols;
     rows = kExperimentalPreferredRows;
   }
@@ -54,6 +55,11 @@ AppsContainerView::~AppsContainerView() {
 }
 
 void AppsContainerView::ShowActiveFolder(AppListFolderItem* folder_item) {
+  // Prevent new animations from starting if there are currently animations
+  // pending. This fixes crbug.com/357099.
+  if (top_icon_animation_pending_count_)
+    return;
+
   app_list_folder_view_->SetAppListFolderItem(folder_item);
   SetShowState(SHOW_ACTIVE_FOLDER, false);
 
@@ -61,11 +67,20 @@ void AppsContainerView::ShowActiveFolder(AppListFolderItem* folder_item) {
 }
 
 void AppsContainerView::ShowApps(AppListFolderItem* folder_item) {
+  if (top_icon_animation_pending_count_)
+    return;
+
   PrepareToShowApps(folder_item);
   SetShowState(SHOW_APPS,
                true);  /* show apps with animation */
 }
 
+void AppsContainerView::ResetForShowApps() {
+  SetShowState(SHOW_APPS, false /* show apps without animation */);
+  folder_background_view_->UpdateFolderContainerBubble(
+      FolderBackgroundView::NO_BUBBLE);
+}
+
 void AppsContainerView::SetDragAndDropHostOfCurrentAppList(
     ApplicationDragAndDropHost* drag_and_drop_host) {
   apps_grid_view()->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host);
@@ -75,10 +90,17 @@ void AppsContainerView::SetDragAndDropHostOfCurrentAppList(
 
 void AppsContainerView::ReparentFolderItemTransit(
     AppListFolderItem* folder_item) {
+  if (top_icon_animation_pending_count_)
+    return;
+
   PrepareToShowApps(folder_item);
   SetShowState(SHOW_ITEM_REPARENT, false);
 }
 
+bool AppsContainerView::IsInFolderView() const {
+  return show_state_ == SHOW_ACTIVE_FOLDER;
+}
+
 gfx::Size AppsContainerView::GetPreferredSize() {
   const gfx::Size grid_size = apps_grid_view_->GetPreferredSize();
   const gfx::Size folder_view_size = app_list_folder_view_->GetPreferredSize();
@@ -145,7 +167,7 @@ void AppsContainerView::SetShowState(ShowState show_state,
         apps_grid_view_->ScheduleShowHideAnimation(true);
       } else {
         app_list_folder_view_->HideViewImmediately();
-        apps_grid_view_->SetVisible(true);
+        apps_grid_view_->ResetForShowApps();
       }
       break;
     case SHOW_ACTIVE_FOLDER: