app_list_model.cc revision 68043e1e95eeb07d5cae7aca370b26518b0867d6
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. 4 5#include "ui/app_list/app_list_model.h" 6 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" 11 12namespace app_list { 13 14AppListModel::User::User() : active(false) {} 15 16AppListModel::User::~User() {} 17 18AppListModel::AppListModel() 19 : apps_(new Apps), 20 search_box_(new SearchBoxModel), 21 results_(new SearchResults), 22 signed_in_(false), 23 status_(STATUS_NORMAL) { 24} 25 26AppListModel::~AppListModel() { 27} 28 29void AppListModel::AddObserver(AppListModelObserver* observer) { 30 observers_.AddObserver(observer); 31} 32 33void AppListModel::RemoveObserver(AppListModelObserver* observer) { 34 observers_.RemoveObserver(observer); 35} 36 37void AppListModel::SetStatus(Status status) { 38 if (status_ == status) 39 return; 40 41 status_ = status; 42 FOR_EACH_OBSERVER(AppListModelObserver, 43 observers_, 44 OnAppListModelStatusChanged()); 45} 46 47void AppListModel::SetUsers(const Users& users) { 48 users_ = users; 49 FOR_EACH_OBSERVER(AppListModelObserver, 50 observers_, 51 OnAppListModelUsersChanged()); 52} 53 54void AppListModel::SetSignedIn(bool signed_in) { 55 if (signed_in_ == signed_in) 56 return; 57 58 signed_in_ = signed_in; 59 FOR_EACH_OBSERVER(AppListModelObserver, 60 observers_, 61 OnAppListModelSigninStatusChanged()); 62} 63 64} // namespace app_list 65