OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/suggestions/suggestions_service.h" | 5 #include "components/suggestions/suggestions_service.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); | 413 net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); |
414 data_use_measurement::DataUseUserData::AttachToFetcher( | 414 data_use_measurement::DataUseUserData::AttachToFetcher( |
415 request.get(), data_use_measurement::DataUseUserData::SUGGESTIONS); | 415 request.get(), data_use_measurement::DataUseUserData::SUGGESTIONS); |
416 int load_flags = net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SEND_COOKIES | | 416 int load_flags = net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SEND_COOKIES | |
417 net::LOAD_DO_NOT_SAVE_COOKIES; | 417 net::LOAD_DO_NOT_SAVE_COOKIES; |
418 | 418 |
419 request->SetLoadFlags(load_flags); | 419 request->SetLoadFlags(load_flags); |
420 request->SetRequestContext(url_request_context_); | 420 request->SetRequestContext(url_request_context_); |
421 // Add Chrome experiment state to the request headers. | 421 // Add Chrome experiment state to the request headers. |
422 net::HttpRequestHeaders headers; | 422 net::HttpRequestHeaders headers; |
| 423 // Note: It's fine to pass in |is_signed_in| false, which does not affect |
| 424 // transmission of experiment ids coming from the variations server. |
| 425 bool is_signed_in = false; |
423 variations::AppendVariationHeaders(request->GetOriginalURL(), false, false, | 426 variations::AppendVariationHeaders(request->GetOriginalURL(), false, false, |
424 &headers); | 427 is_signed_in, &headers); |
425 request->SetExtraRequestHeaders(headers.ToString()); | 428 request->SetExtraRequestHeaders(headers.ToString()); |
426 if (!access_token.empty()) { | 429 if (!access_token.empty()) { |
427 request->AddExtraRequestHeader( | 430 request->AddExtraRequestHeader( |
428 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); | 431 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); |
429 } | 432 } |
430 return request; | 433 return request; |
431 } | 434 } |
432 | 435 |
433 void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { | 436 void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { |
434 DCHECK(thread_checker_.CalledOnValidThread()); | 437 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); | 552 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); |
550 } else { | 553 } else { |
551 TimeDelta candidate_delay = | 554 TimeDelta candidate_delay = |
552 scheduling_delay_ * kSchedulingBackoffMultiplier; | 555 scheduling_delay_ * kSchedulingBackoffMultiplier; |
553 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) | 556 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) |
554 scheduling_delay_ = candidate_delay; | 557 scheduling_delay_ = candidate_delay; |
555 } | 558 } |
556 } | 559 } |
557 | 560 |
558 } // namespace suggestions | 561 } // namespace suggestions |
OLD | NEW |