OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/autofill/autofill_download.h" | 5 #include "chrome/browser/autofill/autofill_download.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <ostream> | 8 #include <ostream> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "chrome/browser/autofill/autofill_metrics.h" | 15 #include "chrome/browser/autofill/autofill_metrics.h" |
16 #include "chrome/browser/autofill/autofill_xml_parser.h" | 16 #include "chrome/browser/autofill/autofill_xml_parser.h" |
17 #include "chrome/browser/autofill/form_structure.h" | 17 #include "chrome/browser/autofill/form_structure.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
21 #include "content/public/common/url_fetcher.h" | 21 #include "content/public/common/url_fetcher.h" |
22 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
| 23 #include "net/base/load_flags.h" |
23 #include "net/http/http_response_headers.h" | 24 #include "net/http/http_response_headers.h" |
24 #include "third_party/libjingle/source/talk/xmllite/xmlparser.h" | 25 #include "third_party/libjingle/source/talk/xmllite/xmlparser.h" |
25 | 26 |
26 namespace { | 27 namespace { |
27 const char kAutofillQueryServerRequestUrl[] = | 28 const char kAutofillQueryServerRequestUrl[] = |
28 "https://toolbarqueries.google.com/tbproxy/af/query"; | 29 "https://toolbarqueries.google.com/tbproxy/af/query"; |
29 const char kAutofillUploadServerRequestUrl[] = | 30 const char kAutofillUploadServerRequestUrl[] = |
30 "https://toolbarqueries.google.com/tbproxy/af/upload"; | 31 "https://toolbarqueries.google.com/tbproxy/af/upload"; |
31 const char kAutofillQueryServerNameStartInHeader[] = "GFE/"; | 32 const char kAutofillQueryServerNameStartInHeader[] = "GFE/"; |
32 | 33 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 164 |
164 // Id is ignored for regular chrome, in unit test id's for fake fetcher | 165 // Id is ignored for regular chrome, in unit test id's for fake fetcher |
165 // factory will be 0, 1, 2, ... | 166 // factory will be 0, 1, 2, ... |
166 content::URLFetcher* fetcher = content::URLFetcher::Create( | 167 content::URLFetcher* fetcher = content::URLFetcher::Create( |
167 fetcher_id_for_unittest_++, GURL(request_url), content::URLFetcher::POST, | 168 fetcher_id_for_unittest_++, GURL(request_url), content::URLFetcher::POST, |
168 this); | 169 this); |
169 url_fetchers_[fetcher] = request_data; | 170 url_fetchers_[fetcher] = request_data; |
170 fetcher->SetAutomaticallyRetryOn5xx(false); | 171 fetcher->SetAutomaticallyRetryOn5xx(false); |
171 fetcher->SetRequestContext(request_context); | 172 fetcher->SetRequestContext(request_context); |
172 fetcher->SetUploadData("text/plain", form_xml); | 173 fetcher->SetUploadData("text/plain", form_xml); |
| 174 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
173 fetcher->Start(); | 175 fetcher->Start(); |
174 return true; | 176 return true; |
175 } | 177 } |
176 | 178 |
177 void AutofillDownloadManager::CacheQueryRequest( | 179 void AutofillDownloadManager::CacheQueryRequest( |
178 const std::vector<std::string>& forms_in_query, | 180 const std::vector<std::string>& forms_in_query, |
179 const std::string& query_data) { | 181 const std::string& query_data) { |
180 std::string signature = GetCombinedSignature(forms_in_query); | 182 std::string signature = GetCombinedSignature(forms_in_query); |
181 for (QueryRequestCache::iterator it = cached_forms_.begin(); | 183 for (QueryRequestCache::iterator it = cached_forms_.begin(); |
182 it != cached_forms_.end(); ++it) { | 184 it != cached_forms_.end(); ++it) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 SetPositiveUploadRate(new_positive_upload_rate); | 301 SetPositiveUploadRate(new_positive_upload_rate); |
300 SetNegativeUploadRate(new_negative_upload_rate); | 302 SetNegativeUploadRate(new_negative_upload_rate); |
301 } | 303 } |
302 | 304 |
303 observer_->OnUploadedPossibleFieldTypes(); | 305 observer_->OnUploadedPossibleFieldTypes(); |
304 } | 306 } |
305 } | 307 } |
306 delete it->first; | 308 delete it->first; |
307 url_fetchers_.erase(it); | 309 url_fetchers_.erase(it); |
308 } | 310 } |
OLD | NEW |