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

Side by Side 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, 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 unified diff | Download patch
« ui/app_list/search_result.h ('K') | « ui/app_list/search_result.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/app_list/search_result.h" 5 #include "ui/app_list/search_result.h"
6 6
7 #include "ui/app_list/app_list_constants.h" 7 #include "ui/app_list/app_list_constants.h"
8 #include "ui/app_list/search/tokenized_string.h"
9 #include "ui/app_list/search/tokenized_string_match.h"
8 #include "ui/app_list/search_result_observer.h" 10 #include "ui/app_list/search_result_observer.h"
9 11
10 namespace app_list { 12 namespace app_list {
11 13
12 SearchResult::Action::Action(const gfx::ImageSkia& base_image, 14 SearchResult::Action::Action(const gfx::ImageSkia& base_image,
13 const gfx::ImageSkia& hover_image, 15 const gfx::ImageSkia& hover_image,
14 const gfx::ImageSkia& pressed_image, 16 const gfx::ImageSkia& pressed_image,
15 const base::string16& tooltip_text) 17 const base::string16& tooltip_text)
16 : base_image(base_image), 18 : base_image(base_image),
17 hover_image(hover_image), 19 hover_image(hover_image),
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 94 }
93 95
94 void SearchResult::AddObserver(SearchResultObserver* observer) { 96 void SearchResult::AddObserver(SearchResultObserver* observer) {
95 observers_.AddObserver(observer); 97 observers_.AddObserver(observer);
96 } 98 }
97 99
98 void SearchResult::RemoveObserver(SearchResultObserver* observer) { 100 void SearchResult::RemoveObserver(SearchResultObserver* observer) {
99 observers_.RemoveObserver(observer); 101 observers_.RemoveObserver(observer);
100 } 102 }
101 103
104 void SearchResult::UpdateFromMatch(const TokenizedString& title,
105 const TokenizedStringMatch& match) {
106 const TokenizedStringMatch::Hits& hits = match.hits();
107
108 Tags tags;
109 tags.reserve(hits.size());
110 for (size_t i = 0; i < hits.size(); ++i)
111 tags.push_back(Tag(Tag::MATCH, hits[i].start(), hits[i].end()));
112
113 set_title(title.text());
114 set_title_tags(tags);
115 set_relevance(match.relevance());
116 }
117
102 void SearchResult::Open(int event_flags) { 118 void SearchResult::Open(int event_flags) {
103 } 119 }
104 120
105 void SearchResult::InvokeAction(int action_index, int event_flags) { 121 void SearchResult::InvokeAction(int action_index, int event_flags) {
106 } 122 }
107 123
108 ui::MenuModel* SearchResult::GetContextMenuModel() { 124 ui::MenuModel* SearchResult::GetContextMenuModel() {
109 return NULL; 125 return NULL;
110 } 126 }
111 127
112 } // namespace app_list 128 } // namespace app_list
OLDNEW
« 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