| OLD | NEW |
| 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 "components/omnibox/browser/zero_suggest_provider.h" | 5 #include "components/omnibox/browser/zero_suggest_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void LogOmniboxZeroSuggestRequest( | 74 void LogOmniboxZeroSuggestRequest( |
| 75 ZeroSuggestRequestsHistogramValue request_value) { | 75 ZeroSuggestRequestsHistogramValue request_value) { |
| 76 UMA_HISTOGRAM_ENUMERATION("Omnibox.ZeroSuggestRequests", request_value, | 76 UMA_HISTOGRAM_ENUMERATION("Omnibox.ZeroSuggestRequests", request_value, |
| 77 ZERO_SUGGEST_MAX_REQUEST_HISTOGRAM_VALUE); | 77 ZERO_SUGGEST_MAX_REQUEST_HISTOGRAM_VALUE); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Relevance value to use if it was not set explicitly by the server. | 80 // Relevance value to use if it was not set explicitly by the server. |
| 81 const int kDefaultZeroSuggestRelevance = 100; | 81 const int kDefaultZeroSuggestRelevance = 100; |
| 82 | 82 |
| 83 // Used for testing whether zero suggest is ever available. | 83 // Used for testing whether zero suggest is ever available. |
| 84 const char kArbitraryInsecureUrlString[] = "http://www.google.com/"; | 84 constexpr char kArbitraryInsecureUrlString[] = "http://www.google.com/"; |
| 85 | 85 |
| 86 } // namespace | 86 } // namespace |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 ZeroSuggestProvider* ZeroSuggestProvider::Create( | 89 ZeroSuggestProvider* ZeroSuggestProvider::Create( |
| 90 AutocompleteProviderClient* client, | 90 AutocompleteProviderClient* client, |
| 91 HistoryURLProvider* history_url_provider, | 91 HistoryURLProvider* history_url_provider, |
| 92 AutocompleteProviderListener* listener) { | 92 AutocompleteProviderListener* listener) { |
| 93 return new ZeroSuggestProvider(client, history_url_provider, listener); | 93 return new ZeroSuggestProvider(client, history_url_provider, listener); |
| 94 } | 94 } |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 if (!json_data.empty()) { | 545 if (!json_data.empty()) { |
| 546 std::unique_ptr<base::Value> data( | 546 std::unique_ptr<base::Value> data( |
| 547 SearchSuggestionParser::DeserializeJsonData(json_data)); | 547 SearchSuggestionParser::DeserializeJsonData(json_data)); |
| 548 if (data && ParseSuggestResults( | 548 if (data && ParseSuggestResults( |
| 549 *data, kDefaultZeroSuggestRelevance, false, &results_)) { | 549 *data, kDefaultZeroSuggestRelevance, false, &results_)) { |
| 550 ConvertResultsToAutocompleteMatches(); | 550 ConvertResultsToAutocompleteMatches(); |
| 551 results_from_cache_ = !matches_.empty(); | 551 results_from_cache_ = !matches_.empty(); |
| 552 } | 552 } |
| 553 } | 553 } |
| 554 } | 554 } |
| OLD | NEW |