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

Side by Side Diff: components/omnibox/browser/search_provider.cc

Issue 2558913003: Restrict transmission of external exp ids to signed in users. (Closed)
Patch Set: Address nit. Created 4 years 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
OLDNEW
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
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 variations::AppendVariationHeaders( 893 // Note: It's fine to pass in |is_signed_in| false, which does not affect
894 fetcher->GetOriginalURL(), client()->IsOffTheRecord(), false, &headers); 894 // transmission of experiment ids coming from the variations server.
895 bool is_signed_in = false;
896 variations::AppendVariationHeaders(fetcher->GetOriginalURL(),
897 client()->IsOffTheRecord(), false,
898 is_signed_in, &headers);
895 fetcher->SetExtraRequestHeaders(headers.ToString()); 899 fetcher->SetExtraRequestHeaders(headers.ToString());
896 fetcher->Start(); 900 fetcher->Start();
897 return fetcher; 901 return fetcher;
898 } 902 }
899 903
900 void SearchProvider::ConvertResultsToAutocompleteMatches() { 904 void SearchProvider::ConvertResultsToAutocompleteMatches() {
901 // Convert all the results to matches and add them to a map, so we can keep 905 // Convert all the results to matches and add them to a map, so we can keep
902 // the most relevant match for each result. 906 // the most relevant match for each result.
903 base::TimeTicks start_time(base::TimeTicks::Now()); 907 base::TimeTicks start_time(base::TimeTicks::Now());
904 MatchMap map; 908 MatchMap map;
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) 1500 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i)
1497 matches.push_back(i->second); 1501 matches.push_back(i->second);
1498 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); 1502 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant);
1499 1503
1500 // If there is a top scoring entry, find the corresponding answer. 1504 // If there is a top scoring entry, find the corresponding answer.
1501 if (!matches.empty()) 1505 if (!matches.empty())
1502 return answers_cache_.GetTopAnswerEntry(matches[0].contents); 1506 return answers_cache_.GetTopAnswerEntry(matches[0].contents);
1503 1507
1504 return AnswersQueryData(); 1508 return AnswersQueryData();
1505 } 1509 }
OLDNEW
« no previous file with comments | « components/ntp_snippets/remote/ntp_snippets_fetcher.cc ('k') | components/omnibox/browser/zero_suggest_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698