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_ITEM_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_ITEM_H_ |
6 #define UI_APP_LIST_APP_LIST_ITEM_H_ | 6 #define UI_APP_LIST_APP_LIST_ITEM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 class AppListItemObserver; | 26 class AppListItemObserver; |
27 class AppListModel; | 27 class AppListModel; |
28 | 28 |
29 // AppListItem provides icon and title to be shown in a AppListItemView | 29 // AppListItem provides icon and title to be shown in a AppListItemView |
30 // and action to be executed when the AppListItemView is activated. | 30 // and action to be executed when the AppListItemView is activated. |
31 class APP_LIST_EXPORT AppListItem { | 31 class APP_LIST_EXPORT AppListItem { |
32 public: | 32 public: |
33 explicit AppListItem(const std::string& id); | 33 explicit AppListItem(const std::string& id); |
34 virtual ~AppListItem(); | 34 virtual ~AppListItem(); |
35 | 35 |
36 void SetIcon(const gfx::ImageSkia& icon, bool has_shadow); | 36 void SetIcon(const gfx::ImageSkia& icon); |
37 const gfx::ImageSkia& icon() const { return icon_; } | 37 const gfx::ImageSkia& icon() const { return icon_; } |
38 bool has_shadow() const { return has_shadow_; } | |
39 | 38 |
40 const std::string& GetDisplayName() const { | 39 const std::string& GetDisplayName() const { |
41 return short_name_.empty() ? name_ : short_name_; | 40 return short_name_.empty() ? name_ : short_name_; |
42 } | 41 } |
43 | 42 |
44 const std::string& name() const { return name_; } | 43 const std::string& name() const { return name_; } |
45 // Should only be used in tests; otheriwse use GetDisplayName(). | 44 // Should only be used in tests; otheriwse use GetDisplayName(). |
46 const std::string& short_name() const { return short_name_; } | 45 const std::string& short_name() const { return short_name_; } |
47 | 46 |
48 void set_highlighted(bool highlighted) { highlighted_ = highlighted; } | 47 void set_highlighted(bool highlighted) { highlighted_ = highlighted; } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 113 |
115 void set_folder_id(const std::string& folder_id) { folder_id_ = folder_id; } | 114 void set_folder_id(const std::string& folder_id) { folder_id_ = folder_id; } |
116 | 115 |
117 private: | 116 private: |
118 friend class AppListModelTest; | 117 friend class AppListModelTest; |
119 | 118 |
120 const std::string id_; | 119 const std::string id_; |
121 std::string folder_id_; // Id of containing folder; empty if top level item. | 120 std::string folder_id_; // Id of containing folder; empty if top level item. |
122 syncer::StringOrdinal position_; | 121 syncer::StringOrdinal position_; |
123 gfx::ImageSkia icon_; | 122 gfx::ImageSkia icon_; |
124 bool has_shadow_; | |
125 | 123 |
126 // The full name of an item. Used for display if |short_name_| is empty. | 124 // The full name of an item. Used for display if |short_name_| is empty. |
127 std::string name_; | 125 std::string name_; |
128 | 126 |
129 // A shortened name for the item, used for display. | 127 // A shortened name for the item, used for display. |
130 std::string short_name_; | 128 std::string short_name_; |
131 | 129 |
132 bool highlighted_; | 130 bool highlighted_; |
133 bool is_installing_; | 131 bool is_installing_; |
134 int percent_downloaded_; | 132 int percent_downloaded_; |
135 | 133 |
136 ObserverList<AppListItemObserver> observers_; | 134 ObserverList<AppListItemObserver> observers_; |
137 | 135 |
138 DISALLOW_COPY_AND_ASSIGN(AppListItem); | 136 DISALLOW_COPY_AND_ASSIGN(AppListItem); |
139 }; | 137 }; |
140 | 138 |
141 } // namespace app_list | 139 } // namespace app_list |
142 | 140 |
143 #endif // UI_APP_LIST_APP_LIST_ITEM_H_ | 141 #endif // UI_APP_LIST_APP_LIST_ITEM_H_ |
OLD | NEW |