| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 variations::AppendVariationHeaders(request->GetOriginalURL(), false, false, | 423 variations::AppendVariationHeaders(request->GetOriginalURL(), false, false, |
| 424 &headers); | 424 false, &headers); |
| 425 request->SetExtraRequestHeaders(headers.ToString()); | 425 request->SetExtraRequestHeaders(headers.ToString()); |
| 426 if (!access_token.empty()) { | 426 if (!access_token.empty()) { |
| 427 request->AddExtraRequestHeader( | 427 request->AddExtraRequestHeader( |
| 428 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); | 428 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); |
| 429 } | 429 } |
| 430 return request; | 430 return request; |
| 431 } | 431 } |
| 432 | 432 |
| 433 void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { | 433 void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { |
| 434 DCHECK(thread_checker_.CalledOnValidThread()); | 434 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); | 549 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); |
| 550 } else { | 550 } else { |
| 551 TimeDelta candidate_delay = | 551 TimeDelta candidate_delay = |
| 552 scheduling_delay_ * kSchedulingBackoffMultiplier; | 552 scheduling_delay_ * kSchedulingBackoffMultiplier; |
| 553 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) | 553 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) |
| 554 scheduling_delay_ = candidate_delay; | 554 scheduling_delay_ = candidate_delay; |
| 555 } | 555 } |
| 556 } | 556 } |
| 557 | 557 |
| 558 } // namespace suggestions | 558 } // namespace suggestions |
| OLD | NEW |