Index: ui/aura_shell/app_list/app_list_item_model.h |
diff --git a/ui/aura_shell/app_list/app_list_item_model.h b/ui/aura_shell/app_list/app_list_item_model.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dd596cba0a80ff2e8921205f64810f8628a1a13a |
--- /dev/null |
+++ b/ui/aura_shell/app_list/app_list_item_model.h |
@@ -0,0 +1,59 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_AURA_SHELL_APP_LIST_APP_LIST_ITEM_MODEL_H_ |
+#define UI_AURA_SHELL_APP_LIST_APP_LIST_ITEM_MODEL_H_ |
+#pragma once |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/observer_list.h" |
+#include "third_party/skia/include/core/SkBitmap.h" |
+#include "ui/aura_shell/aura_shell_export.h" |
+ |
+namespace aura_shell { |
+ |
+class AppListItemModelObserver; |
+ |
+// AppListItemModel provides icon and title to be shown in a TileView and |
+// action to be executed when the TileView is activated (clicked or enter |
+// key it hit). |
+class AURA_SHELL_EXPORT AppListItemModel { |
+ public: |
+ AppListItemModel(const SkBitmap& icon, |
+ const std::string& title); |
+ virtual ~AppListItemModel(); |
+ |
+ // Activates the item. |event_flags| holds flags of a mouse/keyboard event |
+ // associated with this activation. |
+ 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
|
+ |
+ // Changes icon and title for the model. |
+ void SetIcon(const SkBitmap& icon); |
+ void SetTitle(const std::string& title); |
+ |
+ void AddObserver(AppListItemModelObserver* observer); |
+ void RemoveObserver(AppListItemModelObserver* observer); |
+ |
+ const SkBitmap& icon() const { |
+ return icon_; |
+ } |
+ |
+ const std::string& title() const { |
+ return title_; |
+ } |
+ |
+ private: |
+ SkBitmap icon_; |
+ std::string title_; |
+ |
+ ObserverList<AppListItemModelObserver> observers_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AppListItemModel); |
+}; |
+ |
+} // namespace aura_shell |
+ |
+#endif // #define UI_AURA_SHELL_APP_LIST_APP_LIST_ITEM_MODEL_H_ |