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 "base/observer_list.h" |
11 #include "ui/app_list/app_list_export.h" | 11 #include "ui/app_list/app_list_export.h" |
12 #include "ui/app_list/app_list_item_list.h" | 12 #include "ui/app_list/app_list_item_list.h" |
13 #include "ui/base/models/list_model.h" | 13 #include "ui/base/models/list_model.h" |
14 | 14 |
15 namespace app_list { | 15 namespace app_list { |
16 | 16 |
17 class AppListItemList; | 17 class AppListItemList; |
18 class AppListItemModel; | 18 class AppListItemModel; |
19 class AppListModelObserver; | 19 class AppListModelObserver; |
20 class SearchBoxModel; | 20 class SearchBoxModel; |
21 class SearchResult; | 21 class SearchResult; |
22 class SpeechUIModel; | |
22 | 23 |
23 // Master model of app list that consists of three sub models: AppListItemList, | 24 // Master model of app list that consists of three sub models: AppListItemList, |
24 // SearchBoxModel and SearchResults. The AppListItemList sub model owns a list | 25 // SearchBoxModel and SearchResults. The AppListItemList sub model owns a list |
25 // of AppListItemModel and is displayed in the grid view. SearchBoxModel is | 26 // of AppListItemModel and is displayed in the grid view. SearchBoxModel is |
26 // the model for SearchBoxView. SearchResults owns a list of SearchResult. | 27 // the model for SearchBoxView. SearchResults owns a list of SearchResult. |
27 class APP_LIST_EXPORT AppListModel { | 28 class APP_LIST_EXPORT AppListModel { |
28 public: | 29 public: |
29 enum Status { | 30 enum Status { |
30 STATUS_NORMAL, | 31 STATUS_NORMAL, |
31 STATUS_SYNCING, // Syncing apps or installing synced apps. | 32 STATUS_SYNCING, // Syncing apps or installing synced apps. |
32 }; | 33 }; |
33 | 34 |
34 typedef ui::ListModel<SearchResult> SearchResults; | 35 typedef ui::ListModel<SearchResult> SearchResults; |
35 | 36 |
36 AppListModel(); | 37 AppListModel(); |
37 ~AppListModel(); | 38 ~AppListModel(); |
38 | 39 |
39 void AddObserver(AppListModelObserver* observer); | 40 void AddObserver(AppListModelObserver* observer); |
40 void RemoveObserver(AppListModelObserver* observer); | 41 void RemoveObserver(AppListModelObserver* observer); |
41 | 42 |
42 void SetStatus(Status status); | 43 void SetStatus(Status status); |
43 void SetSignedIn(bool signed_in); | 44 void SetSignedIn(bool signed_in); |
44 | 45 |
45 AppListItemList* item_list() { return item_list_.get(); } | 46 AppListItemList* item_list() { return item_list_.get(); } |
46 SearchBoxModel* search_box() { return search_box_.get(); } | 47 SearchBoxModel* search_box() { return search_box_.get(); } |
47 SearchResults* results() { return results_.get(); } | 48 SearchResults* results() { return results_.get(); } |
49 SpeechUIModel* speech_ui() { return speech_ui_.get(); } | |
48 Status status() const { return status_; } | 50 Status status() const { return status_; } |
49 bool signed_in() const { return signed_in_; } | 51 bool signed_in() const { return signed_in_; } |
50 | 52 |
51 private: | 53 private: |
52 scoped_ptr<AppListItemList> item_list_; | 54 scoped_ptr<AppListItemList> item_list_; |
53 scoped_ptr<SearchBoxModel> search_box_; | 55 scoped_ptr<SearchBoxModel> search_box_; |
54 scoped_ptr<SearchResults> results_; | 56 scoped_ptr<SearchResults> results_; |
57 scoped_ptr<SpeechUIModel> speech_ui_; | |
xiyuan
2013/12/05 22:06:30
Think we should put SpeechUIModel as a member of A
Jun Mukai
2013/12/06 00:31:10
Done.
| |
55 | 58 |
56 bool signed_in_; | 59 bool signed_in_; |
57 Status status_; | 60 Status status_; |
58 ObserverList<AppListModelObserver> observers_; | 61 ObserverList<AppListModelObserver> observers_; |
59 | 62 |
60 DISALLOW_COPY_AND_ASSIGN(AppListModel); | 63 DISALLOW_COPY_AND_ASSIGN(AppListModel); |
61 }; | 64 }; |
62 | 65 |
63 } // namespace app_list | 66 } // namespace app_list |
64 | 67 |
65 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ | 68 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ |
OLD | NEW |