Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: components/autofill/core/browser/autofill_download_manager.cc

Issue 1530133005: Refactor VariationsHttpHeaderProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing include to srt_fetcher_win.cc. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/autofill.gypi ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/autofill.gypi ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698