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(const std::string& id)
15 is_installing_(false),
16 percent_downloaded_(-1) {
19 AppListItemModel::~AppListItemModel() {
22 void AppListItemModel::SetIcon(const gfx::ImageSkia& icon, bool has_shadow) {
24 has_shadow_ = has_shadow;
25 FOR_EACH_OBSERVER(AppListItemModelObserver, observers_, ItemIconChanged());
28 void AppListItemModel::SetTitleAndFullName(const std::string& title,
29 const std::string& full_name) {
30 if (title_ == title && full_name_ == full_name)
34 full_name_ = full_name;
35 FOR_EACH_OBSERVER(AppListItemModelObserver, observers_, ItemTitleChanged());
38 void AppListItemModel::SetHighlighted(bool highlighted) {
39 if (highlighted_ == highlighted)
42 highlighted_ = highlighted;
43 FOR_EACH_OBSERVER(AppListItemModelObserver,
45 ItemHighlightedChanged());
48 void AppListItemModel::SetIsInstalling(bool is_installing) {
49 if (is_installing_ == is_installing)
52 is_installing_ = is_installing;
53 FOR_EACH_OBSERVER(AppListItemModelObserver,
55 ItemIsInstallingChanged());
58 void AppListItemModel::SetPercentDownloaded(int percent_downloaded) {
59 if (percent_downloaded_ == percent_downloaded)
62 percent_downloaded_ = percent_downloaded;
63 FOR_EACH_OBSERVER(AppListItemModelObserver,
65 ItemPercentDownloadedChanged());
68 void AppListItemModel::AddObserver(AppListItemModelObserver* observer) {
69 observers_.AddObserver(observer);
72 void AppListItemModel::RemoveObserver(AppListItemModelObserver* observer) {
73 observers_.RemoveObserver(observer);
76 void AppListItemModel::Activate(int event_flags) {
79 const char* AppListItemModel::GetAppType() const {
80 static const char* app_type = "";
84 ui::MenuModel* AppListItemModel::GetContextMenuModel() {
88 } // namespace app_list