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/content/renderer/password_form_conversion_utils.h" | 5 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 | 136 |
137 if (passwords.empty()) | 137 if (passwords.empty()) |
138 return false; | 138 return false; |
139 | 139 |
140 switch (passwords.size()) { | 140 switch (passwords.size()) { |
141 case 1: | 141 case 1: |
142 // Single password, easy. | 142 // Single password, easy. |
143 *current_password = passwords[0]; | 143 *current_password = passwords[0]; |
144 break; | 144 break; |
145 case 2: | 145 case 2: |
146 if (passwords[0].value() == passwords[1].value()) { | 146 if (!passwords[0].value().isEmpty() && |
147 passwords[0].value() == passwords[1].value()) { | |
Garrett Casto
2015/06/05 21:22:30
You probably want to leave a comment here about wh
dvadym
2015/06/09 16:40:08
Done.
| |
147 // Two identical passwords: assume we are seeing a new password with a | 148 // Two identical passwords: assume we are seeing a new password with a |
148 // confirmation. This can be either a sign-up form or a password change | 149 // confirmation. This can be either a sign-up form or a password change |
149 // form that does not ask for the old password. | 150 // form that does not ask for the old password. |
150 *new_password = passwords[0]; | 151 *new_password = passwords[0]; |
151 } else { | 152 } else { |
152 // Assume first is old password, second is new (no choice but to guess). | 153 // Assume first is old password, second is new (no choice but to guess). |
153 *current_password = passwords[0]; | 154 *current_password = passwords[0]; |
154 *new_password = passwords[1]; | 155 *new_password = passwords[1]; |
155 } | 156 } |
156 break; | 157 break; |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 WebFormElementToFormData(web_form, | 483 WebFormElementToFormData(web_form, |
483 blink::WebFormControlElement(), | 484 blink::WebFormControlElement(), |
484 EXTRACT_NONE, | 485 EXTRACT_NONE, |
485 &password_form->form_data, | 486 &password_form->form_data, |
486 NULL /* FormFieldData */); | 487 NULL /* FormFieldData */); |
487 | 488 |
488 return password_form.Pass(); | 489 return password_form.Pass(); |
489 } | 490 } |
490 | 491 |
491 } // namespace autofill | 492 } // namespace autofill |
OLD | NEW |