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

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

Issue 6775005: iwyu: Cleanup in the following files: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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) 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 <vector> 9 #include <vector>
9 10
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/rand_util.h" 12 #include "base/rand_util.h"
12 #include "base/stl_util-inl.h" 13 #include "base/stl_util-inl.h"
14 #include "base/string_util.h"
13 #include "chrome/browser/autofill/autofill_metrics.h" 15 #include "chrome/browser/autofill/autofill_metrics.h"
14 #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"
15 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "googleurl/src/gurl.h"
18 #include "net/http/http_response_headers.h" 22 #include "net/http/http_response_headers.h"
23 #include "third_party/libjingle/source/talk/xmllite/xmlparser.h"
dhollowa 2011/03/29 21:36:42 Strange that this was not here before. Do you kno
James Hawkins 2011/03/29 22:42:06 From autofill_xml_parser.h
19 24
20 #define AUTO_FILL_QUERY_SERVER_REQUEST_URL \ 25 #define AUTO_FILL_QUERY_SERVER_REQUEST_URL \
21 "http://toolbarqueries.clients.google.com:80/tbproxy/af/query" 26 "http://toolbarqueries.clients.google.com:80/tbproxy/af/query"
22 #define AUTO_FILL_UPLOAD_SERVER_REQUEST_URL \ 27 #define AUTO_FILL_UPLOAD_SERVER_REQUEST_URL \
23 "http://toolbarqueries.clients.google.com:80/tbproxy/af/upload" 28 "http://toolbarqueries.clients.google.com:80/tbproxy/af/upload"
24 #define AUTO_FILL_QUERY_SERVER_NAME_START_IN_HEADER "GFE/" 29 #define AUTO_FILL_QUERY_SERVER_NAME_START_IN_HEADER "GFE/"
25 30
26 namespace { 31 namespace {
27 const size_t kMaxFormCacheSize = 16; 32 const size_t kMaxFormCacheSize = 16;
28 }; 33 };
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 bool back_off = false; 288 bool back_off = false;
284 std::string server_header; 289 std::string server_header;
285 switch (response_code) { 290 switch (response_code) {
286 case kHttpBadGateway: 291 case kHttpBadGateway:
287 if (!source->response_headers()->EnumerateHeader(NULL, "server", 292 if (!source->response_headers()->EnumerateHeader(NULL, "server",
288 &server_header) || 293 &server_header) ||
289 StartsWithASCII(server_header.c_str(), 294 StartsWithASCII(server_header.c_str(),
290 AUTO_FILL_QUERY_SERVER_NAME_START_IN_HEADER, 295 AUTO_FILL_QUERY_SERVER_NAME_START_IN_HEADER,
291 false) != 0) 296 false) != 0)
292 break; 297 break;
293 // Bad getaway was received from Autofill servers. Fall through to back 298 // Bad gateway was received from Autofill servers. Fall through to back
294 // off. 299 // off.
295 case kHttpInternalServerError: 300 case kHttpInternalServerError:
296 case kHttpServiceUnavailable: 301 case kHttpServiceUnavailable:
297 back_off = true; 302 back_off = true;
298 break; 303 break;
299 } 304 }
300 305
301 if (back_off) { 306 if (back_off) {
302 base::Time back_off_time(base::Time::Now() + source->backoff_delay()); 307 base::Time back_off_time(base::Time::Now() + source->backoff_delay());
303 if (it->second.request_type == AutofillDownloadManager::REQUEST_QUERY) { 308 if (it->second.request_type == AutofillDownloadManager::REQUEST_QUERY) {
(...skipping 29 matching lines...) Expand all
333 SetNegativeUploadRate(new_negative_upload_rate); 338 SetNegativeUploadRate(new_negative_upload_rate);
334 } 339 }
335 340
336 if (observer_) 341 if (observer_)
337 observer_->OnUploadedAutofillHeuristics(it->second.form_signatures[0]); 342 observer_->OnUploadedAutofillHeuristics(it->second.form_signatures[0]);
338 } 343 }
339 } 344 }
340 delete it->first; 345 delete it->first;
341 url_fetchers_.erase(it); 346 url_fetchers_.erase(it);
342 } 347 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698