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_impl.h" | 5 #include "components/suggestions/suggestions_service_impl.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 | 426 // Note: It's OK to pass |is_signed_in| false if it's unknown, as it does |
427 // transmission of experiment ids coming from the variations server. | 427 // not affect transmission of experiments coming from the variations server. |
428 bool is_signed_in = false; | 428 bool is_signed_in = false; |
429 variations::AppendVariationHeaders(request->GetOriginalURL(), false, false, | 429 variations::AppendVariationHeaders(request->GetOriginalURL(), false, false, |
430 is_signed_in, &headers); | 430 is_signed_in, &headers); |
431 request->SetExtraRequestHeaders(headers.ToString()); | 431 request->SetExtraRequestHeaders(headers.ToString()); |
432 if (!access_token.empty()) { | 432 if (!access_token.empty()) { |
433 request->AddExtraRequestHeader( | 433 request->AddExtraRequestHeader( |
434 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); | 434 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); |
435 } | 435 } |
436 return request; | 436 return request; |
437 } | 437 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); | 558 scheduling_delay_ = TimeDelta::FromSeconds(kDefaultSchedulingDelaySec); |
559 } else { | 559 } else { |
560 TimeDelta candidate_delay = | 560 TimeDelta candidate_delay = |
561 scheduling_delay_ * kSchedulingBackoffMultiplier; | 561 scheduling_delay_ * kSchedulingBackoffMultiplier; |
562 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) | 562 if (candidate_delay < TimeDelta::FromSeconds(kSchedulingMaxDelaySec)) |
563 scheduling_delay_ = candidate_delay; | 563 scheduling_delay_ = candidate_delay; |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 } // namespace suggestions | 567 } // namespace suggestions |
OLD | NEW |