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

Side by Side Diff: Source/WebKit/chromium/src/WebPasswordFormUtils.cpp

Issue 19510005: [oilpan] Completely move HTMLFormControlElement's hierarchy to the managed heap Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* ***** BEGIN LICENSE BLOCK ***** 1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 * 3 *
4 * The contents of this file are subject to the Mozilla Public License Version 4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with 5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at 6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/ 7 * http://www.mozilla.org/MPL/
8 * 8 *
9 * Software distributed under the License is distributed on an "AS IS" basis, 9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // Maximum number of password fields we will observe before throwing our 55 // Maximum number of password fields we will observe before throwing our
56 // hands in the air and giving up with a given form. 56 // hands in the air and giving up with a given form.
57 static const size_t maxPasswords = 3; 57 static const size_t maxPasswords = 3;
58 58
59 void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields) 59 void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
60 { 60 {
61 ASSERT(form); 61 ASSERT(form);
62 ASSERT(fields); 62 ASSERT(fields);
63 63
64 HTMLInputElement* latestInputElement = 0; 64 Handle<HTMLInputElement> latestInputElement;
65 const Vector<FormAssociatedElement*>& formElements = form->associatedElement s(); 65 const Vector<FormAssociatedElement*>& formElements = form->associatedElement s();
66 for (size_t i = 0; i < formElements.size(); i++) { 66 for (size_t i = 0; i < formElements.size(); i++) {
67 if (!formElements[i]->isFormControlElement()) 67 if (!formElements[i]->isFormControlElement())
68 continue; 68 continue;
69 HTMLFormControlElement* formElement = static_cast<HTMLFormControlElement *>(formElements[i]); 69 Handle<HTMLFormControlElement> formElement(static_cast<HTMLFormControlEl ement*>(formElements[i]));
70 if (formElement->isActivatedSubmit()) 70 if (formElement->isActivatedSubmit())
71 fields->submit = formElement; 71 fields->submit = formElement.raw();
72 72
73 if (!formElement->hasTagName(HTMLNames::inputTag)) 73 if (!formElement->hasTagName(HTMLNames::inputTag))
74 continue; 74 continue;
75 75
76 HTMLInputElement* inputElement = formElement->toInputElement(); 76 Handle<HTMLInputElement> inputElement = formElement->toInputElement();
77 if (inputElement->isDisabledFormControl()) 77 if (inputElement->isDisabledFormControl())
78 continue; 78 continue;
79 79
80 if ((fields->passwords.size() < maxPasswords) 80 if ((fields->passwords.size() < maxPasswords)
81 && inputElement->isPasswordField()) { 81 && inputElement->isPasswordField()) {
82 // We assume that the username is the input element before the 82 // We assume that the username is the input element before the
83 // first password element. 83 // first password element.
84 if (fields->passwords.isEmpty() && latestInputElement) { 84 if (fields->passwords.isEmpty() && latestInputElement) {
85 fields->userName = latestInputElement; 85 fields->userName = latestInputElement.raw();
86 // Remove the selected username from alternateUserNames. 86 // Remove the selected username from alternateUserNames.
87 if (!fields->alternateUserNames.isEmpty() && !latestInputElement ->value().isEmpty()) 87 if (!fields->alternateUserNames.isEmpty() && !latestInputElement ->value().isEmpty())
88 fields->alternateUserNames.removeLast(); 88 fields->alternateUserNames.removeLast();
89 } 89 }
90 fields->passwords.append(inputElement); 90 fields->passwords.append(inputElement.raw());
91 } 91 }
92 92
93 // Various input types such as text, url, email can be a username field. 93 // Various input types such as text, url, email can be a username field.
94 if (inputElement->isTextField() && !inputElement->isPasswordField()) { 94 if (inputElement->isTextField() && !inputElement->isPasswordField()) {
95 latestInputElement = inputElement; 95 latestInputElement = inputElement;
96 // We ignore elements that have no value. Unlike userName, alternate UserNames 96 // We ignore elements that have no value. Unlike userName, alternate UserNames
97 // is used only for autofill, not for form identification, and blank autofill 97 // is used only for autofill, not for form identification, and blank autofill
98 // entries are not useful. 98 // entries are not useful.
99 if (!inputElement->value().isEmpty()) 99 if (!inputElement->value().isEmpty())
100 fields->alternateUserNames.append(inputElement->value()); 100 fields->alternateUserNames.append(inputElement->value());
101 } 101 }
102 } 102 }
103 } 103 }
104 104
105 } // namespace WebKit 105 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/WebPasswordFormUtils.h ('k') | Source/WebKit/chromium/src/WebSearchableFormData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698