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()
28 : relevance_(0), is_installing_(false), percent_downloaded_(0) {
31 SearchResult::~SearchResult() {}
33 void SearchResult::SetIcon(const gfx::ImageSkia
& icon
) {
35 FOR_EACH_OBSERVER(SearchResultObserver
,
40 void SearchResult::SetActions(const Actions
& sets
) {
42 FOR_EACH_OBSERVER(SearchResultObserver
,
47 void SearchResult::SetIsInstalling(bool is_installing
) {
48 if (is_installing_
== is_installing
)
51 is_installing_
= is_installing
;
52 FOR_EACH_OBSERVER(SearchResultObserver
,
54 OnIsInstallingChanged());
57 void SearchResult::SetPercentDownloaded(int percent_downloaded
) {
58 if (percent_downloaded_
== percent_downloaded
)
61 percent_downloaded_
= percent_downloaded
;
62 FOR_EACH_OBSERVER(SearchResultObserver
,
64 OnPercentDownloadedChanged());
67 void SearchResult::NotifyItemInstalled() {
68 FOR_EACH_OBSERVER(SearchResultObserver
, observers_
, OnItemInstalled());
71 void SearchResult::NotifyItemUninstalled() {
72 FOR_EACH_OBSERVER(SearchResultObserver
, observers_
, OnItemUninstalled());
75 void SearchResult::AddObserver(SearchResultObserver
* observer
) {
76 observers_
.AddObserver(observer
);
79 void SearchResult::RemoveObserver(SearchResultObserver
* observer
) {
80 observers_
.RemoveObserver(observer
);
83 void SearchResult::Open(int event_flags
) {
86 void SearchResult::InvokeAction(int action_index
, int event_flags
) {
89 ui::MenuModel
* SearchResult::GetContextMenuModel() {
93 } // namespace app_list