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/search_result.h"
7 #include "ui/app_list/search_result_observer.h"
11 SearchResult::Action::Action(const gfx::ImageSkia
& base_image
,
12 const gfx::ImageSkia
& hover_image
,
13 const gfx::ImageSkia
& pressed_image
,
14 const base::string16
& tooltip_text
)
15 : base_image(base_image
),
16 hover_image(hover_image
),
17 pressed_image(pressed_image
),
18 tooltip_text(tooltip_text
) {}
20 SearchResult::Action::Action(const base::string16
& label_text
,
21 const base::string16
& tooltip_text
)
22 : tooltip_text(tooltip_text
),
23 label_text(label_text
) {}
25 SearchResult::Action::~Action() {}
27 SearchResult::SearchResult() : is_installing_(false), percent_downloaded_(0) {}
29 SearchResult::~SearchResult() {}
31 void SearchResult::SetIcon(const gfx::ImageSkia
& icon
) {
33 FOR_EACH_OBSERVER(SearchResultObserver
,
38 void SearchResult::SetActions(const Actions
& sets
) {
40 FOR_EACH_OBSERVER(SearchResultObserver
,
45 void SearchResult::SetIsInstalling(bool is_installing
) {
46 if (is_installing_
== is_installing
)
49 is_installing_
= is_installing
;
50 FOR_EACH_OBSERVER(SearchResultObserver
,
52 OnIsInstallingChanged());
55 void SearchResult::SetPercentDownloaded(int percent_downloaded
) {
56 if (percent_downloaded_
== percent_downloaded
)
59 percent_downloaded_
= percent_downloaded
;
60 FOR_EACH_OBSERVER(SearchResultObserver
,
62 OnPercentDownloadedChanged());
65 void SearchResult::NotifyItemInstalled() {
66 FOR_EACH_OBSERVER(SearchResultObserver
, observers_
, OnItemInstalled());
69 void SearchResult::NotifyItemUninstalled() {
70 FOR_EACH_OBSERVER(SearchResultObserver
, observers_
, OnItemUninstalled());
73 void SearchResult::AddObserver(SearchResultObserver
* observer
) {
74 observers_
.AddObserver(observer
);
77 void SearchResult::RemoveObserver(SearchResultObserver
* observer
) {
78 observers_
.RemoveObserver(observer
);
81 ui::MenuModel
* SearchResult::GetContextMenuModel() {
85 } // namespace app_list