OLD | NEW |
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/search_result.h" | 5 #include "ui/app_list/search_result.h" |
6 | 6 |
| 7 #include "ui/app_list/app_list_constants.h" |
7 #include "ui/app_list/search_result_observer.h" | 8 #include "ui/app_list/search_result_observer.h" |
8 | 9 |
9 namespace app_list { | 10 namespace app_list { |
10 | 11 |
11 SearchResult::Action::Action(const gfx::ImageSkia& base_image, | 12 SearchResult::Action::Action(const gfx::ImageSkia& base_image, |
12 const gfx::ImageSkia& hover_image, | 13 const gfx::ImageSkia& hover_image, |
13 const gfx::ImageSkia& pressed_image, | 14 const gfx::ImageSkia& pressed_image, |
14 const base::string16& tooltip_text) | 15 const base::string16& tooltip_text) |
15 : base_image(base_image), | 16 : base_image(base_image), |
16 hover_image(hover_image), | 17 hover_image(hover_image), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void SearchResult::SetPercentDownloaded(int percent_downloaded) { | 61 void SearchResult::SetPercentDownloaded(int percent_downloaded) { |
61 if (percent_downloaded_ == percent_downloaded) | 62 if (percent_downloaded_ == percent_downloaded) |
62 return; | 63 return; |
63 | 64 |
64 percent_downloaded_ = percent_downloaded; | 65 percent_downloaded_ = percent_downloaded; |
65 FOR_EACH_OBSERVER(SearchResultObserver, | 66 FOR_EACH_OBSERVER(SearchResultObserver, |
66 observers_, | 67 observers_, |
67 OnPercentDownloadedChanged()); | 68 OnPercentDownloadedChanged()); |
68 } | 69 } |
69 | 70 |
| 71 int SearchResult::GetPreferredIconDimension() const { |
| 72 switch (display_type_) { |
| 73 case DISPLAY_TILE: |
| 74 return kTileIconSize; |
| 75 case DISPLAY_LIST: |
| 76 return kListIconSize; |
| 77 } |
| 78 NOTREACHED(); |
| 79 return 0; |
| 80 } |
| 81 |
70 void SearchResult::NotifyItemInstalled() { | 82 void SearchResult::NotifyItemInstalled() { |
71 FOR_EACH_OBSERVER(SearchResultObserver, observers_, OnItemInstalled()); | 83 FOR_EACH_OBSERVER(SearchResultObserver, observers_, OnItemInstalled()); |
72 } | 84 } |
73 | 85 |
74 void SearchResult::NotifyItemUninstalled() { | 86 void SearchResult::NotifyItemUninstalled() { |
75 FOR_EACH_OBSERVER(SearchResultObserver, observers_, OnItemUninstalled()); | 87 FOR_EACH_OBSERVER(SearchResultObserver, observers_, OnItemUninstalled()); |
76 } | 88 } |
77 | 89 |
78 void SearchResult::AddObserver(SearchResultObserver* observer) { | 90 void SearchResult::AddObserver(SearchResultObserver* observer) { |
79 observers_.AddObserver(observer); | 91 observers_.AddObserver(observer); |
80 } | 92 } |
81 | 93 |
82 void SearchResult::RemoveObserver(SearchResultObserver* observer) { | 94 void SearchResult::RemoveObserver(SearchResultObserver* observer) { |
83 observers_.RemoveObserver(observer); | 95 observers_.RemoveObserver(observer); |
84 } | 96 } |
85 | 97 |
86 void SearchResult::Open(int event_flags) { | 98 void SearchResult::Open(int event_flags) { |
87 } | 99 } |
88 | 100 |
89 void SearchResult::InvokeAction(int action_index, int event_flags) { | 101 void SearchResult::InvokeAction(int action_index, int event_flags) { |
90 } | 102 } |
91 | 103 |
92 ui::MenuModel* SearchResult::GetContextMenuModel() { | 104 ui::MenuModel* SearchResult::GetContextMenuModel() { |
93 return NULL; | 105 return NULL; |
94 } | 106 } |
95 | 107 |
96 } // namespace app_list | 108 } // namespace app_list |
OLD | NEW |