Index: athena/home/bottom_home_view.cc |
diff --git a/athena/home/bottom_home_view.cc b/athena/home/bottom_home_view.cc |
index 8170761c885699de428bb8d5b899625cdc114996..2ac5a646e65304d8bc01d0cae91dbb239cc8eba7 100644 |
--- a/athena/home/bottom_home_view.cc |
+++ b/athena/home/bottom_home_view.cc |
@@ -4,6 +4,8 @@ |
#include "athena/home/bottom_home_view.h" |
+#include "base/strings/utf_string_conversions.h" |
+#include "ui/app_list/app_list_item.h" |
#include "ui/app_list/app_list_item_list.h" |
#include "ui/app_list/app_list_model.h" |
#include "ui/app_list/app_list_view_delegate.h" |
@@ -47,6 +49,24 @@ class BottomHomeBackground : public views::Background { |
DISALLOW_COPY_AND_ASSIGN(BottomHomeBackground); |
}; |
+class AppListItemSearchResult : public app_list::SearchResult { |
+ public: |
+ explicit AppListItemSearchResult(app_list::AppListItem* item) : item_(item) { |
+ set_display_type(app_list::SearchResult::DISPLAY_TILE); |
+ SetIcon(item->icon()); |
+ set_title(base::UTF8ToUTF16(item->name())); |
+ } |
+ virtual ~AppListItemSearchResult() {} |
+ |
+ virtual void Open(int event_flags) OVERRIDE { |
+ item_->Activate(event_flags); |
+ } |
+ private: |
+ app_list::AppListItem* item_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AppListItemSearchResult); |
+}; |
+ |
} // namespace |
namespace athena { |
@@ -55,8 +75,8 @@ BottomHomeView::BottomHomeView(app_list::AppListViewDelegate* view_delegate) |
: view_delegate_(view_delegate) { |
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
- app_list::AppListModel* model = view_delegate->GetModel(); |
- app_list::AppListItemList* top_level = model->top_level_item_list(); |
+ app_list::AppListItemList* top_level = |
+ view_delegate->GetModel()->top_level_item_list(); |
views::View* items_container = new views::View(); |
AddChildView(items_container); |
@@ -67,7 +87,10 @@ BottomHomeView::BottomHomeView(app_list::AppListViewDelegate* view_delegate) |
items_container->SetLayoutManager(items_layout); |
for (size_t i = 0; i < top_level->item_count(); ++i) { |
app_list::TileItemView* tile_item_view = new app_list::TileItemView(); |
- tile_item_view->SetAppListItem(top_level->item_at(i)); |
+ app_list::SearchResult* result = |
+ new AppListItemSearchResult(top_level->item_at(i)); |
+ app_list_item_search_results_.push_back(result); |
+ tile_item_view->SetSearchResult(result); |
items_container->AddChildView(tile_item_view); |
tile_item_view->set_background(NULL); |
} |