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

Side by Side Diff: chrome/browser/autofill/autofill_download.cc

Issue 10554008: Move content::URLFetcher static functions to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win link error Created 8 years, 6 months 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 | Annotate | Revision Log
OLDNEW
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"
22 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
23 #include "net/base/load_flags.h" 22 #include "net/base/load_flags.h"
24 #include "net/http/http_response_headers.h" 23 #include "net/http/http_response_headers.h"
24 #include "net/url_request/url_fetcher.h"
25 #include "third_party/libjingle/source/talk/xmllite/xmlparser.h" 25 #include "third_party/libjingle/source/talk/xmllite/xmlparser.h"
26 26
27 namespace { 27 namespace {
28 const char kAutofillQueryServerRequestUrl[] = 28 const char kAutofillQueryServerRequestUrl[] =
29 "https://clients1.google.com/tbproxy/af/query?client="; 29 "https://clients1.google.com/tbproxy/af/query?client=";
30 const char kAutofillUploadServerRequestUrl[] = 30 const char kAutofillUploadServerRequestUrl[] =
31 "https://clients1.google.com/tbproxy/af/upload?client="; 31 "https://clients1.google.com/tbproxy/af/upload?client=";
32 const char kAutofillQueryServerNameStartInHeader[] = "GFE/"; 32 const char kAutofillQueryServerNameStartInHeader[] = "GFE/";
33 33
34 #if defined(GOOGLE_CHROME_BUILD) 34 #if defined(GOOGLE_CHROME_BUILD)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 DCHECK(request_context); 164 DCHECK(request_context);
165 std::string request_url; 165 std::string request_url;
166 if (request_data.request_type == AutofillDownloadManager::REQUEST_QUERY) 166 if (request_data.request_type == AutofillDownloadManager::REQUEST_QUERY)
167 request_url = kAutofillQueryServerRequestUrl; 167 request_url = kAutofillQueryServerRequestUrl;
168 else 168 else
169 request_url = kAutofillUploadServerRequestUrl; 169 request_url = kAutofillUploadServerRequestUrl;
170 request_url += kClientName; 170 request_url += kClientName;
171 171
172 // 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
173 // factory will be 0, 1, 2, ... 173 // factory will be 0, 1, 2, ...
174 net::URLFetcher* fetcher = content::URLFetcher::Create( 174 net::URLFetcher* fetcher = net::URLFetcher::Create(
175 fetcher_id_for_unittest_++, GURL(request_url), net::URLFetcher::POST, 175 fetcher_id_for_unittest_++, GURL(request_url), net::URLFetcher::POST,
176 this); 176 this);
177 url_fetchers_[fetcher] = request_data; 177 url_fetchers_[fetcher] = request_data;
178 fetcher->SetAutomaticallyRetryOn5xx(false); 178 fetcher->SetAutomaticallyRetryOn5xx(false);
179 fetcher->SetRequestContext(request_context); 179 fetcher->SetRequestContext(request_context);
180 fetcher->SetUploadData("text/plain", form_xml); 180 fetcher->SetUploadData("text/plain", form_xml);
181 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 181 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
182 net::LOAD_DO_NOT_SEND_COOKIES); 182 net::LOAD_DO_NOT_SEND_COOKIES);
183 fetcher->Start(); 183 fetcher->Start();
184 return true; 184 return true;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 SetPositiveUploadRate(new_positive_upload_rate); 309 SetPositiveUploadRate(new_positive_upload_rate);
310 SetNegativeUploadRate(new_negative_upload_rate); 310 SetNegativeUploadRate(new_negative_upload_rate);
311 } 311 }
312 312
313 observer_->OnUploadedPossibleFieldTypes(); 313 observer_->OnUploadedPossibleFieldTypes();
314 } 314 }
315 } 315 }
316 delete it->first; 316 delete it->first;
317 url_fetchers_.erase(it); 317 url_fetchers_.erase(it);
318 } 318 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/search_provider.cc ('k') | chrome/browser/captive_portal/captive_portal_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698