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

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

Issue 11867025: Download autocheckout whitelist and enable autocheckout for whitelisted sites only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert code change for manual testing/:wq. Created 7 years, 11 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: chrome/browser/autofill/form_structure.cc
diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc
index 7c89eb8b63f0f4381e32656860c48351e797f9b9..6db7c277868bd1fa2de199b33fcd6ad48c20d3a1 100644
--- a/chrome/browser/autofill/form_structure.cc
+++ b/chrome/browser/autofill/form_structure.cc
@@ -227,15 +227,31 @@ FormStructure::FormStructure(const FormData& form)
source_url_(form.origin),
target_url_(form.action),
autofill_count_(0),
+ upload_required_(USE_UPLOAD_RATES),
+ server_experiment_id_("no server response"),
+ current_page_number_(-1),
+ total_pages_(-1),
+ has_author_specified_types_(false),
+ autocheckout_enabled_(false) {
+ Init(form);
+}
+
+FormStructure::FormStructure(const FormData& form, bool autocheckout_enabled)
+ : form_name_(form.name),
+ source_url_(form.origin),
+ target_url_(form.action),
+ autofill_count_(0),
checkable_field_count_(0),
upload_required_(USE_UPLOAD_RATES),
server_experiment_id_("no server response"),
current_page_number_(-1),
total_pages_(-1),
has_author_specified_types_(false),
- experimental_form_filling_enabled_(
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableExperimentalFormFilling)) {
+ autocheckout_enabled_(autocheckout_enabled) {
+ Init(form);
+}
+
+void FormStructure::Init(const FormData& form) {
// Copy the form fields.
std::map<string16, size_t> unique_names;
for (std::vector<FormFieldData>::const_iterator field =
@@ -243,8 +259,7 @@ FormStructure::FormStructure(const FormData& form)
field != form.fields.end(); field++) {
// Skipping checkable elements when flag is not set, else these fields will
// interfere with existing field signatures with Autofill servers.
- // TODO(ramankk): Add checkable elements only on whitelisted pages
- if (!field->is_checkable || experimental_form_filling_enabled_) {
+ if (!field->is_checkable || autocheckout_enabled_) {
// Add all supported form fields (including with empty names) to the
// signature. This is a requirement for Autofill servers.
form_signature_field_names_.append("&");
@@ -418,7 +433,6 @@ void FormStructure::ParseQueryResponse(const std::string& response_xml,
const std::vector<FormStructure*>& forms,
const AutofillMetrics& metric_logger) {
metric_logger.LogServerQueryMetric(AutofillMetrics::QUERY_RESPONSE_RECEIVED);
-
Ilya Sherman 2013/01/24 22:01:55 nit: Please revert this diff.
benquan 2013/01/25 00:55:31 Done.
// Parse the field types from the server response to the query.
std::vector<AutofillServerFieldInfo> field_infos;
UploadRequired upload_required;
@@ -543,9 +557,7 @@ std::string FormStructure::FormSignature() const {
}
bool FormStructure::IsAutofillable(bool require_method_post) const {
- // TODO(ramankk): Remove this check once we have better way of identifying the
- // cases to trigger experimental form filling.
- if (experimental_form_filling_enabled_)
+ if (autocheckout_enabled_)
return true;
if (autofill_count() < kRequiredFillableFields)
@@ -565,9 +577,7 @@ void FormStructure::UpdateAutofillCount() {
}
bool FormStructure::ShouldBeParsed(bool require_method_post) const {
- // TODO(ramankk): Remove this check once we have better way of identifying the
- // cases to trigger experimental form filling.
- if (experimental_form_filling_enabled_)
+ if (autocheckout_enabled_)
return true;
// Ignore counting checkable elements towards minimum number of elements
@@ -928,8 +938,9 @@ bool FormStructure::EncodeFormRequest(
encompassing_xml_element->AddElement(field_element);
}
} else {
- // Skip putting checkable fields in the request if the flag is not set.
- if (field->is_checkable && !experimental_form_filling_enabled_)
+ // Skip putting checkable fields in the request if autocheckout is not
+ // enabled.
+ if (field->is_checkable && !autocheckout_enabled_)
continue;
buzz::XmlElement *field_element = new buzz::XmlElement(

Powered by Google App Engine
This is Rietveld 408576698