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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 for (std::vector<FormFieldData>::const_iterator it = form.fields.begin(); | 52 for (std::vector<FormFieldData>::const_iterator it = form.fields.begin(); |
53 it != form.fields.end(); ++it) { | 53 it != form.fields.end(); ++it) { |
54 if (!IsValidFormFieldData(*it)) | 54 if (!IsValidFormFieldData(*it)) |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 bool IsValidPasswordFormFillData(const PasswordFormFillData& form) { | 61 bool IsValidPasswordFormFillData(const PasswordFormFillData& form) { |
62 if (!IsValidFormData(form.basic_data) || | 62 if (!IsValidString16(form.name) || !IsValidGURL(form.origin) || |
63 !IsValidString(form.preferred_realm)) | 63 !IsValidGURL(form.action) || !IsValidFormFieldData(form.username_field) || |
| 64 !IsValidFormFieldData(form.password_field) || |
| 65 !IsValidString(form.preferred_realm)) { |
64 return false; | 66 return false; |
| 67 } |
65 | 68 |
66 for (PasswordFormFillData::LoginCollection::const_iterator it = | 69 for (PasswordFormFillData::LoginCollection::const_iterator it = |
67 form.additional_logins.begin(); | 70 form.additional_logins.begin(); |
68 it != form.additional_logins.end(); ++it) { | 71 it != form.additional_logins.end(); ++it) { |
69 if (!IsValidString16(it->first) || | 72 if (!IsValidString16(it->first) || |
70 !IsValidString16(it->second.password) || | 73 !IsValidString16(it->second.password) || |
71 !IsValidString(it->second.realm)) | 74 !IsValidString(it->second.realm)) |
72 return false; | 75 return false; |
73 } | 76 } |
74 | 77 |
(...skipping 30 matching lines...) Expand all Loading... |
105 for (std::vector<FormData>::const_iterator it = v.begin(); it != v.end(); | 108 for (std::vector<FormData>::const_iterator it = v.begin(); it != v.end(); |
106 ++it) { | 109 ++it) { |
107 if (!IsValidFormData(*it)) | 110 if (!IsValidFormData(*it)) |
108 return false; | 111 return false; |
109 } | 112 } |
110 | 113 |
111 return true; | 114 return true; |
112 } | 115 } |
113 | 116 |
114 } // namespace autofill | 117 } // namespace autofill |
OLD | NEW |