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