Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1058)

Unified Diff: chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc

Issue 10386224: app_list: Add search box and search result view for v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc
diff --git a/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc b/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc
index 1dfe853ec4b60fa9f18b2cfb25453337660c1c5c..00ed7a083380728e1f15e1b3a504ddb0729f9933 100644
--- a/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/views/ash/app_list/app_list_view_delegate.cc
@@ -6,8 +6,9 @@
#include "ash/shell.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/ui/views/ash/app_list/app_list_model_builder.h"
+#include "chrome/browser/ui/views/ash/app_list/apps_model_builder.h"
#include "chrome/browser/ui/views/ash/app_list/chrome_app_list_item.h"
+#include "chrome/browser/ui/views/ash/app_list/search_builder.h"
AppListViewDelegate::AppListViewDelegate() {
}
@@ -17,28 +18,42 @@ AppListViewDelegate::~AppListViewDelegate() {
void AppListViewDelegate::SetModel(app_list::AppListModel* model) {
if (model) {
- if (!model_builder_.get()) {
- model_builder_.reset(
- new AppListModelBuilder(
- ProfileManager::GetDefaultProfileOrOffTheRecord()));
- }
- model_builder_->SetModel(model);
+ Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
+ apps_builder_.reset(new AppsModelBuilder(profile, model->apps()));
+ apps_builder_->Build();
+
+ search_builder_.reset(new SearchBuilder(profile,
+ model->search_box(),
+ model->results()));
} else {
- model_builder_.reset();
+ apps_builder_.reset();
+ search_builder_.reset();
}
}
-void AppListViewDelegate::UpdateModel(const std::string& query) {
- DCHECK(model_builder_.get());
- model_builder_->Build(query);
-}
-
-void AppListViewDelegate::OnAppListItemActivated(
+void AppListViewDelegate::ActivateAppListItem(
app_list::AppListItemModel* item,
int event_flags) {
static_cast<ChromeAppListItem*>(item)->Activate(event_flags);
}
+void AppListViewDelegate::StartSearch() {
+ if (search_builder_.get())
+ search_builder_->StartSearch();
+}
+
+void AppListViewDelegate::StopSearch() {
+ if (search_builder_.get())
+ search_builder_->StopSearch();
+}
+
+void AppListViewDelegate::OpenSearchResult(
+ const app_list::SearchResult& result,
+ int event_flags) {
+ if (search_builder_.get())
+ search_builder_->OpenResult(result, event_flags);
+}
+
void AppListViewDelegate::Close() {
DCHECK(ash::Shell::HasInstance());
if (ash::Shell::GetInstance()->GetAppListTargetVisibility())

Powered by Google App Engine
This is Rietveld 408576698