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

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: rework Created 7 years, 4 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
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"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
10 #include "base/observer_list.h" 12 #include "base/observer_list.h"
11 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
12 #include "ui/app_list/app_list_export.h" 14 #include "ui/app_list/app_list_export.h"
13 #include "ui/base/models/list_model.h" 15 #include "ui/base/models/list_model.h"
14 16
17 namespace ui {
18 struct AvatarMenuItemModel;
19 }
20
15 namespace app_list { 21 namespace app_list {
16 22
17 class AppListItemModel; 23 class AppListItemModel;
18 class AppListModelObserver; 24 class AppListModelObserver;
19 class SearchBoxModel; 25 class SearchBoxModel;
20 class SearchResult; 26 class SearchResult;
21 27
22 // Master model of app list that consists of three sub models: Apps, 28 // Master model of app list that consists of three sub models: Apps,
23 // SearchBoxModel and SearchResults. The Apps sub model owns a list of 29 // SearchBoxModel and SearchResults. The Apps sub model owns a list of
24 // AppListItemModel and is displayed in the grid view. SearchBoxModel is 30 // AppListItemModel and is displayed in the grid view. SearchBoxModel is
25 // the model for SearchBoxView. SearchResults owns a list of SearchResult. 31 // the model for SearchBoxView. SearchResults owns a list of SearchResult.
26 class APP_LIST_EXPORT AppListModel { 32 class APP_LIST_EXPORT AppListModel {
27 public: 33 public:
28 enum Status { 34 enum Status {
29 STATUS_NORMAL, 35 STATUS_NORMAL,
30 STATUS_SYNCING, // Syncing apps or installing synced apps. 36 STATUS_SYNCING, // Syncing apps or installing synced apps.
31 }; 37 };
32 38
33 typedef ui::ListModel<AppListItemModel> Apps; 39 typedef ui::ListModel<AppListItemModel> Apps;
34 typedef ui::ListModel<SearchResult> SearchResults; 40 typedef ui::ListModel<SearchResult> SearchResults;
41 typedef std::vector<ui::AvatarMenuItemModel*> ProfileMenuItems;
35 42
36 AppListModel(); 43 AppListModel();
37 ~AppListModel(); 44 ~AppListModel();
38 45
39 void AddObserver(AppListModelObserver* observer); 46 void AddObserver(AppListModelObserver* observer);
40 void RemoveObserver(AppListModelObserver* observer); 47 void RemoveObserver(AppListModelObserver* observer);
41 48
42 void SetStatus(Status status); 49 void SetStatus(Status status);
43 void SetCurrentUser(const base::string16& current_user_name, 50 void SetCurrentUser(const base::string16& current_user_name,
44 const base::string16& current_user_email); 51 const base::string16& current_user_email);
52 void SetProfileMenuItems(const ProfileMenuItems& profile_menu_items);
45 void SetSignedIn(bool signed_in); 53 void SetSignedIn(bool signed_in);
46 54
47 Apps* apps() { return apps_.get(); } 55 Apps* apps() { return apps_.get(); }
48 SearchBoxModel* search_box() { return search_box_.get(); } 56 SearchBoxModel* search_box() { return search_box_.get(); }
49 SearchResults* results() { return results_.get(); } 57 SearchResults* results() { return results_.get(); }
50 Status status() const { return status_; } 58 Status status() const { return status_; }
51 bool signed_in() const { return signed_in_; } 59 bool signed_in() const { return signed_in_; }
60
61 const ProfileMenuItems& profile_menu_items() const {
62 return profile_menu_items_;
63 }
52 const base::string16& current_user_name() const { return current_user_name_; } 64 const base::string16& current_user_name() const { return current_user_name_; }
53 const base::string16& current_user_email() const { 65 const base::string16& current_user_email() const {
54 return current_user_email_; 66 return current_user_email_;
55 } 67 }
56 68
57 private: 69 private:
58 scoped_ptr<Apps> apps_; 70 scoped_ptr<Apps> apps_;
59 71
60 scoped_ptr<SearchBoxModel> search_box_; 72 scoped_ptr<SearchBoxModel> search_box_;
61 scoped_ptr<SearchResults> results_; 73 scoped_ptr<SearchResults> results_;
62 74
63 base::string16 current_user_name_; 75 base::string16 current_user_name_;
64 base::string16 current_user_email_; 76 base::string16 current_user_email_;
65 bool signed_in_; 77 bool signed_in_;
78 ProfileMenuItems profile_menu_items_;
66 79
67 Status status_; 80 Status status_;
68 ObserverList<AppListModelObserver> observers_; 81 ObserverList<AppListModelObserver> observers_;
69 82
70 DISALLOW_COPY_AND_ASSIGN(AppListModel); 83 DISALLOW_COPY_AND_ASSIGN(AppListModel);
71 }; 84 };
72 85
73 } // namespace app_list 86 } // namespace app_list
74 87
75 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ 88 #endif // UI_APP_LIST_APP_LIST_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698