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

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

Issue 20656002: Add profile selector menu to app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove binary changes Created 7 years, 3 months 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
« 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
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
10 #include "base/observer_list.h" 13 #include "base/observer_list.h"
11 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
12 #include "ui/app_list/app_list_export.h" 15 #include "ui/app_list/app_list_export.h"
13 #include "ui/base/models/list_model.h" 16 #include "ui/base/models/list_model.h"
14 17
15 namespace app_list { 18 namespace app_list {
16 19
17 class AppListItemModel; 20 class AppListItemModel;
18 class AppListModelObserver; 21 class AppListModelObserver;
19 class SearchBoxModel; 22 class SearchBoxModel;
20 class SearchResult; 23 class SearchResult;
21 24
22 // Master model of app list that consists of three sub models: Apps, 25 // Master model of app list that consists of three sub models: Apps,
23 // SearchBoxModel and SearchResults. The Apps sub model owns a list of 26 // SearchBoxModel and SearchResults. The Apps sub model owns a list of
24 // AppListItemModel and is displayed in the grid view. SearchBoxModel is 27 // AppListItemModel and is displayed in the grid view. SearchBoxModel is
25 // the model for SearchBoxView. SearchResults owns a list of SearchResult. 28 // the model for SearchBoxView. SearchResults owns a list of SearchResult.
26 class APP_LIST_EXPORT AppListModel { 29 class APP_LIST_EXPORT AppListModel {
27 public: 30 public:
31 // A user of the app list.
32 struct APP_LIST_EXPORT User {
33 User();
34 ~User();
35
36 // Whether or not this user is the current user of the app list.
37 bool active;
38
39 // The name of this user.
40 base::string16 name;
41
42 // The email address of this user.
43 base::string16 email;
44
45 // The path to this user's profile directory.
46 base::FilePath profile_path;
47 };
48
28 enum Status { 49 enum Status {
29 STATUS_NORMAL, 50 STATUS_NORMAL,
30 STATUS_SYNCING, // Syncing apps or installing synced apps. 51 STATUS_SYNCING, // Syncing apps or installing synced apps.
31 }; 52 };
32 53
33 typedef ui::ListModel<AppListItemModel> Apps; 54 typedef ui::ListModel<AppListItemModel> Apps;
34 typedef ui::ListModel<SearchResult> SearchResults; 55 typedef ui::ListModel<SearchResult> SearchResults;
56 typedef std::vector<User> Users;
35 57
36 AppListModel(); 58 AppListModel();
37 ~AppListModel(); 59 ~AppListModel();
38 60
39 void AddObserver(AppListModelObserver* observer); 61 void AddObserver(AppListModelObserver* observer);
40 void RemoveObserver(AppListModelObserver* observer); 62 void RemoveObserver(AppListModelObserver* observer);
41 63
42 void SetStatus(Status status); 64 void SetStatus(Status status);
43 void SetCurrentUser(const base::string16& current_user_name, 65 void SetUsers(const Users& profile_menu_items);
44 const base::string16& current_user_email);
45 void SetSignedIn(bool signed_in); 66 void SetSignedIn(bool signed_in);
46 67
47 Apps* apps() { return apps_.get(); } 68 Apps* apps() { return apps_.get(); }
48 SearchBoxModel* search_box() { return search_box_.get(); } 69 SearchBoxModel* search_box() { return search_box_.get(); }
49 SearchResults* results() { return results_.get(); } 70 SearchResults* results() { return results_.get(); }
50 Status status() const { return status_; } 71 Status status() const { return status_; }
51 bool signed_in() const { return signed_in_; } 72 bool signed_in() const { return signed_in_; }
52 const base::string16& current_user_name() const { return current_user_name_; } 73
53 const base::string16& current_user_email() const { 74 const Users& users() const {
54 return current_user_email_; 75 return users_;
55 } 76 }
56 77
57 private: 78 private:
58 scoped_ptr<Apps> apps_; 79 scoped_ptr<Apps> apps_;
59 80
60 scoped_ptr<SearchBoxModel> search_box_; 81 scoped_ptr<SearchBoxModel> search_box_;
61 scoped_ptr<SearchResults> results_; 82 scoped_ptr<SearchResults> results_;
62 83
63 base::string16 current_user_name_; 84 Users users_;
64 base::string16 current_user_email_; 85
65 bool signed_in_; 86 bool signed_in_;
66
67 Status status_; 87 Status status_;
68 ObserverList<AppListModelObserver> observers_; 88 ObserverList<AppListModelObserver> observers_;
69 89
70 DISALLOW_COPY_AND_ASSIGN(AppListModel); 90 DISALLOW_COPY_AND_ASSIGN(AppListModel);
71 }; 91 };
72 92
73 } // namespace app_list 93 } // namespace app_list
74 94
75 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ 95 #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