| Index: ui/app_list/app_list_folder_item.h
|
| diff --git a/ui/app_list/app_list_folder_item.h b/ui/app_list/app_list_folder_item.h
|
| index cd572e71dbba2c43bfad6f7f407c49d72efef12c..5ca5deb3a0eb3830f0850c3e1ab6769b020dc199 100644
|
| --- a/ui/app_list/app_list_folder_item.h
|
| +++ b/ui/app_list/app_list_folder_item.h
|
| @@ -12,8 +12,10 @@
|
| #include "ui/app_list/app_list_item.h"
|
| #include "ui/app_list/app_list_item_list_observer.h"
|
| #include "ui/app_list/app_list_item_observer.h"
|
| +#include "ui/app_list/folder_image.h"
|
|
|
| namespace gfx {
|
| +class ImageSkia;
|
| class Rect;
|
| }
|
|
|
| @@ -23,8 +25,7 @@ class AppListItemList;
|
|
|
| // AppListFolderItem implements the model/controller for folders.
|
| class APP_LIST_EXPORT AppListFolderItem : public AppListItem,
|
| - public AppListItemListObserver,
|
| - public AppListItemObserver {
|
| + public FolderImageObserver {
|
| public:
|
| // The folder type affects folder behavior.
|
| enum FolderType {
|
| @@ -39,9 +40,6 @@ class APP_LIST_EXPORT AppListFolderItem : public AppListItem,
|
| AppListFolderItem(const std::string& id, FolderType folder_type);
|
| ~AppListFolderItem() override;
|
|
|
| - // Updates the folder's icon.
|
| - void UpdateIcon();
|
| -
|
| // Returns the icon of one of the top items with |item_index|.
|
| const gfx::ImageSkia& GetTopIcon(size_t item_index);
|
|
|
| @@ -57,9 +55,14 @@ class APP_LIST_EXPORT AppListFolderItem : public AppListItem,
|
| AppListItemList* item_list() { return item_list_.get(); }
|
| const AppListItemList* item_list() const { return item_list_.get(); }
|
|
|
| + // For tests.
|
| + // TODO(mgiuca): return a const FolderImage& (requires that
|
| + // base::ObserverList::HasObserver takes a const*).
|
| + FolderImage* folder_image() { return &folder_image_; }
|
| +
|
| FolderType folder_type() const { return folder_type_; }
|
|
|
| - // AppListItem
|
| + // AppListItem overrides:
|
| void Activate(int event_flags) override;
|
| const char* GetItemType() const override;
|
| ui::MenuModel* GetContextMenuModel() override;
|
| @@ -71,28 +74,17 @@ class APP_LIST_EXPORT AppListFolderItem : public AppListItem,
|
| // Returns an id for a new folder.
|
| static std::string GenerateId();
|
|
|
| - private:
|
| - // AppListItemObserver
|
| - void ItemIconChanged() override;
|
| -
|
| - // AppListItemListObserver
|
| - void OnListItemAdded(size_t index, AppListItem* item) override;
|
| - void OnListItemRemoved(size_t index, AppListItem* item) override;
|
| - ;
|
| - void OnListItemMoved(size_t from_index,
|
| - size_t to_index,
|
| - AppListItem* item) override;
|
| -
|
| - void UpdateTopItems();
|
| + // FolderImageObserver overrides:
|
| + void OnFolderImageUpdated() override;
|
|
|
| + private:
|
| // The type of folder; may affect behavior of folder views.
|
| const FolderType folder_type_;
|
|
|
| // List of items in the folder.
|
| scoped_ptr<AppListItemList> item_list_;
|
|
|
| - // Top items for generating folder icon.
|
| - std::vector<AppListItem*> top_items_;
|
| + FolderImage folder_image_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(AppListFolderItem);
|
| };
|
|
|