Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: components/autofill/content/renderer/password_form_conversion_utils.cc

Issue 2893633002: [Password Manager] Make filling robust against changing url by JavaScript (Closed)
Patch Set: fix merge Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/autofill/content/renderer/password_form_conversion_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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) {
782 GURL::Replacements rep;
783 rep.SetPathStr("");
784 return origin.ReplaceComponents(rep).spec();
785 }
786
784 } // namespace autofill 787 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/password_form_conversion_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698