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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "components/autofill/core/browser/autofill_driver.h" | 12 #include "components/autofill/core/browser/autofill_driver.h" |
13 #include "components/autofill/core/browser/autofill_metrics.h" | 13 #include "components/autofill/core/browser/autofill_metrics.h" |
14 #include "components/autofill/core/browser/autofill_xml_parser.h" | 14 #include "components/autofill/core/browser/autofill_xml_parser.h" |
15 #include "components/autofill/core/browser/form_structure.h" | 15 #include "components/autofill/core/browser/form_structure.h" |
16 #include "components/autofill/core/common/autofill_pref_names.h" | 16 #include "components/autofill/core/common/autofill_pref_names.h" |
17 #include "components/data_use_measurement/core/data_use_user_data.h" | |
18 #include "components/variations/net/variations_http_header_provider.h" | 17 #include "components/variations/net/variations_http_header_provider.h" |
19 #include "net/base/load_flags.h" | 18 #include "net/base/load_flags.h" |
20 #include "net/http/http_request_headers.h" | 19 #include "net/http/http_request_headers.h" |
21 #include "net/http/http_response_headers.h" | 20 #include "net/http/http_response_headers.h" |
22 #include "net/url_request/url_fetcher.h" | 21 #include "net/url_request/url_fetcher.h" |
23 #include "third_party/webrtc/libjingle/xmllite/xmlparser.h" | 22 #include "third_party/webrtc/libjingle/xmllite/xmlparser.h" |
24 #include "url/gurl.h" | 23 #include "url/gurl.h" |
25 | 24 |
26 namespace autofill { | 25 namespace autofill { |
27 | 26 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 net::URLRequestContextGetter* request_context = | 176 net::URLRequestContextGetter* request_context = |
178 driver_->GetURLRequestContext(); | 177 driver_->GetURLRequestContext(); |
179 DCHECK(request_context); | 178 DCHECK(request_context); |
180 GURL request_url = GetRequestUrl(request_data.request_type); | 179 GURL request_url = GetRequestUrl(request_data.request_type); |
181 | 180 |
182 // Id is ignored for regular chrome, in unit test id's for fake fetcher | 181 // Id is ignored for regular chrome, in unit test id's for fake fetcher |
183 // factory will be 0, 1, 2, ... | 182 // factory will be 0, 1, 2, ... |
184 net::URLFetcher* fetcher = | 183 net::URLFetcher* fetcher = |
185 net::URLFetcher::Create(fetcher_id_for_unittest_++, request_url, | 184 net::URLFetcher::Create(fetcher_id_for_unittest_++, request_url, |
186 net::URLFetcher::POST, this).release(); | 185 net::URLFetcher::POST, this).release(); |
187 data_use_measurement::DataUseUserData::AttachToFetcher( | |
188 fetcher, data_use_measurement::DataUseUserData::AUTOFILL); | |
189 url_fetchers_[fetcher] = request_data; | 186 url_fetchers_[fetcher] = request_data; |
190 fetcher->SetAutomaticallyRetryOn5xx(false); | 187 fetcher->SetAutomaticallyRetryOn5xx(false); |
191 fetcher->SetRequestContext(request_context); | 188 fetcher->SetRequestContext(request_context); |
192 fetcher->SetUploadData("text/plain", form_xml); | 189 fetcher->SetUploadData("text/plain", form_xml); |
193 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 190 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
194 net::LOAD_DO_NOT_SEND_COOKIES); | 191 net::LOAD_DO_NOT_SEND_COOKIES); |
195 // Add Chrome experiment state to the request headers. | 192 // Add Chrome experiment state to the request headers. |
196 net::HttpRequestHeaders headers; | 193 net::HttpRequestHeaders headers; |
197 variations::VariationsHttpHeaderProvider::GetInstance()->AppendHeaders( | 194 variations::VariationsHttpHeaderProvider::GetInstance()->AppendHeaders( |
198 fetcher->GetOriginalURL(), driver_->IsOffTheRecord(), false, &headers); | 195 fetcher->GetOriginalURL(), driver_->IsOffTheRecord(), false, &headers); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 328 } |
332 | 329 |
333 observer_->OnUploadedPossibleFieldTypes(); | 330 observer_->OnUploadedPossibleFieldTypes(); |
334 } | 331 } |
335 } | 332 } |
336 delete it->first; | 333 delete it->first; |
337 url_fetchers_.erase(it); | 334 url_fetchers_.erase(it); |
338 } | 335 } |
339 | 336 |
340 } // namespace autofill | 337 } // namespace autofill |
OLD | NEW |