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

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

Issue 22268009: Move signin status and current user information into AppListModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 11
12 namespace app_list { 12 namespace app_list {
13 13
14 AppListModel::AppListModel() 14 AppListModel::AppListModel()
15 : apps_(new Apps), 15 : apps_(new Apps),
16 search_box_(new SearchBoxModel), 16 search_box_(new SearchBoxModel),
17 results_(new SearchResults), 17 results_(new SearchResults),
18 status_(STATUS_NORMAL) { 18 status_(STATUS_NORMAL),
19 signed_in_(false) {
tapted 2013/08/06 09:27:50 This should be initialized before `status_` to mat
calamity 2013/08/08 01:34:58 Done.
19 } 20 }
20 21
21 AppListModel::~AppListModel() { 22 AppListModel::~AppListModel() {
22 } 23 }
23 24
24 void AppListModel::AddObserver(AppListModelObserver* observer) { 25 void AppListModel::AddObserver(AppListModelObserver* observer) {
25 observers_.AddObserver(observer); 26 observers_.AddObserver(observer);
26 } 27 }
27 28
28 void AppListModel::RemoveObserver(AppListModelObserver* observer) { 29 void AppListModel::RemoveObserver(AppListModelObserver* observer) {
29 observers_.RemoveObserver(observer); 30 observers_.RemoveObserver(observer);
30 } 31 }
31 32
32 void AppListModel::SetStatus(Status status) { 33 void AppListModel::SetStatus(Status status) {
33 if (status_ == status) 34 if (status_ == status)
34 return; 35 return;
35 36
36 status_ = status; 37 status_ = status;
37 FOR_EACH_OBSERVER(AppListModelObserver, 38 FOR_EACH_OBSERVER(AppListModelObserver,
38 observers_, 39 observers_,
39 OnAppListModelStatusChanged()); 40 OnAppListModelStatusChanged());
40 } 41 }
41 42
43 void AppListModel::SetCurrentUser(const base::string16& current_user_name,
44 const base::string16& current_user_email) {
45 current_user_name_ = current_user_name;
46 current_user_email_ = current_user_email;
47 FOR_EACH_OBSERVER(AppListModelObserver,
48 observers_,
49 OnAppListModelProfilesChanged());
koz (OOO until 15th September) 2013/08/06 08:14:42 OnCurrentUserChanged()?
calamity 2013/08/08 01:34:58 Done.
50 }
51
52 void AppListModel::SetSignedIn(bool signed_in) {
53 signed_in_ = signed_in;
54 FOR_EACH_OBSERVER(AppListModelObserver,
55 observers_,
56 OnAppListModelSigninStatusChanged());
57 }
58
42 } // namespace app_list 59 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698