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

Side by Side Diff: chrome/browser/ui/app_list/search/app_search_provider.cc

Issue 796793002: Make app list recommendations into their own DisplayType. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mathp_suggestions_search
Patch Set: fix_test Created 6 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/app_list/search/app_search_provider.h" 5 #include "chrome/browser/ui/app_list/search/app_search_provider.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/clock.h" 10 #include "base/time/clock.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 void AppSearchProvider::UpdateResults() { 80 void AppSearchProvider::UpdateResults() {
81 const TokenizedString query_terms(query_); 81 const TokenizedString query_terms(query_);
82 bool show_recommendations = query_.empty(); 82 bool show_recommendations = query_.empty();
83 ClearResults(); 83 ClearResults();
84 84
85 for (Apps::const_iterator app_it = apps_.begin(); 85 for (Apps::const_iterator app_it = apps_.begin();
86 app_it != apps_.end(); 86 app_it != apps_.end();
87 ++app_it) { 87 ++app_it) {
88 scoped_ptr<AppResult> result( 88 scoped_ptr<AppResult> result(new AppResult(
89 new AppResult(profile_, (*app_it)->app_id(), list_controller_)); 89 profile_, (*app_it)->app_id(), list_controller_, show_recommendations));
90 if (show_recommendations) { 90 if (show_recommendations) {
91 result->set_title((*app_it)->indexed_name().text()); 91 result->set_title((*app_it)->indexed_name().text());
92 result->UpdateFromLastLaunched(clock_->Now(), 92 result->UpdateFromLastLaunched(clock_->Now(),
93 (*app_it)->last_launch_time()); 93 (*app_it)->last_launch_time());
94 } else { 94 } else {
95 TokenizedStringMatch match; 95 TokenizedStringMatch match;
96 if (!match.Calculate(query_terms, (*app_it)->indexed_name())) 96 if (!match.Calculate(query_terms, (*app_it)->indexed_name()))
97 continue; 97 continue;
98 98
99 result->UpdateFromMatch((*app_it)->indexed_name(), match); 99 result->UpdateFromMatch((*app_it)->indexed_name(), match);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 void AppSearchProvider::OnExtensionUninstalled( 137 void AppSearchProvider::OnExtensionUninstalled(
138 content::BrowserContext* browser_context, 138 content::BrowserContext* browser_context,
139 const extensions::Extension* extension, 139 const extensions::Extension* extension,
140 extensions::UninstallReason reason) { 140 extensions::UninstallReason reason) {
141 RefreshApps(); 141 RefreshApps();
142 UpdateResults(); 142 UpdateResults();
143 } 143 }
144 144
145 } // namespace app_list 145 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698