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

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

Issue 372843005: Remove Profile from BaseSearchProvider::NavigationResult (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
« no previous file with comments | « chrome/browser/autocomplete/search_provider_unittest.cc ('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 "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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 UMA_HISTOGRAM_COUNTS( 369 UMA_HISTOGRAM_COUNTS(
370 "Omnibox.ZeroSuggest.MostVisitedResultsCounterfactual", 370 "Omnibox.ZeroSuggest.MostVisitedResultsCounterfactual",
371 most_visited_urls_.size()); 371 most_visited_urls_.size());
372 } 372 }
373 const base::string16 current_query_string16( 373 const base::string16 current_query_string16(
374 base::ASCIIToUTF16(current_query_)); 374 base::ASCIIToUTF16(current_query_));
375 const std::string languages( 375 const std::string languages(
376 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); 376 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages));
377 for (size_t i = 0; i < most_visited_urls_.size(); i++) { 377 for (size_t i = 0; i < most_visited_urls_.size(); i++) {
378 const history::MostVisitedURL& url = most_visited_urls_[i]; 378 const history::MostVisitedURL& url = most_visited_urls_[i];
379 NavigationResult nav(*this, profile_, url.url, 379 NavigationResult nav(
380 AutocompleteMatchType::NAVSUGGEST, url.title, 380 ChromeAutocompleteSchemeClassifier(profile_), url.url,
381 std::string(), false, relevance, true, 381 AutocompleteMatchType::NAVSUGGEST, url.title, std::string(), false,
382 current_query_string16, languages); 382 relevance, true, current_query_string16, languages);
383 matches_.push_back(NavigationToMatch(nav)); 383 matches_.push_back(NavigationToMatch(nav));
384 --relevance; 384 --relevance;
385 } 385 }
386 return; 386 return;
387 } 387 }
388 388
389 if (num_results == 0) 389 if (num_results == 0)
390 return; 390 return;
391 391
392 // TODO(jered): Rip this out once the first match is decoupled from the 392 // TODO(jered): Rip this out once the first match is decoupled from the
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 std::string json_data = profile_->GetPrefs()->GetString( 455 std::string json_data = profile_->GetPrefs()->GetString(
456 prefs::kZeroSuggestCachedResults); 456 prefs::kZeroSuggestCachedResults);
457 if (!json_data.empty()) { 457 if (!json_data.empty()) {
458 scoped_ptr<base::Value> data(DeserializeJsonData(json_data)); 458 scoped_ptr<base::Value> data(DeserializeJsonData(json_data));
459 if (data && ParseSuggestResults(*data.get(), false, &results_)) { 459 if (data && ParseSuggestResults(*data.get(), false, &results_)) {
460 ConvertResultsToAutocompleteMatches(); 460 ConvertResultsToAutocompleteMatches();
461 results_from_cache_ = !matches_.empty(); 461 results_from_cache_ = !matches_.empty();
462 } 462 }
463 } 463 }
464 } 464 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/search_provider_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698