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