OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/search_provider.h" | 5 #include "components/omnibox/browser/search_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 LogOmniboxSuggestRequest(REQUEST_SENT); | 883 LogOmniboxSuggestRequest(REQUEST_SENT); |
884 | 884 |
885 std::unique_ptr<net::URLFetcher> fetcher = | 885 std::unique_ptr<net::URLFetcher> fetcher = |
886 net::URLFetcher::Create(id, suggest_url, net::URLFetcher::GET, this); | 886 net::URLFetcher::Create(id, suggest_url, net::URLFetcher::GET, this); |
887 data_use_measurement::DataUseUserData::AttachToFetcher( | 887 data_use_measurement::DataUseUserData::AttachToFetcher( |
888 fetcher.get(), data_use_measurement::DataUseUserData::OMNIBOX); | 888 fetcher.get(), data_use_measurement::DataUseUserData::OMNIBOX); |
889 fetcher->SetRequestContext(client()->GetRequestContext()); | 889 fetcher->SetRequestContext(client()->GetRequestContext()); |
890 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 890 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
891 // Add Chrome experiment state to the request headers. | 891 // Add Chrome experiment state to the request headers. |
892 net::HttpRequestHeaders headers; | 892 net::HttpRequestHeaders headers; |
893 // Note: It's fine to pass in |is_signed_in| false, which does not affect | 893 // Note: It's OK to pass |is_signed_in| false if it's unknown, as it does |
894 // transmission of experiment ids coming from the variations server. | 894 // not affect transmission of experiments coming from the variations server. |
895 bool is_signed_in = false; | 895 bool is_signed_in = false; |
896 variations::AppendVariationHeaders(fetcher->GetOriginalURL(), | 896 variations::AppendVariationHeaders(fetcher->GetOriginalURL(), |
897 client()->IsOffTheRecord(), false, | 897 client()->IsOffTheRecord(), false, |
898 is_signed_in, &headers); | 898 is_signed_in, &headers); |
899 fetcher->SetExtraRequestHeaders(headers.ToString()); | 899 fetcher->SetExtraRequestHeaders(headers.ToString()); |
900 fetcher->Start(); | 900 fetcher->Start(); |
901 return fetcher; | 901 return fetcher; |
902 } | 902 } |
903 | 903 |
904 void SearchProvider::ConvertResultsToAutocompleteMatches() { | 904 void SearchProvider::ConvertResultsToAutocompleteMatches() { |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) | 1500 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) |
1501 matches.push_back(i->second); | 1501 matches.push_back(i->second); |
1502 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); | 1502 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); |
1503 | 1503 |
1504 // If there is a top scoring entry, find the corresponding answer. | 1504 // If there is a top scoring entry, find the corresponding answer. |
1505 if (!matches.empty()) | 1505 if (!matches.empty()) |
1506 return answers_cache_.GetTopAnswerEntry(matches[0].contents); | 1506 return answers_cache_.GetTopAnswerEntry(matches[0].contents); |
1507 | 1507 |
1508 return AnswersQueryData(); | 1508 return AnswersQueryData(); |
1509 } | 1509 } |
OLD | NEW |