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

Unified 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: Created 6 years, 2 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/folder_image_source.h
diff --git a/ui/app_list/folder_image_source.h b/ui/app_list/folder_image_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..7acfd0161dc279934845d54f9e1aa293fa4a6276
--- /dev/null
+++ b/ui/app_list/folder_image_source.h
@@ -0,0 +1,57 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_APP_LIST_FOLDER_IMAGE_SOURCE_H_
+#define UI_APP_LIST_APP_LIST_FOLDER_IMAGE_SOURCE_H_
+
+#include <vector>
+
+#include "ui/gfx/image/canvas_image_source.h"
+
+namespace gfx {
+class Canvas;
+class ImageSkia;
+class Rect;
+class Size;
+}
+
+namespace app_list {
+
+// Generates the folder icon with the top 4 child item icons laid in 2x2 tile.
+class FolderImageSource : public gfx::CanvasImageSource {
+ public:
+ typedef std::vector<gfx::ImageSkia> Icons;
+
+ FolderImageSource(const Icons& icons, const gfx::Size& size);
+
calamity 2014/10/23 05:41:18 nit: remove newline.
Matt Giuca 2014/10/23 06:32:38 Done.
+ virtual ~FolderImageSource();
+
+ // Gets the size of a small app icon inside the folder icon.
+ static gfx::Size ItemIconSize();
+
+ // Calculates the top item icons' bounds inside |folder_icon_bounds|.
+ // Returns the bounds of top item icons in sequence of top left, top right,
+ // bottom left, bottom right.
+ static std::vector<gfx::Rect> GetTopIconsBounds(
+ const gfx::Rect& folder_icon_bounds);
+
+ private:
+ void DrawIcon(gfx::Canvas* canvas,
+ const gfx::ImageSkia& icon,
+ const gfx::Size icon_size,
+ int x,
+ int y);
+
+ // gfx::CanvasImageSource overrides:
+ virtual void Draw(gfx::Canvas* canvas) override;
+
+ Icons icons_;
+ gfx::Size size_;
+
+ DISALLOW_COPY_AND_ASSIGN(FolderImageSource);
+};
+
+} // namespace app_list
+
+#endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_
« 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