Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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 "ui/aura_shell/aura_shell_export.h" | |
| 15 | |
| 16 namespace aura_shell { | |
| 17 | |
| 18 class AppListItemModelObserver; | |
| 19 | |
| 20 // AppListItemModel provides icon and title to be shown in a TileView and | |
| 21 // action to be executed when the TileView is activated (clicked or enter | |
| 22 // key it hit). | |
| 23 class AURA_SHELL_EXPORT AppListItemModel { | |
| 24 public: | |
| 25 AppListItemModel(const SkBitmap& icon, | |
| 26 const std::string& title); | |
| 27 virtual ~AppListItemModel(); | |
| 28 | |
| 29 // Activates the item. |event_flags| holds flags of a mouse/keyboard event | |
| 30 // associated with this activation. | |
| 31 virtual void Activate(int event_flags); | |
|
sky
2011/12/14 16:51:33
This feels better served by a specific interface a
xiyuan
2011/12/20 00:14:42
Done.
- Added AppListItemViewListener to propogat
| |
| 32 | |
| 33 // Changes icon and title for the model. | |
| 34 void SetIcon(const SkBitmap& icon); | |
| 35 void SetTitle(const std::string& title); | |
| 36 | |
| 37 void AddObserver(AppListItemModelObserver* observer); | |
| 38 void RemoveObserver(AppListItemModelObserver* observer); | |
| 39 | |
| 40 const SkBitmap& icon() const { | |
| 41 return icon_; | |
| 42 } | |
| 43 | |
| 44 const std::string& title() const { | |
| 45 return title_; | |
| 46 } | |
| 47 | |
| 48 private: | |
| 49 SkBitmap icon_; | |
| 50 std::string title_; | |
| 51 | |
| 52 ObserverList<AppListItemModelObserver> observers_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(AppListItemModel); | |
| 55 }; | |
| 56 | |
| 57 } // namespace aura_shell | |
| 58 | |
| 59 #endif // #define UI_AURA_SHELL_APP_LIST_APP_LIST_ITEM_MODEL_H_ | |
| OLD | NEW |