Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(916)

Side by Side Diff: ui/app_list/app_list_model.h

Issue 63283003: Move AppListModel::Users to AppListViewDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac fixes Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/app_list/app_list_menu.cc ('k') | ui/app_list/app_list_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector>
9
10 #include "base/basictypes.h" 8 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h" 10 #include "base/observer_list.h"
14 #include "base/strings/string16.h"
15 #include "ui/app_list/app_list_export.h" 11 #include "ui/app_list/app_list_export.h"
16 #include "ui/app_list/app_list_item_list.h" 12 #include "ui/app_list/app_list_item_list.h"
17 #include "ui/base/models/list_model.h" 13 #include "ui/base/models/list_model.h"
18 14
19 namespace app_list { 15 namespace app_list {
20 16
21 class AppListItemList; 17 class AppListItemList;
22 class AppListItemModel; 18 class AppListItemModel;
23 class AppListModelObserver; 19 class AppListModelObserver;
24 class SearchBoxModel; 20 class SearchBoxModel;
25 class SearchResult; 21 class SearchResult;
26 22
27 // Master model of app list that consists of three sub models: AppListItemList, 23 // Master model of app list that consists of three sub models: AppListItemList,
28 // SearchBoxModel and SearchResults. The AppListItemList sub model owns a list 24 // SearchBoxModel and SearchResults. The AppListItemList sub model owns a list
29 // of AppListItemModel and is displayed in the grid view. SearchBoxModel is 25 // of AppListItemModel and is displayed in the grid view. SearchBoxModel is
30 // the model for SearchBoxView. SearchResults owns a list of SearchResult. 26 // the model for SearchBoxView. SearchResults owns a list of SearchResult.
31 class APP_LIST_EXPORT AppListModel { 27 class APP_LIST_EXPORT AppListModel {
32 public: 28 public:
33 // A user of the app list.
34 struct APP_LIST_EXPORT User {
35 User();
36 ~User();
37
38 // Whether or not this user is the current user of the app list.
39 bool active;
40
41 // The name of this user.
42 base::string16 name;
43
44 // The email address of this user.
45 base::string16 email;
46
47 // The path to this user's profile directory.
48 base::FilePath profile_path;
49 };
50
51 enum Status { 29 enum Status {
52 STATUS_NORMAL, 30 STATUS_NORMAL,
53 STATUS_SYNCING, // Syncing apps or installing synced apps. 31 STATUS_SYNCING, // Syncing apps or installing synced apps.
54 }; 32 };
55 33
56 typedef ui::ListModel<SearchResult> SearchResults; 34 typedef ui::ListModel<SearchResult> SearchResults;
57 typedef std::vector<User> Users;
58 35
59 AppListModel(); 36 AppListModel();
60 ~AppListModel(); 37 ~AppListModel();
61 38
62 void AddObserver(AppListModelObserver* observer); 39 void AddObserver(AppListModelObserver* observer);
63 void RemoveObserver(AppListModelObserver* observer); 40 void RemoveObserver(AppListModelObserver* observer);
64 41
65 void SetStatus(Status status); 42 void SetStatus(Status status);
66 void SetUsers(const Users& profile_menu_items);
67 void SetSignedIn(bool signed_in); 43 void SetSignedIn(bool signed_in);
68 44
69 AppListItemList* item_list() { return item_list_.get(); } 45 AppListItemList* item_list() { return item_list_.get(); }
70 SearchBoxModel* search_box() { return search_box_.get(); } 46 SearchBoxModel* search_box() { return search_box_.get(); }
71 SearchResults* results() { return results_.get(); } 47 SearchResults* results() { return results_.get(); }
72 Status status() const { return status_; } 48 Status status() const { return status_; }
73 bool signed_in() const { return signed_in_; } 49 bool signed_in() const { return signed_in_; }
74 50
75 const Users& users() const {
76 return users_;
77 }
78
79 private: 51 private:
80 scoped_ptr<AppListItemList> item_list_; 52 scoped_ptr<AppListItemList> item_list_;
81 scoped_ptr<SearchBoxModel> search_box_; 53 scoped_ptr<SearchBoxModel> search_box_;
82 scoped_ptr<SearchResults> results_; 54 scoped_ptr<SearchResults> results_;
83 55
84 Users users_;
85
86 bool signed_in_; 56 bool signed_in_;
87 Status status_; 57 Status status_;
88 ObserverList<AppListModelObserver> observers_; 58 ObserverList<AppListModelObserver> observers_;
89 59
90 DISALLOW_COPY_AND_ASSIGN(AppListModel); 60 DISALLOW_COPY_AND_ASSIGN(AppListModel);
91 }; 61 };
92 62
93 } // namespace app_list 63 } // namespace app_list
94 64
95 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ 65 #endif // UI_APP_LIST_APP_LIST_MODEL_H_
OLDNEW
« no previous file with comments | « ui/app_list/app_list_menu.cc ('k') | ui/app_list/app_list_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698