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_item_model.h"
7 #include "base/logging.h"
8 #include "ui/app_list/app_list_item_model_observer.h"
12 AppListItemModel::AppListItemModel()
13 : highlighted_(false),
14 is_installing_(false),
15 percent_downloaded_(-1) {
18 AppListItemModel::~AppListItemModel() {
21 void AppListItemModel::SetIcon(const gfx::ImageSkia
& icon
, bool has_shadow
) {
23 has_shadow_
= has_shadow
;
24 FOR_EACH_OBSERVER(AppListItemModelObserver
, observers_
, ItemIconChanged());
27 void AppListItemModel::SetTitle(const std::string
& title
) {
32 FOR_EACH_OBSERVER(AppListItemModelObserver
, observers_
, ItemTitleChanged());
35 void AppListItemModel::SetHighlighted(bool highlighted
) {
36 if (highlighted_
== highlighted
)
39 highlighted_
= highlighted
;
40 FOR_EACH_OBSERVER(AppListItemModelObserver
,
42 ItemHighlightedChanged());
45 void AppListItemModel::SetIsInstalling(bool is_installing
) {
46 if (is_installing_
== is_installing
)
49 is_installing_
= is_installing
;
50 FOR_EACH_OBSERVER(AppListItemModelObserver
,
52 ItemIsInstallingChanged());
55 void AppListItemModel::SetPercentDownloaded(int percent_downloaded
) {
56 if (percent_downloaded_
== percent_downloaded
)
59 percent_downloaded_
= percent_downloaded
;
60 FOR_EACH_OBSERVER(AppListItemModelObserver
,
62 ItemPercentDownloadedChanged());
65 void AppListItemModel::AddObserver(AppListItemModelObserver
* observer
) {
66 observers_
.AddObserver(observer
);
69 void AppListItemModel::RemoveObserver(AppListItemModelObserver
* observer
) {
70 observers_
.RemoveObserver(observer
);
73 ui::MenuModel
* AppListItemModel::GetContextMenuModel() {
77 } // namespace app_list