| OLD | NEW |
| 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 #ifndef UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ |
| 6 #define UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ | 6 #define UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ui/app_list/app_list_export.h" | 11 #include "ui/app_list/app_list_export.h" |
| 12 #include "ui/app_list/app_list_item.h" | 12 #include "ui/app_list/app_list_item.h" |
| 13 #include "ui/app_list/app_list_item_list_observer.h" | 13 #include "ui/app_list/app_list_item_list_observer.h" |
| 14 #include "ui/app_list/app_list_item_observer.h" | 14 #include "ui/app_list/app_list_item_observer.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 |
| 16 namespace gfx { |
| 17 class Rect; |
| 18 } |
| 16 | 19 |
| 17 namespace app_list { | 20 namespace app_list { |
| 18 | 21 |
| 19 class AppListItemList; | 22 class AppListItemList; |
| 20 | 23 |
| 21 typedef std::vector<gfx::Rect> Rects; | |
| 22 | |
| 23 // AppListFolderItem implements the model/controller for folders. | 24 // AppListFolderItem implements the model/controller for folders. |
| 24 class APP_LIST_EXPORT AppListFolderItem : public AppListItem, | 25 class APP_LIST_EXPORT AppListFolderItem : public AppListItem, |
| 25 public AppListItemListObserver, | 26 public AppListItemListObserver, |
| 26 public AppListItemObserver { | 27 public AppListItemObserver { |
| 27 public: | 28 public: |
| 28 // The folder type affects folder behavior. | 29 // The folder type affects folder behavior. |
| 29 enum FolderType { | 30 enum FolderType { |
| 30 // Default folder type. | 31 // Default folder type. |
| 31 FOLDER_TYPE_NORMAL, | 32 FOLDER_TYPE_NORMAL, |
| 32 // Items can not be moved to/from OEM folders in the UI. | 33 // Items can not be moved to/from OEM folders in the UI. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 63 virtual const char* GetItemType() const override; | 64 virtual const char* GetItemType() const override; |
| 64 virtual ui::MenuModel* GetContextMenuModel() override; | 65 virtual ui::MenuModel* GetContextMenuModel() override; |
| 65 virtual AppListItem* FindChildItem(const std::string& id) override; | 66 virtual AppListItem* FindChildItem(const std::string& id) override; |
| 66 virtual size_t ChildItemCount() const override; | 67 virtual size_t ChildItemCount() const override; |
| 67 virtual void OnExtensionPreferenceChanged() override; | 68 virtual void OnExtensionPreferenceChanged() override; |
| 68 virtual bool CompareForTest(const AppListItem* other) const override; | 69 virtual bool CompareForTest(const AppListItem* other) const override; |
| 69 | 70 |
| 70 // Calculates the top item icons' bounds inside |folder_icon_bounds|. | 71 // Calculates the top item icons' bounds inside |folder_icon_bounds|. |
| 71 // Returns the bounds of top item icons in sequence of top left, top right, | 72 // Returns the bounds of top item icons in sequence of top left, top right, |
| 72 // bottom left, bottom right. | 73 // bottom left, bottom right. |
| 73 static Rects GetTopIconsBounds(const gfx::Rect& folder_icon_bounds); | 74 static std::vector<gfx::Rect> GetTopIconsBounds( |
| 75 const gfx::Rect& folder_icon_bounds); |
| 74 | 76 |
| 75 // Returns an id for a new folder. | 77 // Returns an id for a new folder. |
| 76 static std::string GenerateId(); | 78 static std::string GenerateId(); |
| 77 | 79 |
| 78 private: | 80 private: |
| 79 // AppListItemObserver | 81 // AppListItemObserver |
| 80 virtual void ItemIconChanged() override; | 82 virtual void ItemIconChanged() override; |
| 81 | 83 |
| 82 // AppListItemListObserver | 84 // AppListItemListObserver |
| 83 virtual void OnListItemAdded(size_t index, AppListItem* item) override; | 85 virtual void OnListItemAdded(size_t index, AppListItem* item) override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 97 | 99 |
| 98 // Top items for generating folder icon. | 100 // Top items for generating folder icon. |
| 99 std::vector<AppListItem*> top_items_; | 101 std::vector<AppListItem*> top_items_; |
| 100 | 102 |
| 101 DISALLOW_COPY_AND_ASSIGN(AppListFolderItem); | 103 DISALLOW_COPY_AND_ASSIGN(AppListFolderItem); |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 } // namespace app_list | 106 } // namespace app_list |
| 105 | 107 |
| 106 #endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ | 108 #endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ |
| OLD | NEW |