| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/autofill_data_validation.h" | 5 #include "components/autofill/core/common/autofill_data_validation.h" |
| 6 | 6 |
| 7 #include "components/autofill/core/common/form_data.h" | 7 #include "components/autofill/core/common/form_data.h" |
| 8 #include "components/autofill/core/common/form_field_data.h" | 8 #include "components/autofill/core/common/form_field_data.h" |
| 9 #include "components/autofill/core/common/password_form_fill_data.h" | 9 #include "components/autofill/core/common/password_form_fill_data.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 IsValidString16(field.name) && | 35 IsValidString16(field.name) && |
| 36 IsValidString16(field.value) && | 36 IsValidString16(field.value) && |
| 37 IsValidString(field.form_control_type) && | 37 IsValidString(field.form_control_type) && |
| 38 IsValidString(field.autocomplete_attribute) && | 38 IsValidString(field.autocomplete_attribute) && |
| 39 IsValidString16Vector(field.option_values) && | 39 IsValidString16Vector(field.option_values) && |
| 40 IsValidString16Vector(field.option_contents); | 40 IsValidString16Vector(field.option_contents); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool IsValidFormData(const FormData& form) { | 43 bool IsValidFormData(const FormData& form) { |
| 44 if (!IsValidString16(form.name) || | 44 if (!IsValidString16(form.name) || |
| 45 !IsValidString16(form.method) || | |
| 46 !IsValidGURL(form.origin) || | 45 !IsValidGURL(form.origin) || |
| 47 !IsValidGURL(form.action)) | 46 !IsValidGURL(form.action)) |
| 48 return false; | 47 return false; |
| 49 | 48 |
| 50 if (form.fields.size() > kMaxListSize) | 49 if (form.fields.size() > kMaxListSize) |
| 51 return false; | 50 return false; |
| 52 | 51 |
| 53 for (std::vector<FormFieldData>::const_iterator it = form.fields.begin(); | 52 for (std::vector<FormFieldData>::const_iterator it = form.fields.begin(); |
| 54 it != form.fields.end(); ++it) { | 53 it != form.fields.end(); ++it) { |
| 55 if (!IsValidFormFieldData(*it)) | 54 if (!IsValidFormFieldData(*it)) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 for (std::vector<FormData>::const_iterator it = v.begin(); it != v.end(); | 105 for (std::vector<FormData>::const_iterator it = v.begin(); it != v.end(); |
| 107 ++it) { | 106 ++it) { |
| 108 if (!IsValidFormData(*it)) | 107 if (!IsValidFormData(*it)) |
| 109 return false; | 108 return false; |
| 110 } | 109 } |
| 111 | 110 |
| 112 return true; | 111 return true; |
| 113 } | 112 } |
| 114 | 113 |
| 115 } // namespace autofill | 114 } // namespace autofill |
| OLD | NEW |