OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_manager.h" | 5 #include "chrome/browser/autofill/autofill_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 kAutoFillNegativeUploadRateDefaultValue); | 110 kAutoFillNegativeUploadRateDefaultValue); |
111 } | 111 } |
112 | 112 |
113 void AutoFillManager::FormSubmitted(const FormData& form) { | 113 void AutoFillManager::FormSubmitted(const FormData& form) { |
114 if (!IsAutoFillEnabled()) | 114 if (!IsAutoFillEnabled()) |
115 return; | 115 return; |
116 | 116 |
117 if (tab_contents_->profile()->IsOffTheRecord()) | 117 if (tab_contents_->profile()->IsOffTheRecord()) |
118 return; | 118 return; |
119 | 119 |
| 120 // Don't save data that was submitted through JavaScript. |
| 121 if (!form.user_submitted) |
| 122 return; |
| 123 |
120 // Grab a copy of the form data. | 124 // Grab a copy of the form data. |
121 upload_form_structure_.reset(new FormStructure(form)); | 125 upload_form_structure_.reset(new FormStructure(form)); |
122 | 126 |
123 if (!upload_form_structure_->IsAutoFillable()) | 127 if (!upload_form_structure_->IsAutoFillable()) |
124 return; | 128 return; |
125 | 129 |
126 // Determine the possible field types and upload the form structure to the | 130 // Determine the possible field types and upload the form structure to the |
127 // PersonalDataManager. | 131 // PersonalDataManager. |
128 DeterminePossibleFieldTypes(upload_form_structure_.get()); | 132 DeterminePossibleFieldTypes(upload_form_structure_.get()); |
129 HandleSubmit(); | 133 HandleSubmit(); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 continue; | 711 continue; |
708 | 712 |
709 DeterminePossibleFieldTypes(form_structure); | 713 DeterminePossibleFieldTypes(form_structure); |
710 form_structures_.push_back(form_structure); | 714 form_structures_.push_back(form_structure); |
711 } | 715 } |
712 | 716 |
713 // If none of the forms were parsed, no use querying the server. | 717 // If none of the forms were parsed, no use querying the server. |
714 if (!form_structures_.empty()) | 718 if (!form_structures_.empty()) |
715 download_manager_.StartQueryRequest(form_structures_); | 719 download_manager_.StartQueryRequest(form_structures_); |
716 } | 720 } |
OLD | NEW |