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_MODEL_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_MODEL_H_ |
6 #define UI_APP_LIST_APP_LIST_MODEL_H_ | 6 #define UI_APP_LIST_APP_LIST_MODEL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 class APP_LIST_EXPORT AppListModel : public AppListItemListObserver { | 35 class APP_LIST_EXPORT AppListModel : public AppListItemListObserver { |
36 public: | 36 public: |
37 enum Status { | 37 enum Status { |
38 STATUS_NORMAL, | 38 STATUS_NORMAL, |
39 STATUS_SYNCING, // Syncing apps or installing synced apps. | 39 STATUS_SYNCING, // Syncing apps or installing synced apps. |
40 }; | 40 }; |
41 | 41 |
42 typedef ui::ListModel<SearchResult> SearchResults; | 42 typedef ui::ListModel<SearchResult> SearchResults; |
43 | 43 |
44 AppListModel(); | 44 AppListModel(); |
45 virtual ~AppListModel(); | 45 ~AppListModel() override; |
46 | 46 |
47 void AddObserver(AppListModelObserver* observer); | 47 void AddObserver(AppListModelObserver* observer); |
48 void RemoveObserver(AppListModelObserver* observer); | 48 void RemoveObserver(AppListModelObserver* observer); |
49 | 49 |
50 void SetStatus(Status status); | 50 void SetStatus(Status status); |
51 | 51 |
52 // Finds the item matching |id|. | 52 // Finds the item matching |id|. |
53 AppListItem* FindItem(const std::string& id); | 53 AppListItem* FindItem(const std::string& id); |
54 | 54 |
55 // Find a folder item matching |id|. | 55 // Find a folder item matching |id|. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 AppListItemList* top_level_item_list() { return top_level_item_list_.get(); } | 127 AppListItemList* top_level_item_list() { return top_level_item_list_.get(); } |
128 | 128 |
129 SearchBoxModel* search_box() { return search_box_.get(); } | 129 SearchBoxModel* search_box() { return search_box_.get(); } |
130 SearchResults* results() { return results_.get(); } | 130 SearchResults* results() { return results_.get(); } |
131 Status status() const { return status_; } | 131 Status status() const { return status_; } |
132 bool folders_enabled() const { return folders_enabled_; } | 132 bool folders_enabled() const { return folders_enabled_; } |
133 | 133 |
134 private: | 134 private: |
135 // AppListItemListObserver | 135 // AppListItemListObserver |
136 virtual void OnListItemMoved(size_t from_index, | 136 void OnListItemMoved(size_t from_index, |
137 size_t to_index, | 137 size_t to_index, |
138 AppListItem* item) override; | 138 AppListItem* item) override; |
139 | 139 |
140 // Returns an existing folder matching |folder_id| or creates a new folder. | 140 // Returns an existing folder matching |folder_id| or creates a new folder. |
141 AppListFolderItem* FindOrCreateFolderItem(const std::string& folder_id); | 141 AppListFolderItem* FindOrCreateFolderItem(const std::string& folder_id); |
142 | 142 |
143 // Adds |item_ptr| to |top_level_item_list_| and notifies observers. | 143 // Adds |item_ptr| to |top_level_item_list_| and notifies observers. |
144 AppListItem* AddItemToItemListAndNotify( | 144 AppListItem* AddItemToItemListAndNotify( |
145 scoped_ptr<AppListItem> item_ptr); | 145 scoped_ptr<AppListItem> item_ptr); |
146 | 146 |
147 // Adds |item_ptr| to |top_level_item_list_| and notifies observers that an | 147 // Adds |item_ptr| to |top_level_item_list_| and notifies observers that an |
148 // Update occured (e.g. item moved from a folder). | 148 // Update occured (e.g. item moved from a folder). |
(...skipping 22 matching lines...) Expand all Loading... |
171 Status status_; | 171 Status status_; |
172 ObserverList<AppListModelObserver, true> observers_; | 172 ObserverList<AppListModelObserver, true> observers_; |
173 bool folders_enabled_; | 173 bool folders_enabled_; |
174 | 174 |
175 DISALLOW_COPY_AND_ASSIGN(AppListModel); | 175 DISALLOW_COPY_AND_ASSIGN(AppListModel); |
176 }; | 176 }; |
177 | 177 |
178 } // namespace app_list | 178 } // namespace app_list |
179 | 179 |
180 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ | 180 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ |
OLD | NEW |