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

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

Issue 1841663002: Trim username_value to passwordForm Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « AUTHORS ('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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698