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
3 // found in the LICENSE file.
5 #include "ui/app_list/app_list_model.h"
7 #include "ui/app_list/app_list_item_model.h"
8 #include "ui/app_list/app_list_model_observer.h"
9 #include "ui/app_list/search_box_model.h"
10 #include "ui/app_list/search_result.h"
14 AppListModel::User::User() : active(false) {}
16 AppListModel::User::~User() {}
18 AppListModel::AppListModel()
19 : item_list_(new AppListItemList),
20 search_box_(new SearchBoxModel),
21 results_(new SearchResults),
23 status_(STATUS_NORMAL) {
26 AppListModel::~AppListModel() {
29 void AppListModel::AddObserver(AppListModelObserver* observer) {
30 observers_.AddObserver(observer);
33 void AppListModel::RemoveObserver(AppListModelObserver* observer) {
34 observers_.RemoveObserver(observer);
37 void AppListModel::SetStatus(Status status) {
38 if (status_ == status)
42 FOR_EACH_OBSERVER(AppListModelObserver,
44 OnAppListModelStatusChanged());
47 void AppListModel::SetUsers(const Users& users) {
49 FOR_EACH_OBSERVER(AppListModelObserver,
51 OnAppListModelUsersChanged());
54 void AppListModel::SetSignedIn(bool signed_in) {
55 if (signed_in_ == signed_in)
58 signed_in_ = signed_in;
59 FOR_EACH_OBSERVER(AppListModelObserver,
61 OnAppListModelSigninStatusChanged());
64 } // namespace app_list