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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 // |typed_username_value|. In case when it was, |typed_username_value| | 586 // |typed_username_value|. In case when it was, |typed_username_value| |
| 587 // is incomplete, so we should leave autofilled value. | 587 // is incomplete, so we should leave autofilled value. |
| 588 username_value = typed_username_value; | 588 username_value = typed_username_value; |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 password_form->username_value = username_value; | 591 password_form->username_value = username_value; |
| 592 } | 592 } |
| 593 | 593 |
| 594 password_form->origin = | 594 password_form->origin = |
| 595 form_util::GetCanonicalOriginForDocument(form.document); | 595 form_util::GetCanonicalOriginForDocument(form.document); |
| 596 GURL::Replacements rep; | 596 password_form->signon_realm = GetSignOnRealm(password_form->origin); |
| 597 rep.SetPathStr(""); | |
| 598 password_form->signon_realm = | |
| 599 password_form->origin.ReplaceComponents(rep).spec(); | |
| 600 password_form->other_possible_usernames.swap(other_possible_usernames); | 597 password_form->other_possible_usernames.swap(other_possible_usernames); |
| 601 | 598 |
| 602 if (!password.IsNull()) { | 599 if (!password.IsNull()) { |
| 603 password_form->password_element = FieldName(password, "anonymous_password"); | 600 password_form->password_element = FieldName(password, "anonymous_password"); |
| 604 blink::WebString password_value = password.Value(); | 601 blink::WebString password_value = password.Value(); |
| 605 if (FieldHasNonscriptModifiedValue(field_value_and_properties_map, | 602 if (FieldHasNonscriptModifiedValue(field_value_and_properties_map, |
| 606 password)) | 603 password)) |
| 607 password_value = blink::WebString::FromUTF16( | 604 password_value = blink::WebString::FromUTF16( |
| 608 *field_value_and_properties_map->at(password).first); | 605 *field_value_and_properties_map->at(password).first); |
| 609 password_form->password_value = password_value.Utf16(); | 606 password_form->password_value = password_value.Utf16(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 774 const blink::WebInputElement& field) { | 771 const blink::WebInputElement& field) { |
| 775 if (!field.IsPasswordField()) | 772 if (!field.IsPasswordField()) |
| 776 return false; | 773 return false; |
| 777 | 774 |
| 778 static const base::string16 kCardCvcReCached = base::UTF8ToUTF16(kCardCvcRe); | 775 static const base::string16 kCardCvcReCached = base::UTF8ToUTF16(kCardCvcRe); |
| 779 | 776 |
| 780 return MatchesPattern(field.GetAttribute("id").Utf16(), kCardCvcReCached) || | 777 return MatchesPattern(field.GetAttribute("id").Utf16(), kCardCvcReCached) || |
| 781 MatchesPattern(field.GetAttribute("name").Utf16(), kCardCvcReCached); | 778 MatchesPattern(field.GetAttribute("name").Utf16(), kCardCvcReCached); |
| 782 } | 779 } |
| 783 | 780 |
| 781 std::string GetSignOnRealm(const GURL& origin) { | |
|
kolos1
2017/05/18 09:52:53
There might be confusion with GetSignonRealm from
dvadym
2017/05/18 11:08:52
GetSignOnRealm is very good name :). I don't think
kolos1
2017/05/18 11:11:50
Acknowledged.
| |
| 782 GURL::Replacements rep; | |
| 783 rep.SetPathStr(""); | |
|
kolos1
2017/05/18 09:52:53
Shall we also clear Query, Ref, Username, Password
dvadym
2017/05/18 11:08:52
This is just extracting of logic that we had for c
kolos1
2017/05/18 11:11:50
Acknowledged.
| |
| 784 return origin.ReplaceComponents(rep).spec(); | |
| 785 } | |
| 786 | |
| 784 } // namespace autofill | 787 } // namespace autofill |
| OLD | NEW |