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

Side by Side Diff: components/omnibox/base_search_provider.cc

Issue 911723002: Provide description_class in search provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a long line Created 5 years, 10 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
« no previous file with comments | « no previous file | 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 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 "components/omnibox/base_search_provider.h" 5 #include "components/omnibox/base_search_provider.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/metrics/proto/omnibox_event.pb.h" 10 #include "components/metrics/proto/omnibox_event.pb.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 kACMatchPropertyInputText, base::UTF16ToUTF8(input.text())); 215 kACMatchPropertyInputText, base::UTF16ToUTF8(input.text()));
216 match.RecordAdditionalInfo( 216 match.RecordAdditionalInfo(
217 kACMatchPropertyContentsPrefix, 217 kACMatchPropertyContentsPrefix,
218 base::UTF16ToUTF8(suggestion.match_contents_prefix())); 218 base::UTF16ToUTF8(suggestion.match_contents_prefix()));
219 match.RecordAdditionalInfo( 219 match.RecordAdditionalInfo(
220 kACMatchPropertyContentsStartIndex, 220 kACMatchPropertyContentsStartIndex,
221 static_cast<int>( 221 static_cast<int>(
222 suggestion.suggestion().length() - match.contents.length())); 222 suggestion.suggestion().length() - match.contents.length()));
223 } 223 }
224 224
225 if (!suggestion.annotation().empty()) 225 if (!suggestion.annotation().empty()) {
226 match.description = suggestion.annotation(); 226 match.description = suggestion.annotation();
227 ACMatchClassifications classifications;
228 classifications.push_back(
229 ACMatchClassification(0, ACMatchClassification::DIM));
Peter Kasting 2015/02/09 23:46:43 Why is this DIM instead of NONE like most descript
Maria 2015/02/10 01:13:28 I was under impression that DIM allowed descriptio
Peter Kasting 2015/02/10 01:28:51 Yeah, descriptions are auto-dimmed. We probably w
230 match.description_class = classifications;
Peter Kasting 2015/02/09 23:46:43 Nit: Simpler: AutocompleteMatch::AddLastClassif
Maria 2015/02/10 01:13:28 Done.
231 }
227 232
228 // suggestion.match_contents() should have already been collapsed. 233 // suggestion.match_contents() should have already been collapsed.
229 match.allowed_to_be_default_match = 234 match.allowed_to_be_default_match =
230 (!in_keyword_mode || suggestion.from_keyword_provider()) && 235 (!in_keyword_mode || suggestion.from_keyword_provider()) &&
231 (base::CollapseWhitespace(input.text(), false) == 236 (base::CollapseWhitespace(input.text(), false) ==
232 suggestion.match_contents()); 237 suggestion.match_contents());
233 238
234 // When the user forced a query, we need to make sure all the fill_into_edit 239 // When the user forced a query, we need to make sure all the fill_into_edit
235 // values preserve that property. Otherwise, if the user starts editing a 240 // values preserve that property. Otherwise, if the user starts editing a
236 // suggestion, non-Search results will suddenly appear. 241 // suggestion, non-Search results will suddenly appear.
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 } 477 }
473 478
474 void BaseSearchProvider::OnDeletionComplete( 479 void BaseSearchProvider::OnDeletionComplete(
475 bool success, SuggestionDeletionHandler* handler) { 480 bool success, SuggestionDeletionHandler* handler) {
476 RecordDeletionResult(success); 481 RecordDeletionResult(success);
477 SuggestionDeletionHandlers::iterator it = std::find( 482 SuggestionDeletionHandlers::iterator it = std::find(
478 deletion_handlers_.begin(), deletion_handlers_.end(), handler); 483 deletion_handlers_.begin(), deletion_handlers_.end(), handler);
479 DCHECK(it != deletion_handlers_.end()); 484 DCHECK(it != deletion_handlers_.end());
480 deletion_handlers_.erase(it); 485 deletion_handlers_.erase(it);
481 } 486 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698