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

Unified Diff: components/autofill/browser/form_structure.cc

Issue 12721004: Autofill:Autocomplete: Enable autocheckout of input elements of type password. This will support fi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/browser/form_structure.cc
diff --git a/components/autofill/browser/form_structure.cc b/components/autofill/browser/form_structure.cc
index ba80803642d08d021b5f070310fe19e27d00ab4f..90d3267c39ac8e01462ebf37a86b2eac5d5630a3 100644
--- a/components/autofill/browser/form_structure.cc
+++ b/components/autofill/browser/form_structure.cc
@@ -233,7 +233,7 @@ FormStructure::FormStructure(const FormData& form,
source_url_(form.origin),
target_url_(form.action),
autofill_count_(0),
- checkable_field_count_(0),
+ active_field_count_(0),
upload_required_(USE_UPLOAD_RATES),
server_experiment_id_("no server response"),
has_author_specified_types_(false),
@@ -247,11 +247,14 @@ FormStructure::FormStructure(const FormData& form,
// Skipping checkable elements when Autocheckout is not enabled, else
// these fields will interfere with existing field signatures with Autofill
// servers.
Ilya Sherman 2013/03/18 22:33:46 nit: Please update this comment.
Raman Kakilate 2013/03/18 23:01:54 Done.
- if (!field->is_checkable || IsAutocheckoutEnabled()) {
+ if ((!field->is_checkable && field->form_control_type != "password") ||
+ IsAutocheckoutEnabled()) {
// Add all supported form fields (including with empty names) to the
// signature. This is a requirement for Autofill servers.
form_signature_field_names_.append("&");
form_signature_field_names_.append(UTF16ToUTF8(field->name));
+
+ ++active_field_count_;
}
// Generate a unique name for this field by appending a counter to the name.
@@ -264,9 +267,6 @@ FormStructure::FormStructure(const FormData& form,
string16 unique_name = field->name + ASCIIToUTF16("_") +
base::IntToString16(unique_names[field->name]);
fields_.push_back(new AutofillField(*field, unique_name));
-
- if (field->is_checkable)
- ++checkable_field_count_;
}
std::string method = UTF16ToUTF8(form.method);
@@ -612,7 +612,7 @@ bool FormStructure::ShouldBeParsed(bool require_method_post) const {
// Ignore counting checkable elements towards minimum number of elements
// required to parse. This avoids trying to crowdsource forms with few text
// or select elements.
- if ((field_count() - checkable_field_count()) < RequiredFillableFields())
+ if (active_field_count() < RequiredFillableFields())
return false;
// Rule out http(s)://*/search?...
@@ -877,8 +877,8 @@ size_t FormStructure::field_count() const {
return fields_.size();
}
-size_t FormStructure::checkable_field_count() const {
- return checkable_field_count_;
+size_t FormStructure::active_field_count() const {
+ return active_field_count_;
}
std::string FormStructure::server_experiment_id() const {
@@ -972,7 +972,8 @@ bool FormStructure::EncodeFormRequest(
} else {
// Skip putting checkable fields in the request if Autocheckout is not
// enabled.
Ilya Sherman 2013/03/18 22:33:46 nit: Please update this comment.
Raman Kakilate 2013/03/18 23:01:54 Done.
- if (field->is_checkable && !IsAutocheckoutEnabled())
+ if ((field->is_checkable || field->form_control_type == "password") &&
+ !IsAutocheckoutEnabled())
continue;
buzz::XmlElement *field_element = new buzz::XmlElement(

Powered by Google App Engine
This is Rietveld 408576698