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

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

Powered by Google App Engine
This is Rietveld 408576698