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

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

Issue 109013006: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 12 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 | Annotate | Revision Log
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (result.empty()) 251 if (result.empty())
252 continue; 252 continue;
253 253
254 int relevance = kDefaultZeroSuggestRelevance; 254 int relevance = kDefaultZeroSuggestRelevance;
255 255
256 // Apply valid suggested relevance scores; discard invalid lists. 256 // Apply valid suggested relevance scores; discard invalid lists.
257 if (relevances != NULL && !relevances->GetInteger(index, &relevance)) 257 if (relevances != NULL && !relevances->GetInteger(index, &relevance))
258 relevances = NULL; 258 relevances = NULL;
259 if (types && types->GetString(index, &type) && (type == "NAVIGATION")) { 259 if (types && types->GetString(index, &type) && (type == "NAVIGATION")) {
260 // Do not blindly trust the URL coming from the server to be valid. 260 // Do not blindly trust the URL coming from the server to be valid.
261 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(result), std::string())); 261 GURL url(URLFixerUpper::FixupURL(
262 base::UTF16ToUTF8(result), std::string()));
262 if (url.is_valid()) { 263 if (url.is_valid()) {
263 if (descriptions != NULL) 264 if (descriptions != NULL)
264 descriptions->GetString(index, &title); 265 descriptions->GetString(index, &title);
265 navigation_results->push_back(SearchProvider::NavigationResult( 266 navigation_results->push_back(SearchProvider::NavigationResult(
266 *this, url, title, false, relevance, relevances != NULL)); 267 *this, url, title, false, relevance, relevances != NULL));
267 } 268 }
268 } else { 269 } else {
269 suggest_results->push_back(SearchProvider::SuggestResult( 270 suggest_results->push_back(SearchProvider::SuggestResult(
270 result, AutocompleteMatchType::SEARCH_SUGGEST, result, 271 result, AutocompleteMatchType::SEARCH_SUGGEST, result,
271 base::string16(), std::string(), std::string(), false, relevance, 272 base::string16(), std::string(), std::string(), false, relevance,
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 match.is_history_what_you_typed_match = false; 456 match.is_history_what_you_typed_match = false;
456 match.allowed_to_be_default_match = true; 457 match.allowed_to_be_default_match = true;
457 458
458 // The placeholder suggestion for the current URL has high relevance so 459 // The placeholder suggestion for the current URL has high relevance so
459 // that it is in the first suggestion slot and inline autocompleted. It 460 // that it is in the first suggestion slot and inline autocompleted. It
460 // gets dropped as soon as the user types something. 461 // gets dropped as soon as the user types something.
461 match.relevance = verbatim_relevance_; 462 match.relevance = verbatim_relevance_;
462 463
463 return match; 464 return match;
464 } 465 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/url_prefix.cc ('k') | chrome/browser/autofill/autofill_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698