Chromium Code Reviews| Index: chrome/browser/autofill/form_structure.cc |
| diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc |
| index 87c48f07c1eb19f58585f6c88584c1d640212970..094b91d7a22dd5ac7e03209f839176bc25942b0d 100644 |
| --- a/chrome/browser/autofill/form_structure.cc |
| +++ b/chrome/browser/autofill/form_structure.cc |
| @@ -522,7 +522,7 @@ 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 (CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kEnableExperimentalFormFilling)) |
| + switches::kEnableExperimentalFormFilling)) |
| return true; |
| if (autofill_count() < kRequiredFillableFields) |
| @@ -545,7 +545,7 @@ 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 (CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kEnableExperimentalFormFilling)) |
| + switches::kEnableExperimentalFormFilling)) |
| return true; |
| if (field_count() < kRequiredFillableFields) |
| @@ -814,6 +814,23 @@ std::string FormStructure::server_experiment_id() const { |
| return server_experiment_id_; |
| } |
| +FormData* FormStructure::ToFormData() const { |
| + // TODO(dbeam): Store user_submitted in ctor if it's important. |
|
Ilya Sherman
2012/11/28 06:16:39
It's not important. Just include a comment that i
Dan Beam
2012/11/28 19:59:10
Done.
|
| + FormData* data = new FormData(); |
|
Ilya Sherman
2012/11/28 06:16:39
If you keep the heap allocation, please use a scop
Dan Beam
2012/11/28 19:59:10
Done. How would I do this alternatively? I'm a C
|
| + data->name = form_name_; |
| + data->origin = source_url_; |
| + data->action = target_url_; |
| + data->method = method_; |
| + |
| + for (size_t i = 0; i < fields_.size(); ++i) { |
| + const FormFieldData* copy = |
| + new AutofillField(*fields_[i], fields_[i]->unique_name()); |
|
Ilya Sherman
2012/11/28 06:16:39
This sure looks like it will leak. Why isn't this
Dan Beam
2012/11/28 19:59:10
Done.
|
| + data->fields.push_back(*copy); |
|
Ilya Sherman
2012/11/28 06:16:39
Methinks the body of this for loop should be:
dat
Dan Beam
2012/11/28 19:59:10
Done.
|
| + } |
| + |
| + return data; |
| +} |
| + |
| bool FormStructure::operator==(const FormData& form) const { |
| // TODO(jhawkins): Is this enough to differentiate a form? |
| if (form_name_ == form.name && |