| 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 17 matching lines...) Expand all Loading... |
| 28 bool IsValidGURL(const GURL& url) { | 28 bool IsValidGURL(const GURL& url) { |
| 29 return url.is_empty() || url.is_valid(); | 29 return url.is_empty() || url.is_valid(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 bool IsValidFormFieldData(const FormFieldData& field) { | 32 bool IsValidFormFieldData(const FormFieldData& field) { |
| 33 return IsValidString16(field.label) && | 33 return IsValidString16(field.label) && |
| 34 IsValidString16(field.name) && | 34 IsValidString16(field.name) && |
| 35 IsValidString16(field.value) && | 35 IsValidString16(field.value) && |
| 36 IsValidString(field.form_control_type) && | 36 IsValidString(field.form_control_type) && |
| 37 IsValidString(field.autocomplete_attribute) && | 37 IsValidString(field.autocomplete_attribute) && |
| 38 IsValidString16Vector(field.option_values) && | |
| 39 IsValidString16Vector(field.option_contents); | 38 IsValidString16Vector(field.option_contents); |
| 40 } | 39 } |
| 41 | 40 |
| 42 bool IsValidFormData(const FormData& form) { | 41 bool IsValidFormData(const FormData& form) { |
| 43 if (!IsValidString16(form.name) || | 42 if (!IsValidString16(form.name) || |
| 44 !IsValidGURL(form.origin) || | 43 !IsValidGURL(form.origin) || |
| 45 !IsValidGURL(form.action)) | 44 !IsValidGURL(form.action)) |
| 46 return false; | 45 return false; |
| 47 | 46 |
| 48 if (form.fields.size() > kMaxListSize) | 47 if (form.fields.size() > kMaxListSize) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 99 |
| 101 for (const FormData& form : v) { | 100 for (const FormData& form : v) { |
| 102 if (!IsValidFormData(form)) | 101 if (!IsValidFormData(form)) |
| 103 return false; | 102 return false; |
| 104 } | 103 } |
| 105 | 104 |
| 106 return true; | 105 return true; |
| 107 } | 106 } |
| 108 | 107 |
| 109 } // namespace autofill | 108 } // namespace autofill |
| OLD | NEW |