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

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

Issue 423093013: Move DeserializeJsonData() and UTF-8 conversion code to SearchSuggestionParser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clear image URLs Created 6 years, 4 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 return true; 449 return true;
450 } 450 }
451 451
452 void ZeroSuggestProvider::MaybeUseCachedSuggestions() { 452 void ZeroSuggestProvider::MaybeUseCachedSuggestions() {
453 if (!OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial()) 453 if (!OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial())
454 return; 454 return;
455 455
456 std::string json_data = profile_->GetPrefs()->GetString( 456 std::string json_data = profile_->GetPrefs()->GetString(
457 prefs::kZeroSuggestCachedResults); 457 prefs::kZeroSuggestCachedResults);
458 if (!json_data.empty()) { 458 if (!json_data.empty()) {
459 scoped_ptr<base::Value> data(DeserializeJsonData(json_data)); 459 scoped_ptr<base::Value> data(
460 SearchSuggestionParser::DeserializeJsonData(json_data));
460 if (data && ParseSuggestResults(*data.get(), false, &results_)) { 461 if (data && ParseSuggestResults(*data.get(), false, &results_)) {
461 ConvertResultsToAutocompleteMatches(); 462 ConvertResultsToAutocompleteMatches();
462 results_from_cache_ = !matches_.empty(); 463 results_from_cache_ = !matches_.empty();
463 } 464 }
464 } 465 }
465 } 466 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/search_provider.cc ('k') | components/autocomplete/search_suggestion_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698