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

Side by Side Diff: ui/app_list/folder_image_source.h

Issue 657793004: Moved FolderImageSource class to a separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/app-list-typedefs-iwyu
Patch Set: Fix GN. Created 6 years, 1 month 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_folder_item.cc ('k') | ui/app_list/folder_image_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_APP_LIST_APP_LIST_FOLDER_IMAGE_SOURCE_H_
6 #define UI_APP_LIST_APP_LIST_FOLDER_IMAGE_SOURCE_H_
7
8 #include <vector>
9
10 #include "ui/gfx/image/canvas_image_source.h"
11
12 namespace gfx {
13 class Canvas;
14 class ImageSkia;
15 class Rect;
16 class Size;
17 }
18
19 namespace app_list {
20
21 // Generates the folder icon with the top 4 child item icons laid in 2x2 tile.
22 class FolderImageSource : public gfx::CanvasImageSource {
23 public:
24 typedef std::vector<gfx::ImageSkia> Icons;
25
26 FolderImageSource(const Icons& icons, const gfx::Size& size);
27 ~FolderImageSource() override;
28
29 // Gets the size of a small app icon inside the folder icon.
30 static gfx::Size ItemIconSize();
31
32 // Calculates the top item icons' bounds inside |folder_icon_bounds|.
33 // Returns the bounds of top item icons in sequence of top left, top right,
34 // bottom left, bottom right.
35 static std::vector<gfx::Rect> GetTopIconsBounds(
36 const gfx::Rect& folder_icon_bounds);
37
38 private:
39 void DrawIcon(gfx::Canvas* canvas,
40 const gfx::ImageSkia& icon,
41 const gfx::Size icon_size,
42 int x,
43 int y);
44
45 // gfx::CanvasImageSource overrides:
46 void Draw(gfx::Canvas* canvas) override;
47
48 Icons icons_;
49 gfx::Size size_;
50
51 DISALLOW_COPY_AND_ASSIGN(FolderImageSource);
52 };
53
54 } // namespace app_list
55
56 #endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_
OLDNEW
« no previous file with comments | « ui/app_list/app_list_folder_item.cc ('k') | ui/app_list/folder_image_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698