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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 Stop(true); | 383 Stop(true); |
384 return; | 384 return; |
385 } | 385 } |
386 string16 prefix; | 386 string16 prefix; |
387 TemplateURLRef::SearchTermsArgs search_term_args(prefix); | 387 TemplateURLRef::SearchTermsArgs search_term_args(prefix); |
388 search_term_args.zero_prefix_url = current_query_; | 388 search_term_args.zero_prefix_url = current_query_; |
389 std::string req_url = default_provider->suggestions_url_ref(). | 389 std::string req_url = default_provider->suggestions_url_ref(). |
390 ReplaceSearchTerms(search_term_args); | 390 ReplaceSearchTerms(search_term_args); |
391 GURL suggest_url(req_url); | 391 GURL suggest_url(req_url); |
392 // Make sure we are sending the suggest request through HTTPS. | 392 // Make sure we are sending the suggest request through HTTPS. |
393 if (!suggest_url.SchemeIs(chrome::kHttpsScheme)) { | 393 if (!suggest_url.SchemeIs(content::kHttpsScheme)) { |
394 Stop(true); | 394 Stop(true); |
395 return; | 395 return; |
396 } | 396 } |
397 | 397 |
398 fetcher_.reset( | 398 fetcher_.reset( |
399 net::URLFetcher::Create(kFetcherID, | 399 net::URLFetcher::Create(kFetcherID, |
400 suggest_url, | 400 suggest_url, |
401 net::URLFetcher::GET, this)); | 401 net::URLFetcher::GET, this)); |
402 fetcher_->SetRequestContext(profile_->GetRequestContext()); | 402 fetcher_->SetRequestContext(profile_->GetRequestContext()); |
403 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 403 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 match.is_history_what_you_typed_match = false; | 466 match.is_history_what_you_typed_match = false; |
467 match.allowed_to_be_default_match = true; | 467 match.allowed_to_be_default_match = true; |
468 | 468 |
469 // The placeholder suggestion for the current URL has high relevance so | 469 // The placeholder suggestion for the current URL has high relevance so |
470 // that it is in the first suggestion slot and inline autocompleted. It | 470 // that it is in the first suggestion slot and inline autocompleted. It |
471 // gets dropped as soon as the user types something. | 471 // gets dropped as soon as the user types something. |
472 match.relevance = verbatim_relevance_; | 472 match.relevance = verbatim_relevance_; |
473 | 473 |
474 return match; | 474 return match; |
475 } | 475 } |
OLD | NEW |