Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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://clients1.google.com/tbproxy/af/query?client="; | 29 "https://clients1.google.com/tbproxy/af/query?client="; |
| 29 const char kAutofillUploadServerRequestUrl[] = | 30 const char kAutofillUploadServerRequestUrl[] = |
| 30 "https://clients1.google.com/tbproxy/af/upload?client="; | 31 "https://clients1.google.com/tbproxy/af/upload?client="; |
| 31 const char kAutofillQueryServerNameStartInHeader[] = "GFE/"; | 32 const char kAutofillQueryServerNameStartInHeader[] = "GFE/"; |
| 32 | 33 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 | 171 |
| 171 // Id is ignored for regular chrome, in unit test id's for fake fetcher | 172 // Id is ignored for regular chrome, in unit test id's for fake fetcher |
| 172 // factory will be 0, 1, 2, ... | 173 // factory will be 0, 1, 2, ... |
| 173 content::URLFetcher* fetcher = content::URLFetcher::Create( | 174 content::URLFetcher* fetcher = content::URLFetcher::Create( |
| 174 fetcher_id_for_unittest_++, GURL(request_url), content::URLFetcher::POST, | 175 fetcher_id_for_unittest_++, GURL(request_url), content::URLFetcher::POST, |
| 175 this); | 176 this); |
| 176 url_fetchers_[fetcher] = request_data; | 177 url_fetchers_[fetcher] = request_data; |
| 177 fetcher->SetAutomaticallyRetryOn5xx(false); | 178 fetcher->SetAutomaticallyRetryOn5xx(false); |
| 178 fetcher->SetRequestContext(request_context); | 179 fetcher->SetRequestContext(request_context); |
| 179 fetcher->SetUploadData("text/plain", form_xml); | 180 fetcher->SetUploadData("text/plain", form_xml); |
| 181 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | |
|
Ilya Sherman
2012/02/29 22:45:27
Do we want net::LOAD_DO_NOT_SEND_COOKIES as well?
jochen (gone - plz use gerrit)
2012/02/29 22:52:26
I don't know this code enough. I'd like to merge t
Ilya Sherman
2012/02/29 22:58:28
I'm fairly sure not sending cookies should be safe
GeorgeY
2012/02/29 23:09:52
Yes, Autofill does not use cookies at all, so it i
| |
| 180 fetcher->Start(); | 182 fetcher->Start(); |
| 181 return true; | 183 return true; |
| 182 } | 184 } |
| 183 | 185 |
| 184 void AutofillDownloadManager::CacheQueryRequest( | 186 void AutofillDownloadManager::CacheQueryRequest( |
| 185 const std::vector<std::string>& forms_in_query, | 187 const std::vector<std::string>& forms_in_query, |
| 186 const std::string& query_data) { | 188 const std::string& query_data) { |
| 187 std::string signature = GetCombinedSignature(forms_in_query); | 189 std::string signature = GetCombinedSignature(forms_in_query); |
| 188 for (QueryRequestCache::iterator it = cached_forms_.begin(); | 190 for (QueryRequestCache::iterator it = cached_forms_.begin(); |
| 189 it != cached_forms_.end(); ++it) { | 191 it != cached_forms_.end(); ++it) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 SetPositiveUploadRate(new_positive_upload_rate); | 308 SetPositiveUploadRate(new_positive_upload_rate); |
| 307 SetNegativeUploadRate(new_negative_upload_rate); | 309 SetNegativeUploadRate(new_negative_upload_rate); |
| 308 } | 310 } |
| 309 | 311 |
| 310 observer_->OnUploadedPossibleFieldTypes(); | 312 observer_->OnUploadedPossibleFieldTypes(); |
| 311 } | 313 } |
| 312 } | 314 } |
| 313 delete it->first; | 315 delete it->first; |
| 314 url_fetchers_.erase(it); | 316 url_fetchers_.erase(it); |
| 315 } | 317 } |
| OLD | NEW |