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 "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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return true; | 215 return true; |
216 } | 216 } |
217 | 217 |
218 bool ZeroSuggestProvider::ShouldSendURL(const GURL& url) const { | 218 bool ZeroSuggestProvider::ShouldSendURL(const GURL& url) const { |
219 if (!url.is_valid()) | 219 if (!url.is_valid()) |
220 return false; | 220 return false; |
221 | 221 |
222 // Only allow HTTP URLs or Google HTTPS URLs (including Google search | 222 // Only allow HTTP URLs or Google HTTPS URLs (including Google search |
223 // result pages). For the latter case, Google was already sent the HTTPS | 223 // result pages). For the latter case, Google was already sent the HTTPS |
224 // URLs when requesting the page, so the information is just re-sent. | 224 // URLs when requesting the page, so the information is just re-sent. |
225 return (url.scheme() == chrome::kHttpScheme) || | 225 return (url.scheme() == content::kHttpScheme) || |
226 google_util::IsGoogleDomainUrl(url, google_util::ALLOW_SUBDOMAIN, | 226 google_util::IsGoogleDomainUrl(url, google_util::ALLOW_SUBDOMAIN, |
227 google_util::ALLOW_NON_STANDARD_PORTS); | 227 google_util::ALLOW_NON_STANDARD_PORTS); |
228 } | 228 } |
229 | 229 |
230 void ZeroSuggestProvider::FillResults( | 230 void ZeroSuggestProvider::FillResults( |
231 const Value& root_val, | 231 const Value& root_val, |
232 int* verbatim_relevance, | 232 int* verbatim_relevance, |
233 SearchProvider::SuggestResults* suggest_results, | 233 SearchProvider::SuggestResults* suggest_results, |
234 SearchProvider::NavigationResults* navigation_results) { | 234 SearchProvider::NavigationResults* navigation_results) { |
235 string16 query; | 235 string16 query; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 match.is_history_what_you_typed_match = false; | 468 match.is_history_what_you_typed_match = false; |
469 match.allowed_to_be_default_match = true; | 469 match.allowed_to_be_default_match = true; |
470 | 470 |
471 // The placeholder suggestion for the current URL has high relevance so | 471 // The placeholder suggestion for the current URL has high relevance so |
472 // that it is in the first suggestion slot and inline autocompleted. It | 472 // that it is in the first suggestion slot and inline autocompleted. It |
473 // gets dropped as soon as the user types something. | 473 // gets dropped as soon as the user types something. |
474 match.relevance = verbatim_relevance_; | 474 match.relevance = verbatim_relevance_; |
475 | 475 |
476 return match; | 476 return match; |
477 } | 477 } |
OLD | NEW |