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

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

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 #include "ui/app_list/app_list_model.h" 5 #include "ui/app_list/app_list_model.h"
6 6
7 #include "ui/app_list/app_list_item_model.h" 7 #include "ui/app_list/app_list_item_model.h"
8 #include "ui/app_list/app_list_model_observer.h" 8 #include "ui/app_list/app_list_model_observer.h"
9 #include "ui/app_list/search_box_model.h" 9 #include "ui/app_list/search_box_model.h"
10 #include "ui/app_list/search_result.h" 10 #include "ui/app_list/search_result.h"
11 #include "ui/base/profile_selector/avatar_menu_item_model.h"
11 12
12 namespace app_list { 13 namespace app_list {
13 14
14 AppListModel::AppListModel() 15 AppListModel::AppListModel()
15 : apps_(new Apps), 16 : apps_(new Apps),
16 search_box_(new SearchBoxModel), 17 search_box_(new SearchBoxModel),
17 results_(new SearchResults), 18 results_(new SearchResults),
18 status_(STATUS_NORMAL) { 19 status_(STATUS_NORMAL),
20 signed_in_(false) {
19 } 21 }
20 22
21 AppListModel::~AppListModel() { 23 AppListModel::~AppListModel() {
24 STLDeleteElements(&profile_menu_items_);
22 } 25 }
23 26
24 void AppListModel::AddObserver(AppListModelObserver* observer) { 27 void AppListModel::AddObserver(AppListModelObserver* observer) {
25 observers_.AddObserver(observer); 28 observers_.AddObserver(observer);
26 } 29 }
27 30
28 void AppListModel::RemoveObserver(AppListModelObserver* observer) { 31 void AppListModel::RemoveObserver(AppListModelObserver* observer) {
29 observers_.RemoveObserver(observer); 32 observers_.RemoveObserver(observer);
30 } 33 }
31 34
32 void AppListModel::SetStatus(Status status) { 35 void AppListModel::SetStatus(Status status) {
33 if (status_ == status) 36 if (status_ == status)
34 return; 37 return;
35 38
36 status_ = status; 39 status_ = status;
37 FOR_EACH_OBSERVER(AppListModelObserver, 40 FOR_EACH_OBSERVER(AppListModelObserver,
38 observers_, 41 observers_,
39 OnAppListModelStatusChanged()); 42 OnAppListModelStatusChanged());
40 } 43 }
41 44
45 void AppListModel::SetCurrentUser(const base::string16& current_user_name,
46 const base::string16& current_user_email) {
47 current_user_name_ = current_user_name;
48 current_user_email_ = current_user_email;
49 FOR_EACH_OBSERVER(AppListModelObserver,
50 observers_,
51 OnAppListModelProfilesChanged());
52 }
53
54 void AppListModel::SetProfileMenuItems(
55 const ProfileMenuItems& profile_menu_items) {
56 STLDeleteElements(&profile_menu_items_);
57 profile_menu_items_ = profile_menu_items;
58 FOR_EACH_OBSERVER(AppListModelObserver,
59 observers_,
60 OnAppListModelProfilesChanged());
61 }
62
63 void AppListModel::SetSignedIn(bool signed_in) {
64 signed_in_ = signed_in;
65 FOR_EACH_OBSERVER(AppListModelObserver,
66 observers_,
67 OnAppListModelSigninStatusChanged());
68 }
69
42 } // namespace app_list 70 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698