Chromium Code Reviews| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 base::i18n::ToLower(username_value), | 539 base::i18n::ToLower(username_value), |
| 540 base::i18n::ToLower(typed_username_value), | 540 base::i18n::ToLower(typed_username_value), |
| 541 base::CompareCase::SENSITIVE)) { | 541 base::CompareCase::SENSITIVE)) { |
| 542 // We check that |username_value| was not obtained by autofilling | 542 // We check that |username_value| was not obtained by autofilling |
| 543 // |typed_username_value|. In case when it was, |typed_username_value| | 543 // |typed_username_value|. In case when it was, |typed_username_value| |
| 544 // is incomplete, so we should leave autofilled value. | 544 // is incomplete, so we should leave autofilled value. |
| 545 username_value = typed_username_value; | 545 username_value = typed_username_value; |
| 546 } | 546 } |
| 547 } | 547 } |
| 548 } | 548 } |
| 549 base::TrimString(username_value, base::ASCIIToUTF16(" "), &username_value); | |
|
ramya.v
2016/03/31 04:10:07
Can you add a test in password_form_conversion_uti
| |
| 549 password_form->username_value = username_value; | 550 password_form->username_value = username_value; |
| 550 } | 551 } |
| 551 | 552 |
| 552 password_form->origin = | 553 password_form->origin = |
| 553 form_util::GetCanonicalOriginForDocument(form.document); | 554 form_util::GetCanonicalOriginForDocument(form.document); |
| 554 GURL::Replacements rep; | 555 GURL::Replacements rep; |
| 555 rep.SetPathStr(""); | 556 rep.SetPathStr(""); |
| 556 password_form->signon_realm = | 557 password_form->signon_realm = |
| 557 password_form->origin.ReplaceComponents(rep).spec(); | 558 password_form->origin.ReplaceComponents(rep).spec(); |
| 558 password_form->other_possible_usernames.swap(other_possible_usernames); | 559 password_form->other_possible_usernames.swap(other_possible_usernames); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 687 } | 688 } |
| 688 | 689 |
| 689 bool HasAutocompleteAttributeValue(const blink::WebInputElement& element, | 690 bool HasAutocompleteAttributeValue(const blink::WebInputElement& element, |
| 690 const char* value_in_lowercase) { | 691 const char* value_in_lowercase) { |
| 691 return base::LowerCaseEqualsASCII( | 692 return base::LowerCaseEqualsASCII( |
| 692 base::StringPiece16(element.getAttribute("autocomplete")), | 693 base::StringPiece16(element.getAttribute("autocomplete")), |
| 693 value_in_lowercase); | 694 value_in_lowercase); |
| 694 } | 695 } |
| 695 | 696 |
| 696 } // namespace autofill | 697 } // namespace autofill |
| OLD | NEW |