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

Side by Side Diff: chrome/browser/autocomplete/zero_suggest_provider.cc

Issue 58003005: Modify Entity Suggestion support and Add Profile Suggest support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 7 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 (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 "chrome/browser/autocomplete/zero_suggest_provider.h" 5 #include "chrome/browser/autocomplete/zero_suggest_provider.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // Do not blindly trust the URL coming from the server to be valid. 259 // Do not blindly trust the URL coming from the server to be valid.
260 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(result), std::string())); 260 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(result), std::string()));
261 if (url.is_valid()) { 261 if (url.is_valid()) {
262 if (descriptions != NULL) 262 if (descriptions != NULL)
263 descriptions->GetString(index, &title); 263 descriptions->GetString(index, &title);
264 navigation_results->push_back(SearchProvider::NavigationResult( 264 navigation_results->push_back(SearchProvider::NavigationResult(
265 *this, url, title, false, relevance, relevances != NULL)); 265 *this, url, title, false, relevance, relevances != NULL));
266 } 266 }
267 } else { 267 } else {
268 suggest_results->push_back(SearchProvider::SuggestResult( 268 suggest_results->push_back(SearchProvider::SuggestResult(
269 result, result, base::string16(), std::string(), std::string(), false, 269 result, AutocompleteMatchType::SEARCH_SUGGEST, result,
270 relevance, relevances != NULL, false)); 270 base::string16(), std::string(), std::string(), false, relevance,
271 relevances != NULL, false));
271 } 272 }
272 } 273 }
273 } 274 }
274 275
275 void ZeroSuggestProvider::AddSuggestResultsToMap( 276 void ZeroSuggestProvider::AddSuggestResultsToMap(
276 const SearchProvider::SuggestResults& results, 277 const SearchProvider::SuggestResults& results,
277 const TemplateURL* template_url, 278 const TemplateURL* template_url,
278 SearchProvider::MatchMap* map) { 279 SearchProvider::MatchMap* map) {
279 for (size_t i = 0; i < results.size(); ++i) { 280 for (size_t i = 0; i < results.size(); ++i) {
280 AddMatchToMap(results[i].relevance(), AutocompleteMatchType::SEARCH_SUGGEST, 281 AddMatchToMap(results[i].relevance(), AutocompleteMatchType::SEARCH_SUGGEST,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 match.is_history_what_you_typed_match = false; 454 match.is_history_what_you_typed_match = false;
454 match.allowed_to_be_default_match = true; 455 match.allowed_to_be_default_match = true;
455 456
456 // The placeholder suggestion for the current URL has high relevance so 457 // The placeholder suggestion for the current URL has high relevance so
457 // that it is in the first suggestion slot and inline autocompleted. It 458 // that it is in the first suggestion slot and inline autocompleted. It
458 // gets dropped as soon as the user types something. 459 // gets dropped as soon as the user types something.
459 match.relevance = verbatim_relevance_; 460 match.relevance = verbatim_relevance_;
460 461
461 return match; 462 return match;
462 } 463 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/search_provider_unittest.cc ('k') | chrome/browser/metrics/metrics_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698