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

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

Issue 438023002: Add search suggestions fetched from the server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | athena/main/url_search_provider.h » ('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 8
9 #include "athena/home/public/app_model_builder.h" 9 #include "athena/home/public/app_model_builder.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 search_provider->set_result_changed_callback(base::Bind( 44 search_provider->set_result_changed_callback(base::Bind(
45 &AppListViewDelegate::SearchResultChanged, base::Unretained(this))); 45 &AppListViewDelegate::SearchResultChanged, base::Unretained(this)));
46 search_providers_.push_back(search_provider); 46 search_providers_.push_back(search_provider);
47 } 47 }
48 48
49 void AppListViewDelegate::SearchResultChanged() { 49 void AppListViewDelegate::SearchResultChanged() {
50 // TODO(mukai): port app-list's Mixer to reorder the results properly. 50 // TODO(mukai): port app-list's Mixer to reorder the results properly.
51 app_list::SearchProvider* search_provider = search_providers_[0]; 51 app_list::SearchProvider* search_provider = search_providers_[0];
52 std::vector<app_list::SearchResult*> results; 52 std::vector<app_list::SearchResult*> results;
53 search_provider->ReleaseResult(&results); 53 search_provider->ReleaseResult(&results);
54 model_->results()->DeleteAll(); 54 if (results.empty()) {
hashimoto 2014/08/04 11:28:54 This code assumes that |results| is empty iff Sear
Jun Mukai 2014/08/04 16:43:10 This is not enough. You should clear model_->resul
hashimoto 2014/08/05 01:03:35 Isn't calling model_->results()->DeleteAll() when
Jun Mukai 2014/08/05 07:33:22 You made the point.
55 for (size_t i = 0; i < results.size(); ++i) 55 model_->results()->DeleteAll();
56 model_->results()->Add(results[i]); 56 } else {
57 for (size_t i = 0; i < results.size(); ++i)
58 model_->results()->Add(results[i]);
59 }
57 } 60 }
58 61
59 bool AppListViewDelegate::ForceNativeDesktop() const { 62 bool AppListViewDelegate::ForceNativeDesktop() const {
60 return false; 63 return false;
61 } 64 }
62 65
63 void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) { 66 void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) {
64 // Nothing needs to be done. 67 // Nothing needs to be done.
65 } 68 }
66 69
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 const app_list::AppListViewDelegate::Users& 170 const app_list::AppListViewDelegate::Users&
168 AppListViewDelegate::GetUsers() const { 171 AppListViewDelegate::GetUsers() const {
169 return users_; 172 return users_;
170 } 173 }
171 174
172 bool AppListViewDelegate::ShouldCenterWindow() const { 175 bool AppListViewDelegate::ShouldCenterWindow() const {
173 return true; 176 return true;
174 } 177 }
175 178
176 } // namespace athena 179 } // namespace athena
OLDNEW
« no previous file with comments | « no previous file | athena/main/url_search_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698