Hide X11 dependencies when use_x11=0.
[chromium-blink-merge.git] / ui / app_list / search_result.cc
blobcf908300ea319d981e426afa410922201585167e
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"
9 namespace app_list {
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) {
32 icon_ = icon;
33 FOR_EACH_OBSERVER(SearchResultObserver,
34 observers_,
35 OnIconChanged());
38 void SearchResult::SetActions(const Actions& sets) {
39 actions_ = sets;
40 FOR_EACH_OBSERVER(SearchResultObserver,
41 observers_,
42 OnActionsChanged());
45 void SearchResult::SetIsInstalling(bool is_installing) {
46 if (is_installing_ == is_installing)
47 return;
49 is_installing_ = is_installing;
50 FOR_EACH_OBSERVER(SearchResultObserver,
51 observers_,
52 OnIsInstallingChanged());
55 void SearchResult::SetPercentDownloaded(int percent_downloaded) {
56 if (percent_downloaded_ == percent_downloaded)
57 return;
59 percent_downloaded_ = percent_downloaded;
60 FOR_EACH_OBSERVER(SearchResultObserver,
61 observers_,
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() {
82 return NULL;
85 } // namespace app_list