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

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 junk from list_model.h 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);
53 void SetSignedIn(bool signed_in);
42 54
43 Apps* apps() { return apps_.get(); } 55 Apps* apps() { return apps_.get(); }
44 SearchBoxModel* search_box() { return search_box_.get(); } 56 SearchBoxModel* search_box() { return search_box_.get(); }
45 SearchResults* results() { return results_.get(); } 57 SearchResults* results() { return results_.get(); }
46 Status status() const { return status_; } 58 Status status() const { return status_; }
59 bool signed_in() const { return signed_in_; }
60
61 const string16& current_user_name() const { return current_user_name_; }
tapted 2013/08/05 03:01:39 nit: base:: prefix on string16
calamity 2013/08/08 04:52:12 Done.
62 const string16& current_user_email() const { return current_user_email_; }
63
64 const ProfileMenuItems& profile_menu_items() {
tapted 2013/08/05 03:01:39 nit: const qualifier on member function?
calamity 2013/08/08 04:52:12 Done.
65 return profile_menu_items_;
66 }
47 67
48 private: 68 private:
49 scoped_ptr<Apps> apps_; 69 scoped_ptr<Apps> apps_;
50 70
51 scoped_ptr<SearchBoxModel> search_box_; 71 scoped_ptr<SearchBoxModel> search_box_;
52 scoped_ptr<SearchResults> results_; 72 scoped_ptr<SearchResults> results_;
53 73
74 string16 current_user_name_;
75 string16 current_user_email_;
76 ProfileMenuItems profile_menu_items_;
77 bool signed_in_;
78
54 Status status_; 79 Status status_;
55 ObserverList<AppListModelObserver> observers_; 80 ObserverList<AppListModelObserver> observers_;
56 81
57 DISALLOW_COPY_AND_ASSIGN(AppListModel); 82 DISALLOW_COPY_AND_ASSIGN(AppListModel);
58 }; 83 };
59 84
60 } // namespace app_list 85 } // namespace app_list
61 86
62 #endif // UI_APP_LIST_APP_LIST_MODEL_H_ 87 #endif // UI_APP_LIST_APP_LIST_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698