| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ITEM_MODEL_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_ITEM_MODEL_H_ |
| 6 #define UI_APP_LIST_APP_LIST_ITEM_MODEL_H_ | 6 #define UI_APP_LIST_APP_LIST_ITEM_MODEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // and action to be executed when the AppListItemView is activated. | 24 // and action to be executed when the AppListItemView is activated. |
| 25 class APP_LIST_EXPORT AppListItemModel { | 25 class APP_LIST_EXPORT AppListItemModel { |
| 26 public: | 26 public: |
| 27 AppListItemModel(); | 27 AppListItemModel(); |
| 28 virtual ~AppListItemModel(); | 28 virtual ~AppListItemModel(); |
| 29 | 29 |
| 30 void SetIcon(const gfx::ImageSkia& icon, bool has_shadow); | 30 void SetIcon(const gfx::ImageSkia& icon, bool has_shadow); |
| 31 const gfx::ImageSkia& icon() const { return icon_; } | 31 const gfx::ImageSkia& icon() const { return icon_; } |
| 32 bool has_shadow() const { return has_shadow_; } | 32 bool has_shadow() const { return has_shadow_; } |
| 33 | 33 |
| 34 void SetTitle(const std::string& title); | 34 void SetTitleAndFullName(const std::string& title, |
| 35 const std::string& full_name); |
| 35 const std::string& title() const { return title_; } | 36 const std::string& title() const { return title_; } |
| 37 const std::string& full_name() const { return full_name_; } |
| 36 | 38 |
| 37 void SetHighlighted(bool highlighted); | 39 void SetHighlighted(bool highlighted); |
| 38 bool highlighted() const { return highlighted_; } | 40 bool highlighted() const { return highlighted_; } |
| 39 | 41 |
| 40 void SetIsInstalling(bool is_installing); | 42 void SetIsInstalling(bool is_installing); |
| 41 bool is_installing() const { return is_installing_; } | 43 bool is_installing() const { return is_installing_; } |
| 42 | 44 |
| 43 void SetPercentDownloaded(int percent_downloaded); | 45 void SetPercentDownloaded(int percent_downloaded); |
| 44 int percent_downloaded() const { return percent_downloaded_; } | 46 int percent_downloaded() const { return percent_downloaded_; } |
| 45 | 47 |
| 46 void set_app_id(const std::string& app_id) { app_id_ = app_id; } | 48 void set_app_id(const std::string& app_id) { app_id_ = app_id; } |
| 47 const std::string& app_id() { return app_id_; } | 49 const std::string& app_id() { return app_id_; } |
| 48 | 50 |
| 49 void AddObserver(AppListItemModelObserver* observer); | 51 void AddObserver(AppListItemModelObserver* observer); |
| 50 void RemoveObserver(AppListItemModelObserver* observer); | 52 void RemoveObserver(AppListItemModelObserver* observer); |
| 51 | 53 |
| 52 // Returns the context menu model for this item, or NULL if there is currently | 54 // Returns the context menu model for this item, or NULL if there is currently |
| 53 // no menu for the item (e.g. during install). | 55 // no menu for the item (e.g. during install). |
| 54 // Note the returned menu model is owned by this item. | 56 // Note the returned menu model is owned by this item. |
| 55 virtual ui::MenuModel* GetContextMenuModel(); | 57 virtual ui::MenuModel* GetContextMenuModel(); |
| 56 | 58 |
| 57 private: | 59 private: |
| 58 gfx::ImageSkia icon_; | 60 gfx::ImageSkia icon_; |
| 59 bool has_shadow_; | 61 bool has_shadow_; |
| 60 std::string title_; | 62 std::string title_; |
| 63 std::string full_name_; |
| 61 bool highlighted_; | 64 bool highlighted_; |
| 62 bool is_installing_; | 65 bool is_installing_; |
| 63 int percent_downloaded_; | 66 int percent_downloaded_; |
| 64 std::string app_id_; | 67 std::string app_id_; |
| 65 | 68 |
| 66 ObserverList<AppListItemModelObserver> observers_; | 69 ObserverList<AppListItemModelObserver> observers_; |
| 67 | 70 |
| 68 DISALLOW_COPY_AND_ASSIGN(AppListItemModel); | 71 DISALLOW_COPY_AND_ASSIGN(AppListItemModel); |
| 69 }; | 72 }; |
| 70 | 73 |
| 71 } // namespace app_list | 74 } // namespace app_list |
| 72 | 75 |
| 73 #endif // UI_APP_LIST_APP_LIST_ITEM_MODEL_H_ | 76 #endif // UI_APP_LIST_APP_LIST_ITEM_MODEL_H_ |
| OLD | NEW |