OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef UI_APP_LIST_FOLDER_IMAGE_H_ | 5 #ifndef UI_APP_LIST_FOLDER_IMAGE_H_ |
6 #define UI_APP_LIST_FOLDER_IMAGE_H_ | 6 #define UI_APP_LIST_FOLDER_IMAGE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // Generates the folder's icon from the icons of the items in the item list, | 43 // Generates the folder's icon from the icons of the items in the item list, |
44 // and notifies observers that the icon has changed. | 44 // and notifies observers that the icon has changed. |
45 void UpdateIcon(); | 45 void UpdateIcon(); |
46 | 46 |
47 const gfx::ImageSkia& icon() const { return icon_; } | 47 const gfx::ImageSkia& icon() const { return icon_; } |
48 | 48 |
49 // Returns the icon of one of the top items with |item_index|. | 49 // Returns the icon of one of the top items with |item_index|. |
50 const gfx::ImageSkia& GetTopIcon(size_t item_index); | 50 const gfx::ImageSkia& GetTopIcon(size_t item_index); |
51 | 51 |
| 52 // Calculates the top item icons' bounds inside |folder_icon_bounds|. |
| 53 // Returns the bounds of top item icons in sequence of top left, top right, |
| 54 // bottom left, bottom right. |
| 55 static std::vector<gfx::Rect> GetTopIconsBounds( |
| 56 const gfx::Rect& folder_icon_bounds); |
| 57 |
52 // Returns the target icon bounds for |item| to fly back to its parent folder | 58 // Returns the target icon bounds for |item| to fly back to its parent folder |
53 // icon in animation UI. If |item| is one of the top item icon, this will | 59 // icon in animation UI. If |item| is one of the top item icon, this will |
54 // match its corresponding top item icon in the folder icon. Otherwise, | 60 // match its corresponding top item icon in the folder icon. Otherwise, |
55 // the target icon bounds is centered at the |folder_icon_bounds| with | 61 // the target icon bounds is centered at the |folder_icon_bounds| with |
56 // the same size of the top item icon. | 62 // the same size of the top item icon. |
57 // The Rect returned is in the same coordinates of |folder_icon_bounds|. | 63 // The Rect returned is in the same coordinates of |folder_icon_bounds|. |
58 gfx::Rect GetTargetIconRectInFolderForItem( | 64 gfx::Rect GetTargetIconRectInFolderForItem( |
59 AppListItem* item, | 65 AppListItem* item, |
60 const gfx::Rect& folder_icon_bounds); | 66 const gfx::Rect& folder_icon_bounds); |
61 | 67 |
(...skipping 24 matching lines...) Expand all Loading... |
86 | 92 |
87 // Top items for generating folder icon. | 93 // Top items for generating folder icon. |
88 std::vector<AppListItem*> top_items_; | 94 std::vector<AppListItem*> top_items_; |
89 | 95 |
90 ObserverList<FolderImageObserver> observers_; | 96 ObserverList<FolderImageObserver> observers_; |
91 }; | 97 }; |
92 | 98 |
93 } // namespace app_list | 99 } // namespace app_list |
94 | 100 |
95 #endif // UI_APP_LIST_FOLDER_IMAGE_H_ | 101 #endif // UI_APP_LIST_FOLDER_IMAGE_H_ |
OLD | NEW |