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

Unified Diff: ui/app_list/search_result.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: Rebase. Created 5 years, 8 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
« ui/app_list/search_result.h ('K') | « ui/app_list/search_result.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/search_result.cc
diff --git a/ui/app_list/search_result.cc b/ui/app_list/search_result.cc
index 87bea21334f15fe203c441f86ec9f532dc00fa1a..0a17b108977fbbf057fc72494fda587c5892321c 100644
--- a/ui/app_list/search_result.cc
+++ b/ui/app_list/search_result.cc
@@ -5,6 +5,8 @@
#include "ui/app_list/search_result.h"
#include "ui/app_list/app_list_constants.h"
+#include "ui/app_list/search/tokenized_string.h"
+#include "ui/app_list/search/tokenized_string_match.h"
#include "ui/app_list/search_result_observer.h"
namespace app_list {
@@ -99,6 +101,20 @@ void SearchResult::RemoveObserver(SearchResultObserver* observer) {
observers_.RemoveObserver(observer);
}
+void SearchResult::UpdateFromMatch(const TokenizedString& title,
+ const TokenizedStringMatch& match) {
+ const TokenizedStringMatch::Hits& hits = match.hits();
+
+ Tags tags;
+ tags.reserve(hits.size());
+ for (size_t i = 0; i < hits.size(); ++i)
+ tags.push_back(Tag(Tag::MATCH, hits[i].start(), hits[i].end()));
+
+ set_title(title.text());
+ set_title_tags(tags);
+ set_relevance(match.relevance());
+}
+
void SearchResult::Open(int event_flags) {
}
« ui/app_list/search_result.h ('K') | « ui/app_list/search_result.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698