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

Side by Side Diff: components/omnibox/browser/zero_suggest_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 (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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } else { 326 } else {
327 const int kFetcherID = 1; 327 const int kFetcherID = 1;
328 fetcher_ = net::URLFetcher::Create(kFetcherID, suggest_url, 328 fetcher_ = net::URLFetcher::Create(kFetcherID, suggest_url,
329 net::URLFetcher::GET, this); 329 net::URLFetcher::GET, this);
330 data_use_measurement::DataUseUserData::AttachToFetcher( 330 data_use_measurement::DataUseUserData::AttachToFetcher(
331 fetcher_.get(), data_use_measurement::DataUseUserData::OMNIBOX); 331 fetcher_.get(), data_use_measurement::DataUseUserData::OMNIBOX);
332 fetcher_->SetRequestContext(client()->GetRequestContext()); 332 fetcher_->SetRequestContext(client()->GetRequestContext());
333 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); 333 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES);
334 // Add Chrome experiment state to the request headers. 334 // Add Chrome experiment state to the request headers.
335 net::HttpRequestHeaders headers; 335 net::HttpRequestHeaders headers;
336 // Note: It's fine to pass in |is_signed_in| false, which does not affect
337 // transmission of experiment ids coming from the variations server.
338 bool is_signed_in = false;
336 variations::AppendVariationHeaders(fetcher_->GetOriginalURL(), 339 variations::AppendVariationHeaders(fetcher_->GetOriginalURL(),
337 client()->IsOffTheRecord(), false, 340 client()->IsOffTheRecord(), false,
338 &headers); 341 is_signed_in, &headers);
339 fetcher_->SetExtraRequestHeaders(headers.ToString()); 342 fetcher_->SetExtraRequestHeaders(headers.ToString());
340 fetcher_->Start(); 343 fetcher_->Start();
341 LogOmniboxZeroSuggestRequest(ZERO_SUGGEST_REQUEST_SENT); 344 LogOmniboxZeroSuggestRequest(ZERO_SUGGEST_REQUEST_SENT);
342 } 345 }
343 } 346 }
344 347
345 void ZeroSuggestProvider::OnMostVisitedUrlsAvailable( 348 void ZeroSuggestProvider::OnMostVisitedUrlsAvailable(
346 const history::MostVisitedURLList& urls) { 349 const history::MostVisitedURLList& urls) {
347 if (!waiting_for_most_visited_urls_request_) return; 350 if (!waiting_for_most_visited_urls_request_) return;
348 most_visited_urls_ = urls; 351 most_visited_urls_ = urls;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 if (!json_data.empty()) { 474 if (!json_data.empty()) {
472 std::unique_ptr<base::Value> data( 475 std::unique_ptr<base::Value> data(
473 SearchSuggestionParser::DeserializeJsonData(json_data)); 476 SearchSuggestionParser::DeserializeJsonData(json_data));
474 if (data && ParseSuggestResults( 477 if (data && ParseSuggestResults(
475 *data, kDefaultZeroSuggestRelevance, false, &results_)) { 478 *data, kDefaultZeroSuggestRelevance, false, &results_)) {
476 ConvertResultsToAutocompleteMatches(); 479 ConvertResultsToAutocompleteMatches();
477 results_from_cache_ = !matches_.empty(); 480 results_from_cache_ = !matches_.empty();
478 } 481 }
479 } 482 }
480 } 483 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/search_provider.cc ('k') | components/suggestions/suggestions_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698