Chromium Code Reviews| 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::GetPreferredIconSize() { | |
| 72 switch (display_type_) { | |
| 73 case DISPLAY_TILE: | |
| 74 return kTileIconSize; | |
| 75 case DISPLAY_LIST: | |
| 76 return kListIconSize; | |
| 77 default: | |
|
tapted
2014/08/13 08:15:22
nit: you don't need a default case here. It's bett
calamity
2014/08/13 08:25:09
Done.
| |
| 78 NOTREACHED(); | |
| 79 return 0; | |
| 80 } | |
| 81 } | |
| 82 | |
| 70 void SearchResult::NotifyItemInstalled() { | 83 void SearchResult::NotifyItemInstalled() { |
| 71 FOR_EACH_OBSERVER(SearchResultObserver, observers_, OnItemInstalled()); | 84 FOR_EACH_OBSERVER(SearchResultObserver, observers_, OnItemInstalled()); |
| 72 } | 85 } |
| 73 | 86 |
| 74 void SearchResult::NotifyItemUninstalled() { | 87 void SearchResult::NotifyItemUninstalled() { |
| 75 FOR_EACH_OBSERVER(SearchResultObserver, observers_, OnItemUninstalled()); | 88 FOR_EACH_OBSERVER(SearchResultObserver, observers_, OnItemUninstalled()); |
| 76 } | 89 } |
| 77 | 90 |
| 78 void SearchResult::AddObserver(SearchResultObserver* observer) { | 91 void SearchResult::AddObserver(SearchResultObserver* observer) { |
| 79 observers_.AddObserver(observer); | 92 observers_.AddObserver(observer); |
| 80 } | 93 } |
| 81 | 94 |
| 82 void SearchResult::RemoveObserver(SearchResultObserver* observer) { | 95 void SearchResult::RemoveObserver(SearchResultObserver* observer) { |
| 83 observers_.RemoveObserver(observer); | 96 observers_.RemoveObserver(observer); |
| 84 } | 97 } |
| 85 | 98 |
| 86 void SearchResult::Open(int event_flags) { | 99 void SearchResult::Open(int event_flags) { |
| 87 } | 100 } |
| 88 | 101 |
| 89 void SearchResult::InvokeAction(int action_index, int event_flags) { | 102 void SearchResult::InvokeAction(int action_index, int event_flags) { |
| 90 } | 103 } |
| 91 | 104 |
| 92 ui::MenuModel* SearchResult::GetContextMenuModel() { | 105 ui::MenuModel* SearchResult::GetContextMenuModel() { |
| 93 return NULL; | 106 return NULL; |
| 94 } | 107 } |
| 95 | 108 |
| 96 } // namespace app_list | 109 } // namespace app_list |
| OLD | NEW |