| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 *found_visible_password = false; | 347 *found_visible_password = false; |
| 348 *found_visible_username_before_visible_password = false; | 348 *found_visible_username_before_visible_password = false; |
| 349 | 349 |
| 350 bool found_visible_username = false; | 350 bool found_visible_username = false; |
| 351 for (auto& control_element : form.control_elements) { | 351 for (auto& control_element : form.control_elements) { |
| 352 const WebInputElement* input_element = toWebInputElement(&control_element); | 352 const WebInputElement* input_element = toWebInputElement(&control_element); |
| 353 if (!input_element || !input_element->isEnabled() || | 353 if (!input_element || !input_element->isEnabled() || |
| 354 !input_element->isTextField()) | 354 !input_element->isTextField()) |
| 355 continue; | 355 continue; |
| 356 | 356 |
| 357 if (!form_util::IsWebNodeVisible(*input_element)) | 357 if (!form_util::IsWebElementVisible(*input_element)) |
| 358 continue; | 358 continue; |
| 359 | 359 |
| 360 if (input_element->isPasswordField()) { | 360 if (input_element->isPasswordField()) { |
| 361 *found_visible_password = true; | 361 *found_visible_password = true; |
| 362 *found_visible_username_before_visible_password = found_visible_username; | 362 *found_visible_username_before_visible_password = found_visible_username; |
| 363 break; | 363 break; |
| 364 } else { | 364 } else { |
| 365 found_visible_username = true; | 365 found_visible_username = true; |
| 366 } | 366 } |
| 367 } | 367 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 std::string layout_sequence; | 418 std::string layout_sequence; |
| 419 layout_sequence.reserve(form.control_elements.size()); | 419 layout_sequence.reserve(form.control_elements.size()); |
| 420 size_t number_of_non_empty_text_non_password_fields = 0; | 420 size_t number_of_non_empty_text_non_password_fields = 0; |
| 421 for (size_t i = 0; i < form.control_elements.size(); ++i) { | 421 for (size_t i = 0; i < form.control_elements.size(); ++i) { |
| 422 WebFormControlElement control_element = form.control_elements[i]; | 422 WebFormControlElement control_element = form.control_elements[i]; |
| 423 | 423 |
| 424 WebInputElement* input_element = toWebInputElement(&control_element); | 424 WebInputElement* input_element = toWebInputElement(&control_element); |
| 425 if (!input_element || !input_element->isEnabled()) | 425 if (!input_element || !input_element->isEnabled()) |
| 426 continue; | 426 continue; |
| 427 | 427 |
| 428 bool element_is_invisible = !form_util::IsWebNodeVisible(*input_element); | 428 bool element_is_invisible = !form_util::IsWebElementVisible(*input_element); |
| 429 if (input_element->isTextField()) { | 429 if (input_element->isTextField()) { |
| 430 if (input_element->isPasswordField()) { | 430 if (input_element->isPasswordField()) { |
| 431 if (element_is_invisible && ignore_invisible_passwords) | 431 if (element_is_invisible && ignore_invisible_passwords) |
| 432 continue; | 432 continue; |
| 433 layout_sequence.push_back('P'); | 433 layout_sequence.push_back('P'); |
| 434 } else { | 434 } else { |
| 435 if (FieldHasNonscriptModifiedValue(field_value_and_properties_map, | 435 if (FieldHasNonscriptModifiedValue(field_value_and_properties_map, |
| 436 *input_element)) | 436 *input_element)) |
| 437 ++number_of_non_empty_text_non_password_fields; | 437 ++number_of_non_empty_text_non_password_fields; |
| 438 if (element_is_invisible && ignore_invisible_usernames) | 438 if (element_is_invisible && ignore_invisible_usernames) |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 const char* value_in_lowercase) { | 737 const char* value_in_lowercase) { |
| 738 base::string16 autocomplete_attribute( | 738 base::string16 autocomplete_attribute( |
| 739 element.getAttribute("autocomplete").utf16()); | 739 element.getAttribute("autocomplete").utf16()); |
| 740 std::vector<std::string> tokens = LowercaseAndTokenizeAttributeString( | 740 std::vector<std::string> tokens = LowercaseAndTokenizeAttributeString( |
| 741 base::UTF16ToUTF8(autocomplete_attribute)); | 741 base::UTF16ToUTF8(autocomplete_attribute)); |
| 742 | 742 |
| 743 return base::ContainsValue(tokens, value_in_lowercase); | 743 return base::ContainsValue(tokens, value_in_lowercase); |
| 744 } | 744 } |
| 745 | 745 |
| 746 } // namespace autofill | 746 } // namespace autofill |
| OLD | NEW |