Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: ui/app_list/views/apps_container_view.cc

Issue 220393003: Add a unit test for resetting the app list on a reshow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trent_whole_app_list_unit_test
Patch Set: fix NULL icon cases for app list folders Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 rows = kExperimentalPreferredRows; 36 rows = kExperimentalPreferredRows;
37 } 37 }
38 apps_grid_view_->SetLayout(kPreferredIconDimension, cols, rows); 38 apps_grid_view_->SetLayout(kPreferredIconDimension, cols, rows);
39 AddChildView(apps_grid_view_); 39 AddChildView(apps_grid_view_);
40 40
41 folder_background_view_ = new FolderBackgroundView(); 41 folder_background_view_ = new FolderBackgroundView();
42 AddChildView(folder_background_view_); 42 AddChildView(folder_background_view_);
43 43
44 app_list_folder_view_ = 44 app_list_folder_view_ =
45 new AppListFolderView(this, model, app_list_main_view); 45 new AppListFolderView(this, model, app_list_main_view);
46 // The folder view is initially hidden.
47 app_list_folder_view_->SetVisible(false);
46 AddChildView(app_list_folder_view_); 48 AddChildView(app_list_folder_view_);
47 49
48 apps_grid_view_->SetModel(model_); 50 apps_grid_view_->SetModel(model_);
49 apps_grid_view_->SetItemList(model_->top_level_item_list()); 51 apps_grid_view_->SetItemList(model_->top_level_item_list());
50 SetShowState(SHOW_APPS, 52 SetShowState(SHOW_APPS,
51 false); /* show apps without animation */ 53 false); /* show apps without animation */
52 } 54 }
53 55
54 AppsContainerView::~AppsContainerView() { 56 AppsContainerView::~AppsContainerView() {
55 } 57 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 203
202 void AppsContainerView::CreateViewsForFolderTopItemsAnimation( 204 void AppsContainerView::CreateViewsForFolderTopItemsAnimation(
203 AppListFolderItem* active_folder, 205 AppListFolderItem* active_folder,
204 bool open_folder) { 206 bool open_folder) {
205 top_icon_views_.clear(); 207 top_icon_views_.clear();
206 std::vector<gfx::Rect> top_items_bounds = 208 std::vector<gfx::Rect> top_items_bounds =
207 GetTopItemIconBoundsInActiveFolder(); 209 GetTopItemIconBoundsInActiveFolder();
208 top_icon_animation_pending_count_ = 210 top_icon_animation_pending_count_ =
209 std::min(kNumFolderTopItems, active_folder->item_list()->item_count()); 211 std::min(kNumFolderTopItems, active_folder->item_list()->item_count());
210 for (size_t i = 0; i < top_icon_animation_pending_count_; ++i) { 212 for (size_t i = 0; i < top_icon_animation_pending_count_; ++i) {
213 if (active_folder->GetTopIcon(i).isNull())
214 continue;
215
211 TopIconAnimationView* icon_view = new TopIconAnimationView( 216 TopIconAnimationView* icon_view = new TopIconAnimationView(
212 active_folder->GetTopIcon(i), top_items_bounds[i], open_folder); 217 active_folder->GetTopIcon(i), top_items_bounds[i], open_folder);
213 icon_view->AddObserver(this); 218 icon_view->AddObserver(this);
214 top_icon_views_.push_back(icon_view); 219 top_icon_views_.push_back(icon_view);
215 220
216 // Add the transitional views into child views, and set its bounds to the 221 // Add the transitional views into child views, and set its bounds to the
217 // same location of the item in the folder list view. 222 // same location of the item in the folder list view.
218 AddChildView(top_icon_views_[i]); 223 AddChildView(top_icon_views_[i]);
219 top_icon_views_[i]->SetBoundsRect( 224 top_icon_views_[i]->SetBoundsRect(
220 app_list_folder_view_->ConvertRectToParent( 225 app_list_folder_view_->ConvertRectToParent(
221 app_list_folder_view_->GetItemIconBoundsAt(i))); 226 app_list_folder_view_->GetItemIconBoundsAt(i)));
222 static_cast<TopIconAnimationView*>(top_icon_views_[i])->TransformView(); 227 static_cast<TopIconAnimationView*>(top_icon_views_[i])->TransformView();
223 } 228 }
224 } 229 }
225 230
226 void AppsContainerView::PrepareToShowApps(AppListFolderItem* folder_item) { 231 void AppsContainerView::PrepareToShowApps(AppListFolderItem* folder_item) {
227 if (folder_item) 232 if (folder_item)
228 CreateViewsForFolderTopItemsAnimation(folder_item, false); 233 CreateViewsForFolderTopItemsAnimation(folder_item, false);
229 234
230 // Hide the active folder item until the animation completes. 235 // Hide the active folder item until the animation completes.
231 if (apps_grid_view_->activated_item_view()) 236 if (apps_grid_view_->activated_item_view())
232 apps_grid_view_->activated_item_view()->SetVisible(false); 237 apps_grid_view_->activated_item_view()->SetVisible(false);
233 } 238 }
234 239
235 } // namespace app_list 240 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view_unittest.cc ('k') | ui/app_list/views/test/apps_grid_view_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698