| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/autofill_download.h" | 5 #include "components/autofill/core/browser/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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 const char kAutofillQueryServerNameStartInHeader[] = "GFE/"; | 34 const char kAutofillQueryServerNameStartInHeader[] = "GFE/"; |
| 35 | 35 |
| 36 const size_t kMaxFormCacheSize = 16; | 36 const size_t kMaxFormCacheSize = 16; |
| 37 | 37 |
| 38 // Generate field assignments xml that can be manually changed and then fed back | 38 // Generate field assignments xml that can be manually changed and then fed back |
| 39 // into the Autofill server as experiment data. | 39 // into the Autofill server as experiment data. |
| 40 static void LogFieldAssignments( | 40 static void LogFieldAssignments( |
| 41 const FormStructure& form, | 41 const FormStructure& form, |
| 42 const FieldTypeSet& available_field_types) { | 42 const ServerFieldTypeSet& available_field_types) { |
| 43 std::string form_xml; | 43 std::string form_xml; |
| 44 if (!form.EncodeFieldAssignments(available_field_types, &form_xml)) | 44 if (!form.EncodeFieldAssignments(available_field_types, &form_xml)) |
| 45 return; | 45 return; |
| 46 | 46 |
| 47 VLOG(1) << "AutofillDownloadManager FieldAssignments for " | 47 VLOG(1) << "AutofillDownloadManager FieldAssignments for " |
| 48 << form.source_url() | 48 << form.source_url() |
| 49 << " :\n" | 49 << " :\n" |
| 50 << form_xml; | 50 << form_xml; |
| 51 } | 51 } |
| 52 | 52 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 observer_->OnLoadedServerPredictions(query_data); | 117 observer_->OnLoadedServerPredictions(query_data); |
| 118 return true; | 118 return true; |
| 119 } | 119 } |
| 120 | 120 |
| 121 return StartRequest(form_xml, request_data); | 121 return StartRequest(form_xml, request_data); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool AutofillDownloadManager::StartUploadRequest( | 124 bool AutofillDownloadManager::StartUploadRequest( |
| 125 const FormStructure& form, | 125 const FormStructure& form, |
| 126 bool form_was_autofilled, | 126 bool form_was_autofilled, |
| 127 const FieldTypeSet& available_field_types) { | 127 const ServerFieldTypeSet& available_field_types) { |
| 128 std::string form_xml; | 128 std::string form_xml; |
| 129 if (!form.EncodeUploadRequest(available_field_types, form_was_autofilled, | 129 if (!form.EncodeUploadRequest(available_field_types, form_was_autofilled, |
| 130 &form_xml)) | 130 &form_xml)) |
| 131 return false; | 131 return false; |
| 132 | 132 |
| 133 LogFieldAssignments(form, available_field_types); | 133 LogFieldAssignments(form, available_field_types); |
| 134 | 134 |
| 135 if (next_upload_request_ > base::Time::Now()) { | 135 if (next_upload_request_ > base::Time::Now()) { |
| 136 // We are in back-off mode: do not do the request. | 136 // We are in back-off mode: do not do the request. |
| 137 DVLOG(1) << "AutofillDownloadManager: Upload request is throttled."; | 137 DVLOG(1) << "AutofillDownloadManager: Upload request is throttled."; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 } | 343 } |
| 344 | 344 |
| 345 observer_->OnUploadedPossibleFieldTypes(); | 345 observer_->OnUploadedPossibleFieldTypes(); |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 delete it->first; | 348 delete it->first; |
| 349 url_fetchers_.erase(it); | 349 url_fetchers_.erase(it); |
| 350 } | 350 } |
| 351 | 351 |
| 352 } // namespace autofill | 352 } // namespace autofill |
| OLD | NEW |