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