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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/observer_list.h" |
10 #include "ui/app_list/app_list_export.h" | 11 #include "ui/app_list/app_list_export.h" |
11 #include "ui/base/models/list_model.h" | 12 #include "ui/base/models/list_model.h" |
12 | 13 |
13 namespace app_list { | 14 namespace app_list { |
14 | 15 |
15 class AppListItemModel; | 16 class AppListItemModel; |
| 17 class AppListModelObserver; |
16 class SearchBoxModel; | 18 class SearchBoxModel; |
17 class SearchResult; | 19 class SearchResult; |
18 | 20 |
19 // Master model of app list that consists of three sub models: Apps, | 21 // Master model of app list that consists of three sub models: Apps, |
20 // SearchBoxModel and SearchResults. The Apps sub model owns a list of | 22 // SearchBoxModel and SearchResults. The Apps sub model owns a list of |
21 // AppListItemModel and is displayed in the grid view. SearchBoxModel is | 23 // AppListItemModel and is displayed in the grid view. SearchBoxModel is |
22 // the model for SearchBoxView. SearchResults owns a list of SearchResult. | 24 // the model for SearchBoxView. SearchResults owns a list of SearchResult. |
23 class APP_LIST_EXPORT AppListModel { | 25 class APP_LIST_EXPORT AppListModel { |
24 public: | 26 public: |
| 27 enum Status { |
| 28 STATUS_NORMAL, |
| 29 STATUS_SYNCING, // Syncing apps or installing synced apps. |
| 30 }; |
| 31 |
25 typedef ui::ListModel<AppListItemModel> Apps; | 32 typedef ui::ListModel<AppListItemModel> Apps; |
26 typedef ui::ListModel<SearchResult> SearchResults; | 33 typedef ui::ListModel<SearchResult> SearchResults; |
27 | 34 |
28 AppListModel(); | 35 AppListModel(); |
29 ~AppListModel(); | 36 ~AppListModel(); |
30 | 37 |
| 38 void AddObserver(AppListModelObserver* observer); |
| 39 void RemoveObserver(AppListModelObserver* observer); |
| 40 |
| 41 void SetStatus(Status status); |
| 42 |
31 Apps* apps() { return apps_.get(); } | 43 Apps* apps() { return apps_.get(); } |
32 SearchBoxModel* search_box() { return search_box_.get(); } | 44 SearchBoxModel* search_box() { return search_box_.get(); } |
33 SearchResults* results() { return results_.get(); } | 45 SearchResults* results() { return results_.get(); } |
| 46 Status status() const { return status_; } |
34 | 47 |
35 private: | 48 private: |
36 scoped_ptr<Apps> apps_; | 49 scoped_ptr<Apps> apps_; |
37 | 50 |
38 scoped_ptr<SearchBoxModel> search_box_; | 51 scoped_ptr<SearchBoxModel> search_box_; |
39 scoped_ptr<SearchResults> results_; | 52 scoped_ptr<SearchResults> results_; |
40 | 53 |
| 54 Status status_; |
| 55 ObserverList<AppListModelObserver> observers_; |
| 56 |
41 DISALLOW_COPY_AND_ASSIGN(AppListModel); | 57 DISALLOW_COPY_AND_ASSIGN(AppListModel); |
42 }; | 58 }; |
43 | 59 |
44 } // namespace app_list | 60 } // namespace app_list |
45 | 61 |
46 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ | 62 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ |
OLD | NEW |