| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 if (!input_element || !input_element->isEnabled()) | 247 if (!input_element || !input_element->isEnabled()) |
| 248 continue; | 248 continue; |
| 249 | 249 |
| 250 if (input_element->isTextField()) { | 250 if (input_element->isTextField()) { |
| 251 if (input_element->isPasswordField()) | 251 if (input_element->isPasswordField()) |
| 252 layout_sequence.push_back('P'); | 252 layout_sequence.push_back('P'); |
| 253 else | 253 else |
| 254 layout_sequence.push_back('N'); | 254 layout_sequence.push_back('N'); |
| 255 } | 255 } |
| 256 | 256 |
| 257 if (input_element->isPasswordField()) { | 257 // If the password field is readonly, the page is likely using a virtual |
| 258 // keyboard and bypassing the password field value (see |
| 259 // http://crbug.com/475488). There is nothing Chrome can do to fill |
| 260 // passwords for now. |
| 261 if (input_element->isPasswordField() && |
| 262 (!input_element->isReadOnly() || |
| 263 HasAutocompleteAttributeValue(*input_element, "current_password") || |
| 264 HasAutocompleteAttributeValue(*input_element, "new-password"))) { |
| 258 passwords.push_back(*input_element); | 265 passwords.push_back(*input_element); |
| 259 // If we have not yet considered any element to be the username so far, | 266 // If we have not yet considered any element to be the username so far, |
| 260 // provisionally select the input element just before the first password | 267 // provisionally select the input element just before the first password |
| 261 // element to be the username. This choice will be overruled if we later | 268 // element to be the username. This choice will be overruled if we later |
| 262 // find an element with autocomplete='username'. | 269 // find an element with autocomplete='username'. |
| 263 if (username_element.isNull() && !latest_input_element.isNull()) { | 270 if (username_element.isNull() && !latest_input_element.isNull()) { |
| 264 username_element = latest_input_element; | 271 username_element = latest_input_element; |
| 265 // Remove the selected username from other_possible_usernames. | 272 // Remove the selected username from other_possible_usernames. |
| 266 if (!latest_input_element.value().isEmpty()) { | 273 if (!latest_input_element.value().isEmpty()) { |
| 267 DCHECK(!other_possible_usernames.empty()); | 274 DCHECK(!other_possible_usernames.empty()); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 blink::WebFormControlElement(), | 450 blink::WebFormControlElement(), |
| 444 REQUIRE_NONE, | 451 REQUIRE_NONE, |
| 445 EXTRACT_NONE, | 452 EXTRACT_NONE, |
| 446 &password_form->form_data, | 453 &password_form->form_data, |
| 447 NULL /* FormFieldData */); | 454 NULL /* FormFieldData */); |
| 448 | 455 |
| 449 return password_form.Pass(); | 456 return password_form.Pass(); |
| 450 } | 457 } |
| 451 | 458 |
| 452 } // namespace autofill | 459 } // namespace autofill |
| OLD | NEW |