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" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | |
13 #include "ui/app_list/app_list_export.h" | 12 #include "ui/app_list/app_list_export.h" |
| 13 #include "ui/gfx/image/image_skia.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 class MenuModel; | 16 class MenuModel; |
17 } | 17 } |
18 | 18 |
19 namespace app_list { | 19 namespace app_list { |
20 | 20 |
21 class AppListItemModelObserver; | 21 class AppListItemModelObserver; |
22 | 22 |
23 // AppListItemModel provides icon and title to be shown in a AppListItemView | 23 // AppListItemModel provides icon and title to be shown in a AppListItemView |
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 SkBitmap& icon); | 30 void SetIcon(const gfx::ImageSkia& icon); |
31 const SkBitmap& icon() const { | 31 const gfx::ImageSkia& icon() const { |
32 return icon_; | 32 return icon_; |
33 } | 33 } |
34 | 34 |
35 void SetTitle(const std::string& title); | 35 void SetTitle(const std::string& title); |
36 const std::string& title() const { | 36 const std::string& title() const { |
37 return title_; | 37 return title_; |
38 } | 38 } |
39 | 39 |
40 void SetHighlighted(bool highlighted); | 40 void SetHighlighted(bool highlighted); |
41 bool highlighted() const { | 41 bool highlighted() const { |
42 return highlighted_; | 42 return highlighted_; |
43 } | 43 } |
44 | 44 |
45 void AddObserver(AppListItemModelObserver* observer); | 45 void AddObserver(AppListItemModelObserver* observer); |
46 void RemoveObserver(AppListItemModelObserver* observer); | 46 void RemoveObserver(AppListItemModelObserver* observer); |
47 | 47 |
48 // Returns the context menu model for this item. | 48 // Returns the context menu model for this item. |
49 // Note the menu model is owned by this item. | 49 // Note the menu model is owned by this item. |
50 virtual ui::MenuModel* GetContextMenuModel(); | 50 virtual ui::MenuModel* GetContextMenuModel(); |
51 | 51 |
52 private: | 52 private: |
53 SkBitmap icon_; | 53 gfx::ImageSkia icon_; |
54 std::string title_; | 54 std::string title_; |
55 bool highlighted_; | 55 bool highlighted_; |
56 | 56 |
57 ObserverList<AppListItemModelObserver> observers_; | 57 ObserverList<AppListItemModelObserver> observers_; |
58 | 58 |
59 DISALLOW_COPY_AND_ASSIGN(AppListItemModel); | 59 DISALLOW_COPY_AND_ASSIGN(AppListItemModel); |
60 }; | 60 }; |
61 | 61 |
62 } // namespace app_list | 62 } // namespace app_list |
63 | 63 |
64 #endif // UI_APP_LIST_APP_LIST_ITEM_MODEL_H_ | 64 #endif // UI_APP_LIST_APP_LIST_ITEM_MODEL_H_ |
OLD | NEW |