| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); | 416 net::URLFetcher::Create(0, url, net::URLFetcher::GET, this); |
| 417 data_use_measurement::DataUseUserData::AttachToFetcher( | 417 data_use_measurement::DataUseUserData::AttachToFetcher( |
| 418 request.get(), data_use_measurement::DataUseUserData::SUGGESTIONS); | 418 request.get(), data_use_measurement::DataUseUserData::SUGGESTIONS); |
| 419 int load_flags = net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SEND_COOKIES | | 419 int load_flags = net::LOAD_DISABLE_CACHE | net::LOAD_DO_NOT_SEND_COOKIES | |
| 420 net::LOAD_DO_NOT_SAVE_COOKIES; | 420 net::LOAD_DO_NOT_SAVE_COOKIES; |
| 421 | 421 |
| 422 request->SetLoadFlags(load_flags); | 422 request->SetLoadFlags(load_flags); |
| 423 request->SetRequestContext(url_request_context_); | 423 request->SetRequestContext(url_request_context_); |
| 424 // Add Chrome experiment state to the request headers. | 424 // Add Chrome experiment state to the request headers. |
| 425 net::HttpRequestHeaders headers; | 425 net::HttpRequestHeaders headers; |
| 426 // Note: It's fine to pass in |is_signed_in| false, which does not affect |
| 427 // transmission of experiment ids coming from the variations server. |
| 428 bool is_signed_in = false; |
| 426 variations::AppendVariationHeaders(request->GetOriginalURL(), false, false, | 429 variations::AppendVariationHeaders(request->GetOriginalURL(), false, false, |
| 427 &headers); | 430 is_signed_in, &headers); |
| 428 request->SetExtraRequestHeaders(headers.ToString()); | 431 request->SetExtraRequestHeaders(headers.ToString()); |
| 429 if (!access_token.empty()) { | 432 if (!access_token.empty()) { |
| 430 request->AddExtraRequestHeader( | 433 request->AddExtraRequestHeader( |
| 431 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); | 434 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); |
| 432 } | 435 } |
| 433 return request; | 436 return request; |
| 434 } | 437 } |
| 435 | 438 |
| 436 void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { | 439 void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { |
| 437 DCHECK(thread_checker_.CalledOnValidThread()); | 440 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); | 565 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); |
| 563 } else { | 566 } else { |
| 564 TimeDelta candidate_delay = | 567 TimeDelta candidate_delay = |
| 565 scheduling_delay_ * kSchedulingBackoffMultiplier; | 568 scheduling_delay_ * kSchedulingBackoffMultiplier; |
| 566 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) | 569 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) |
| 567 scheduling_delay_ = candidate_delay; | 570 scheduling_delay_ = candidate_delay; |
| 568 } | 571 } |
| 569 } | 572 } |
| 570 | 573 |
| 571 } // namespace suggestions | 574 } // namespace suggestions |
| OLD | NEW |