| 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/autofill/core/browser/autofill_download_manager.h" | 5 #include "components/autofill/core/browser/autofill_download_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/numerics/safe_conversions.h" | 12 #include "base/numerics/safe_conversions.h" |
| 12 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 16 #include "components/autofill/core/browser/autofill_driver.h" | 17 #include "components/autofill/core/browser/autofill_driver.h" |
| 17 #include "components/autofill/core/browser/autofill_metrics.h" | 18 #include "components/autofill/core/browser/autofill_metrics.h" |
| 18 #include "components/autofill/core/browser/autofill_xml_parser.h" | 19 #include "components/autofill/core/browser/autofill_xml_parser.h" |
| 19 #include "components/autofill/core/browser/form_structure.h" | 20 #include "components/autofill/core/browser/form_structure.h" |
| 20 #include "components/autofill/core/common/autofill_pref_names.h" | 21 #include "components/autofill/core/common/autofill_pref_names.h" |
| 21 #include "components/compression/compression_utils.h" | 22 #include "components/compression/compression_utils.h" |
| 22 #include "components/data_use_measurement/core/data_use_user_data.h" | 23 #include "components/data_use_measurement/core/data_use_user_data.h" |
| 23 #include "components/variations/net/variations_http_header_provider.h" | 24 #include "components/variations/net/variations_http_headers.h" |
| 24 #include "net/base/load_flags.h" | 25 #include "net/base/load_flags.h" |
| 25 #include "net/http/http_request_headers.h" | 26 #include "net/http/http_request_headers.h" |
| 26 #include "net/http/http_response_headers.h" | 27 #include "net/http/http_response_headers.h" |
| 27 #include "net/http/http_status_code.h" | 28 #include "net/http/http_status_code.h" |
| 28 #include "net/url_request/url_fetcher.h" | 29 #include "net/url_request/url_fetcher.h" |
| 29 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 30 | 31 |
| 31 namespace autofill { | 32 namespace autofill { |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 fetcher, data_use_measurement::DataUseUserData::AUTOFILL); | 199 fetcher, data_use_measurement::DataUseUserData::AUTOFILL); |
| 199 url_fetchers_[fetcher] = request_data; | 200 url_fetchers_[fetcher] = request_data; |
| 200 fetcher->SetAutomaticallyRetryOn5xx(false); | 201 fetcher->SetAutomaticallyRetryOn5xx(false); |
| 201 fetcher->SetRequestContext(request_context); | 202 fetcher->SetRequestContext(request_context); |
| 202 fetcher->SetUploadData("text/xml", compressed_data); | 203 fetcher->SetUploadData("text/xml", compressed_data); |
| 203 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 204 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
| 204 net::LOAD_DO_NOT_SEND_COOKIES); | 205 net::LOAD_DO_NOT_SEND_COOKIES); |
| 205 // Add Chrome experiment state and GZIP encoding to the request headers. | 206 // Add Chrome experiment state and GZIP encoding to the request headers. |
| 206 net::HttpRequestHeaders headers; | 207 net::HttpRequestHeaders headers; |
| 207 headers.SetHeaderIfMissing("content-encoding", "gzip"); | 208 headers.SetHeaderIfMissing("content-encoding", "gzip"); |
| 208 variations::VariationsHttpHeaderProvider::GetInstance()->AppendHeaders( | 209 variations::AppendVariationHeaders( |
| 209 fetcher->GetOriginalURL(), driver_->IsOffTheRecord(), false, &headers); | 210 fetcher->GetOriginalURL(), driver_->IsOffTheRecord(), false, &headers); |
| 210 fetcher->SetExtraRequestHeaders(headers.ToString()); | 211 fetcher->SetExtraRequestHeaders(headers.ToString()); |
| 211 fetcher->Start(); | 212 fetcher->Start(); |
| 212 | 213 |
| 213 VLOG(1) << "Sending AutofillDownloadManager " | 214 VLOG(1) << "Sending AutofillDownloadManager " |
| 214 << RequestTypeToString(request_data.request_type) | 215 << RequestTypeToString(request_data.request_type) |
| 215 << " request (compression " << compression_ratio | 216 << " request (compression " << compression_ratio |
| 216 << "): " << request_data.payload; | 217 << "): " << request_data.payload; |
| 217 | 218 |
| 218 return true; | 219 return true; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 it->second.form_signatures); | 312 it->second.form_signatures); |
| 312 } else { | 313 } else { |
| 313 observer_->OnUploadedPossibleFieldTypes(); | 314 observer_->OnUploadedPossibleFieldTypes(); |
| 314 } | 315 } |
| 315 } | 316 } |
| 316 delete it->first; | 317 delete it->first; |
| 317 url_fetchers_.erase(it); | 318 url_fetchers_.erase(it); |
| 318 } | 319 } |
| 319 | 320 |
| 320 } // namespace autofill | 321 } // namespace autofill |
| OLD | NEW |