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

Side by Side Diff: ui/app_list/app_list_folder_item.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
« no previous file with comments | « ui/app_list/app_list.gyp ('k') | ui/app_list/test/app_list_test_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/app_list_folder_item.h" 5 #include "ui/app_list/app_list_folder_item.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "ui/app_list/app_list_constants.h" 8 #include "ui/app_list/app_list_constants.h"
9 #include "ui/app_list/app_list_item_list.h" 9 #include "ui/app_list/app_list_item_list.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 18 matching lines...) Expand all
29 DCHECK(icons.size() <= kNumFolderTopItems); 29 DCHECK(icons.size() <= kNumFolderTopItems);
30 } 30 }
31 31
32 virtual ~FolderImageSource() {} 32 virtual ~FolderImageSource() {}
33 33
34 private: 34 private:
35 void DrawIcon(gfx::Canvas* canvas, 35 void DrawIcon(gfx::Canvas* canvas,
36 const gfx::ImageSkia& icon, 36 const gfx::ImageSkia& icon,
37 const gfx::Size icon_size, 37 const gfx::Size icon_size,
38 int x, int y) { 38 int x, int y) {
39 if (icon.isNull())
40 return;
41
39 gfx::ImageSkia resized( 42 gfx::ImageSkia resized(
40 gfx::ImageSkiaOperations::CreateResizedImage( 43 gfx::ImageSkiaOperations::CreateResizedImage(
41 icon, skia::ImageOperations::RESIZE_BEST, icon_size)); 44 icon, skia::ImageOperations::RESIZE_BEST, icon_size));
42 canvas->DrawImageInt(resized, 0, 0, resized.width(), resized.height(), 45 canvas->DrawImageInt(resized, 0, 0, resized.width(), resized.height(),
43 x, y, resized.width(), resized.height(), true); 46 x, y, resized.width(), resized.height(), true);
44 } 47 }
45 48
46 // gfx::CanvasImageSource overrides: 49 // gfx::CanvasImageSource overrides:
47 virtual void Draw(gfx::Canvas* canvas) OVERRIDE { 50 virtual void Draw(gfx::Canvas* canvas) OVERRIDE {
48 // Draw folder circle. 51 // Draw folder circle.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 for (size_t i = 0; 250 for (size_t i = 0;
248 i < kNumFolderTopItems && i < item_list_->item_count(); ++i) { 251 i < kNumFolderTopItems && i < item_list_->item_count(); ++i) {
249 AppListItem* item = item_list_->item_at(i); 252 AppListItem* item = item_list_->item_at(i);
250 item->AddObserver(this); 253 item->AddObserver(this);
251 top_items_.push_back(item); 254 top_items_.push_back(item);
252 } 255 }
253 UpdateIcon(); 256 UpdateIcon();
254 } 257 }
255 258
256 } // namespace app_list 259 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/app_list.gyp ('k') | ui/app_list/test/app_list_test_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698