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

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

Issue 12208040: [win] Add a progress bar in the app launcher for app installs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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_item_model.h" 5 #include "ui/app_list/app_list_item_model.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/app_list/app_list_item_model_observer.h" 8 #include "ui/app_list/app_list_item_model_observer.h"
9 9
10 namespace app_list { 10 namespace app_list {
11 11
12 AppListItemModel::AppListItemModel() : highlighted_(false) { 12 AppListItemModel::AppListItemModel()
13 : highlighted_(false),
14 is_installing_(false),
15 percent_downloaded_(-1) {
13 } 16 }
14 17
15 AppListItemModel::~AppListItemModel() { 18 AppListItemModel::~AppListItemModel() {
16 } 19 }
17 20
18 void AppListItemModel::SetIcon(const gfx::ImageSkia& icon) { 21 void AppListItemModel::SetIcon(const gfx::ImageSkia& icon) {
19 icon_ = icon; 22 icon_ = icon;
20 FOR_EACH_OBSERVER(AppListItemModelObserver, observers_, ItemIconChanged()); 23 FOR_EACH_OBSERVER(AppListItemModelObserver, observers_, ItemIconChanged());
21 } 24 }
22 25
23 void AppListItemModel::SetTitle(const std::string& title) { 26 void AppListItemModel::SetTitle(const std::string& title) {
24 if (title_ == title) 27 if (title_ == title)
25 return; 28 return;
26 29
27 title_ = title; 30 title_ = title;
28 FOR_EACH_OBSERVER(AppListItemModelObserver, observers_, ItemTitleChanged()); 31 FOR_EACH_OBSERVER(AppListItemModelObserver, observers_, ItemTitleChanged());
29 } 32 }
30 33
31 void AppListItemModel::SetHighlighted(bool highlighted) { 34 void AppListItemModel::SetHighlighted(bool highlighted) {
32 if (highlighted_ == highlighted) 35 if (highlighted_ == highlighted)
33 return; 36 return;
34 37
35 highlighted_ = highlighted; 38 highlighted_ = highlighted;
36 FOR_EACH_OBSERVER(AppListItemModelObserver, 39 FOR_EACH_OBSERVER(AppListItemModelObserver,
37 observers_, 40 observers_,
38 ItemHighlightedChanged()); 41 ItemHighlightedChanged());
39 } 42 }
40 43
44 void AppListItemModel::SetIsInstalling(bool is_installing) {
45 if (is_installing_ == is_installing)
46 return;
47 is_installing_ = is_installing;
48 FOR_EACH_OBSERVER(AppListItemModelObserver,
49 observers_,
50 ItemIsInstallingChanged());
51 }
52
53 void AppListItemModel::SetPercentDownloaded(int percent_downloaded) {
54 if (percent_downloaded_ == percent_downloaded)
55 return;
56 percent_downloaded_ = percent_downloaded;
57 FOR_EACH_OBSERVER(AppListItemModelObserver,
58 observers_,
59 ItemPercentDownloadedChanged());
60 }
61
41 void AppListItemModel::AddObserver(AppListItemModelObserver* observer) { 62 void AppListItemModel::AddObserver(AppListItemModelObserver* observer) {
42 observers_.AddObserver(observer); 63 observers_.AddObserver(observer);
43 } 64 }
44 65
45 void AppListItemModel::RemoveObserver(AppListItemModelObserver* observer) { 66 void AppListItemModel::RemoveObserver(AppListItemModelObserver* observer) {
46 observers_.RemoveObserver(observer); 67 observers_.RemoveObserver(observer);
47 } 68 }
48 69
49 ui::MenuModel* AppListItemModel::GetContextMenuModel() { 70 ui::MenuModel* AppListItemModel::GetContextMenuModel() {
50 return NULL; 71 return NULL;
51 } 72 }
52 73
53 } // namespace app_list 74 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698