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

Unified Diff: chrome/browser/ui/app_list/search/webstore/webstore_provider.cc

Issue 1110883003: App Launcher: Webstore results are now highlighted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@applist-webstore-result-match
Patch Set: Update tests to test for highlighting. Created 5 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/app_list/search/webstore/webstore_provider.cc
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
index 3d2fcc66a51c8804807f0408965075b1363d3ddd..2c43cb37079755cc71b7302909f7a8119382af28 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
@@ -178,17 +178,18 @@ scoped_ptr<SearchResult> WebstoreProvider::CreateResult(
extensions::Manifest::Type item_type = ParseItemType(item_type_string);
// Calculate the relevance score by matching the query with the title. Results
- // with a match score of 0 are discarded.
- // TODO(mgiuca): Set the tags to indicate the parts of the title that were
- // matched.
+ // with a match score of 0 are discarded. This will also be used to set the
+ // title tags (highlighting which parts of the title matched the search
+ // query).
TokenizedString title(base::UTF8ToUTF16(localized_name));
TokenizedStringMatch match;
if (!match.Calculate(query, title))
return scoped_ptr<SearchResult>();
- return make_scoped_ptr(new WebstoreResult(profile_, app_id, localized_name,
- match.relevance(), icon_url,
- is_paid, item_type, controller_));
+ scoped_ptr<SearchResult> result(new WebstoreResult(
+ profile_, app_id, icon_url, is_paid, item_type, controller_));
+ result->UpdateFromMatch(title, match);
+ return result;
}
} // namespace app_list

Powered by Google App Engine
This is Rietveld 408576698