| 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" |
| 11 #include "ui/app_list/app_list_constants.h" | 11 #include "ui/app_list/app_list_constants.h" |
| 12 #include "ui/app_list/app_list_folder_item.h" | 12 #include "ui/app_list/app_list_folder_item.h" |
| 13 #include "ui/app_list/app_list_switches.h" | 13 #include "ui/app_list/app_list_switches.h" |
| 14 #include "ui/app_list/views/app_list_folder_view.h" | 14 #include "ui/app_list/views/app_list_folder_view.h" |
| 15 #include "ui/app_list/views/app_list_item_view.h" | 15 #include "ui/app_list/views/app_list_item_view.h" |
| 16 #include "ui/app_list/views/app_list_main_view.h" | 16 #include "ui/app_list/views/app_list_main_view.h" |
| 17 #include "ui/app_list/views/apps_grid_view.h" | 17 #include "ui/app_list/views/apps_grid_view.h" |
| 18 #include "ui/app_list/views/folder_background_view.h" | 18 #include "ui/app_list/views/folder_background_view.h" |
| 19 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
| 20 | 20 |
| 21 namespace app_list { | 21 namespace app_list { |
| 22 | 22 |
| 23 AppsContainerView::AppsContainerView(AppListMainView* app_list_main_view, | 23 AppsContainerView::AppsContainerView(AppListMainView* app_list_main_view, |
| 24 AppListModel* model) | 24 AppListModel* model) |
| 25 : show_state_(SHOW_NONE), top_icon_animation_pending_count_(0) { | 25 : show_state_(SHOW_NONE), top_icon_animation_pending_count_(0) { |
| 26 apps_grid_view_ = new AppsGridView(app_list_main_view); | 26 apps_grid_view_ = new AppsGridView(app_list_main_view); |
| 27 int cols; | 27 apps_grid_view_->SetLayout(kPreferredCols, kPreferredRows); |
| 28 int rows; | |
| 29 if (switches::IsExperimentalAppListEnabled()) { | |
| 30 cols = kExperimentalPreferredCols; | |
| 31 rows = kExperimentalPreferredRows; | |
| 32 } else if (app_list_main_view->ShouldCenterWindow()) { | |
| 33 cols = kCenteredPreferredCols; | |
| 34 rows = kCenteredPreferredRows; | |
| 35 } else { | |
| 36 cols = kPreferredCols; | |
| 37 rows = kPreferredRows; | |
| 38 } | |
| 39 apps_grid_view_->SetLayout(cols, rows); | |
| 40 AddChildView(apps_grid_view_); | 28 AddChildView(apps_grid_view_); |
| 41 | 29 |
| 42 folder_background_view_ = new FolderBackgroundView(); | 30 folder_background_view_ = new FolderBackgroundView(); |
| 43 AddChildView(folder_background_view_); | 31 AddChildView(folder_background_view_); |
| 44 | 32 |
| 45 app_list_folder_view_ = | 33 app_list_folder_view_ = |
| 46 new AppListFolderView(this, model, app_list_main_view); | 34 new AppListFolderView(this, model, app_list_main_view); |
| 47 // The folder view is initially hidden. | 35 // The folder view is initially hidden. |
| 48 app_list_folder_view_->SetVisible(false); | 36 app_list_folder_view_->SetVisible(false); |
| 49 AddChildView(app_list_folder_view_); | 37 AddChildView(app_list_folder_view_); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 void AppsContainerView::PrepareToShowApps(AppListFolderItem* folder_item) { | 241 void AppsContainerView::PrepareToShowApps(AppListFolderItem* folder_item) { |
| 254 if (folder_item) | 242 if (folder_item) |
| 255 CreateViewsForFolderTopItemsAnimation(folder_item, false); | 243 CreateViewsForFolderTopItemsAnimation(folder_item, false); |
| 256 | 244 |
| 257 // Hide the active folder item until the animation completes. | 245 // Hide the active folder item until the animation completes. |
| 258 if (apps_grid_view_->activated_folder_item_view()) | 246 if (apps_grid_view_->activated_folder_item_view()) |
| 259 apps_grid_view_->activated_folder_item_view()->SetVisible(false); | 247 apps_grid_view_->activated_folder_item_view()->SetVisible(false); |
| 260 } | 248 } |
| 261 | 249 |
| 262 } // namespace app_list | 250 } // namespace app_list |
| OLD | NEW |