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

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

Issue 6931029: Set datapresent string to contain precisely those field types available in stored Autofill data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Signed and delivered Created 9 years, 7 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 <ostream>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 << "the cache"; 94 << "the cache";
95 if (observer_) 95 if (observer_)
96 observer_->OnLoadedAutofillHeuristics(query_data); 96 observer_->OnLoadedAutofillHeuristics(query_data);
97 return true; 97 return true;
98 } 98 }
99 99
100 return StartRequest(form_xml, request_data); 100 return StartRequest(form_xml, request_data);
101 } 101 }
102 102
103 bool AutofillDownloadManager::StartUploadRequest( 103 bool AutofillDownloadManager::StartUploadRequest(
104 const FormStructure& form, bool form_was_matched) { 104 const FormStructure& form,
105 bool form_was_autofilled,
106 const FieldTypeSet& available_field_types) {
105 if (next_upload_request_ > base::Time::Now()) { 107 if (next_upload_request_ > base::Time::Now()) {
106 // We are in back-off mode: do not do the request. 108 // We are in back-off mode: do not do the request.
109 VLOG(1) << "AutofillDownloadManager: Upload request is throttled.";
107 return false; 110 return false;
108 } 111 }
109 112
110 // Check if we need to upload form. 113 // Flip a coin to see if we should upload this form.
111 double upload_rate = form_was_matched ? GetPositiveUploadRate() : 114 double upload_rate = form_was_autofilled ? GetPositiveUploadRate() :
112 GetNegativeUploadRate(); 115 GetNegativeUploadRate();
113 if (base::RandDouble() > upload_rate) { 116 if (base::RandDouble() > upload_rate) {
114 VLOG(1) << "AutofillDownloadManager: Upload request is ignored"; 117 VLOG(1) << "AutofillDownloadManager: Upload request is ignored.";
115 // If we ever need notification that upload was skipped, add it here. 118 // If we ever need notification that upload was skipped, add it here.
116 return false; 119 return false;
117 } 120 }
121
118 std::string form_xml; 122 std::string form_xml;
119 if (!form.EncodeUploadRequest(form_was_matched, &form_xml)) 123 if (!form.EncodeUploadRequest(available_field_types, form_was_autofilled,
124 &form_xml))
120 return false; 125 return false;
121 126
122 FormRequestData request_data; 127 FormRequestData request_data;
123 request_data.form_signatures.push_back(form.FormSignature()); 128 request_data.form_signatures.push_back(form.FormSignature());
124 request_data.request_type = AutofillDownloadManager::REQUEST_UPLOAD; 129 request_data.request_type = AutofillDownloadManager::REQUEST_UPLOAD;
125 130
126 return StartRequest(form_xml, request_data); 131 return StartRequest(form_xml, request_data);
127 } 132 }
128 133
129 bool AutofillDownloadManager::CancelRequest( 134 bool AutofillDownloadManager::CancelRequest(
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 SetNegativeUploadRate(new_negative_upload_rate); 343 SetNegativeUploadRate(new_negative_upload_rate);
339 } 344 }
340 345
341 if (observer_) 346 if (observer_)
342 observer_->OnUploadedAutofillHeuristics(it->second.form_signatures[0]); 347 observer_->OnUploadedAutofillHeuristics(it->second.form_signatures[0]);
343 } 348 }
344 } 349 }
345 delete it->first; 350 delete it->first;
346 url_fetchers_.erase(it); 351 url_fetchers_.erase(it);
347 } 352 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_download.h ('k') | chrome/browser/autofill/autofill_download_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698