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

Side by Side Diff: athena/home/app_list_view_delegate.cc

Issue 621823004: Simplifies the structure of app_list search a bit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « ash/shell/app_list.cc ('k') | athena/main/url_search_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/home/app_list_view_delegate.h" 5 #include "athena/home/app_list_view_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "athena/home/public/app_model_builder.h" 10 #include "athena/home/public/app_model_builder.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // TODO(mukai): port app-list's mixer and remove this restriction. 46 // TODO(mukai): port app-list's mixer and remove this restriction.
47 DCHECK(search_providers_.empty()); 47 DCHECK(search_providers_.empty());
48 search_provider->set_result_changed_callback(base::Bind( 48 search_provider->set_result_changed_callback(base::Bind(
49 &AppListViewDelegate::SearchResultChanged, base::Unretained(this))); 49 &AppListViewDelegate::SearchResultChanged, base::Unretained(this)));
50 search_providers_.push_back(search_provider); 50 search_providers_.push_back(search_provider);
51 } 51 }
52 52
53 void AppListViewDelegate::SearchResultChanged() { 53 void AppListViewDelegate::SearchResultChanged() {
54 // TODO(mukai): port app-list's Mixer to reorder the results properly. 54 // TODO(mukai): port app-list's Mixer to reorder the results properly.
55 app_list::SearchProvider* search_provider = search_providers_[0]; 55 app_list::SearchProvider* search_provider = search_providers_[0];
56 std::vector<app_list::SearchResult*> results; 56 const app_list::SearchProvider::Results& results = search_provider->results();
57 search_provider->ReleaseResult(&results); 57 model_->results()->DeleteAll();
58 if (results.empty()) { 58 for (size_t i = 0; i < results.size(); ++i)
59 model_->results()->DeleteAll(); 59 model_->results()->Add(results[i]->Duplicate().release());
60 } else {
61 for (size_t i = 0; i < results.size(); ++i)
62 model_->results()->Add(results[i]);
63 }
64 } 60 }
65 61
66 bool AppListViewDelegate::ForceNativeDesktop() const { 62 bool AppListViewDelegate::ForceNativeDesktop() const {
67 return false; 63 return false;
68 } 64 }
69 65
70 void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) { 66 void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) {
71 // Nothing needs to be done. 67 // Nothing needs to be done.
72 } 68 }
73 69
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 const app_list::AppListViewDelegate::Users& 177 const app_list::AppListViewDelegate::Users&
182 AppListViewDelegate::GetUsers() const { 178 AppListViewDelegate::GetUsers() const {
183 return users_; 179 return users_;
184 } 180 }
185 181
186 bool AppListViewDelegate::ShouldCenterWindow() const { 182 bool AppListViewDelegate::ShouldCenterWindow() const {
187 return true; 183 return true;
188 } 184 }
189 185
190 } // namespace athena 186 } // namespace athena
OLDNEW
« no previous file with comments | « ash/shell/app_list.cc ('k') | athena/main/url_search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698