| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_AURA_SHELL_LAUNCHER_MODEL_H_ | 5 #ifndef UI_AURA_SHELL_LAUNCHER_MODEL_H_ |
| 6 #define UI_AURA_SHELL_LAUNCHER_MODEL_H_ | 6 #define UI_AURA_SHELL_LAUNCHER_MODEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "ui/aura_shell/aura_shell_export.h" | 12 #include "ui/aura_shell/aura_shell_export.h" |
| 13 #include "ui/aura_shell/launcher/launcher_types.h" | 13 #include "ui/aura_shell/launcher/launcher_types.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace aura { |
| 16 class View; | 16 class Window; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace aura_shell { | 19 namespace aura_shell { |
| 20 | 20 |
| 21 class LauncherModelObserver; | 21 class LauncherModelObserver; |
| 22 | 22 |
| 23 // Model used by LauncherView. | 23 // Model used by LauncherView. |
| 24 class AURA_SHELL_EXPORT LauncherModel { | 24 class AURA_SHELL_EXPORT LauncherModel { |
| 25 public: | 25 public: |
| 26 LauncherModel(); | 26 LauncherModel(); |
| 27 ~LauncherModel(); | 27 ~LauncherModel(); |
| 28 | 28 |
| 29 // Adds a new item to the model. | 29 // Adds a new item to the model. |
| 30 void Add(int index, const LauncherItem& item); | 30 void Add(int index, const LauncherItem& item); |
| 31 | 31 |
| 32 // Removes the item at |index|. | 32 // Removes the item at |index|. |
| 33 void RemoveItemAt(int index); | 33 void RemoveItemAt(int index); |
| 34 | 34 |
| 35 // Changes the images of the specified item. | 35 // Changes the images of the specified item. |
| 36 void SetTabbedImages(int index, const LauncherTabbedImages& images); | 36 void SetTabbedImages(int index, const LauncherTabbedImages& images); |
| 37 void SetAppImage(int index, const SkBitmap& image); | 37 void SetAppImage(int index, const SkBitmap& image); |
| 38 | 38 |
| 39 // Returns the index of the item with the specified window. |
| 40 int ItemIndexByWindow(aura::Window* window); |
| 41 |
| 42 LauncherItems::const_iterator ItemByWindow(aura::Window* window) const; |
| 43 |
| 39 const LauncherItems& items() const { return items_; } | 44 const LauncherItems& items() const { return items_; } |
| 40 int item_count() const { return static_cast<int>(items_.size()); } | 45 int item_count() const { return static_cast<int>(items_.size()); } |
| 41 | 46 |
| 42 void AddObserver(LauncherModelObserver* observer); | 47 void AddObserver(LauncherModelObserver* observer); |
| 43 void RemoveObserver(LauncherModelObserver* observer); | 48 void RemoveObserver(LauncherModelObserver* observer); |
| 44 | 49 |
| 45 private: | 50 private: |
| 46 LauncherItems items_; | 51 LauncherItems items_; |
| 47 ObserverList<LauncherModelObserver> observers_; | 52 ObserverList<LauncherModelObserver> observers_; |
| 48 | 53 |
| 49 DISALLOW_COPY_AND_ASSIGN(LauncherModel); | 54 DISALLOW_COPY_AND_ASSIGN(LauncherModel); |
| 50 }; | 55 }; |
| 51 | 56 |
| 52 } // namespace aura_shell | 57 } // namespace aura_shell |
| 53 | 58 |
| 54 #endif // UI_AURA_SHELL_LAUNCHER_MODEL_H_ | 59 #endif // UI_AURA_SHELL_LAUNCHER_MODEL_H_ |
| OLD | NEW |