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

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

Issue 2900713003: [Password Manager, merge to M-59] 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // |typed_username_value|. In case when it was, |typed_username_value| 582 // |typed_username_value|. In case when it was, |typed_username_value|
583 // is incomplete, so we should leave autofilled value. 583 // is incomplete, so we should leave autofilled value.
584 username_value = typed_username_value; 584 username_value = typed_username_value;
585 } 585 }
586 } 586 }
587 password_form->username_value = username_value; 587 password_form->username_value = username_value;
588 } 588 }
589 589
590 password_form->origin = 590 password_form->origin =
591 form_util::GetCanonicalOriginForDocument(form.document); 591 form_util::GetCanonicalOriginForDocument(form.document);
592 GURL::Replacements rep; 592 password_form->signon_realm = GetSignOnRealm(password_form->origin);
593 rep.SetPathStr("");
594 password_form->signon_realm =
595 password_form->origin.ReplaceComponents(rep).spec();
596 password_form->other_possible_usernames.swap(other_possible_usernames); 593 password_form->other_possible_usernames.swap(other_possible_usernames);
597 594
598 if (!password.IsNull()) { 595 if (!password.IsNull()) {
599 password_form->password_element = FieldName(password, "anonymous_password"); 596 password_form->password_element = FieldName(password, "anonymous_password");
600 blink::WebString password_value = password.Value(); 597 blink::WebString password_value = password.Value();
601 if (FieldHasNonscriptModifiedValue(field_value_and_properties_map, 598 if (FieldHasNonscriptModifiedValue(field_value_and_properties_map,
602 password)) 599 password))
603 password_value = blink::WebString::FromUTF16( 600 password_value = blink::WebString::FromUTF16(
604 *field_value_and_properties_map->at(password).first); 601 *field_value_and_properties_map->at(password).first);
605 password_form->password_value = password_value.Utf16(); 602 password_form->password_value = password_value.Utf16();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 autocomplete_value_lowercase, base::kWhitespaceASCII, 756 autocomplete_value_lowercase, base::kWhitespaceASCII,
760 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) { 757 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
761 if (base::StartsWith(token, kAutocompleteCreditCardPrefix, 758 if (base::StartsWith(token, kAutocompleteCreditCardPrefix,
762 base::CompareCase::SENSITIVE)) { 759 base::CompareCase::SENSITIVE)) {
763 return true; 760 return true;
764 } 761 }
765 } 762 }
766 return false; 763 return false;
767 } 764 }
768 765
766 std::string GetSignOnRealm(const GURL& origin) {
767 GURL::Replacements rep;
768 rep.SetPathStr("");
769 return origin.ReplaceComponents(rep).spec();
770 }
769 } // namespace autofill 771 } // 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