| Index: chrome/browser/autofill/autofill_manager.cc
|
| ===================================================================
|
| --- chrome/browser/autofill/autofill_manager.cc (revision 66219)
|
| +++ chrome/browser/autofill/autofill_manager.cc (working copy)
|
| @@ -7,7 +7,6 @@
|
| #include <limits>
|
| #include <string>
|
|
|
| -#include "app/l10n_util.h"
|
| #include "base/basictypes.h"
|
| #include "base/string16.h"
|
| #include "base/utf_string_conversions.h"
|
| @@ -23,7 +22,6 @@
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| -#include "grit/generated_resources.h"
|
| #include "webkit/glue/form_data.h"
|
| #include "webkit/glue/form_field.h"
|
|
|
| @@ -134,7 +132,7 @@
|
| // Grab a copy of the form data.
|
| upload_form_structure_.reset(new FormStructure(form));
|
|
|
| - if (!upload_form_structure_->IsAutoFillable(true))
|
| + if (!upload_form_structure_->IsAutoFillable())
|
| return;
|
|
|
| // Determine the possible field types and upload the form structure to the
|
| @@ -150,7 +148,8 @@
|
| ParseForms(forms);
|
| }
|
|
|
| -bool AutoFillManager::GetAutoFillSuggestions(bool field_autofilled,
|
| +bool AutoFillManager::GetAutoFillSuggestions(int query_id,
|
| + bool field_autofilled,
|
| const FormField& field) {
|
| if (!IsAutoFillEnabled())
|
| return false;
|
| @@ -173,7 +172,7 @@
|
| form = *form_iter;
|
|
|
| // Don't send suggestions for forms that aren't auto-fillable.
|
| - if (!form->IsAutoFillable(false))
|
| + if (!form->IsAutoFillable())
|
| continue;
|
|
|
| for (std::vector<AutoFillField*>::const_iterator iter = form->begin();
|
| @@ -215,30 +214,6 @@
|
| if (values.empty())
|
| return false;
|
|
|
| - // Don't provide AutoFill suggestions when AutoFill is disabled, but provide a
|
| - // warning to the user.
|
| - if (!form->IsAutoFillable(true)) {
|
| - values.assign(
|
| - 1, l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_FORM_DISABLED));
|
| - labels.assign(1, string16());
|
| - icons.assign(1, string16());
|
| - unique_ids.assign(1, -1);
|
| - host->AutoFillSuggestionsReturned(values, labels, icons, unique_ids);
|
| - return true;
|
| - }
|
| -
|
| - // Don't provide credit card suggestions for non-HTTPS pages, but provide a
|
| - // warning to the user.
|
| - if (!FormIsHTTPS(form) && type.group() == AutoFillType::CREDIT_CARD) {
|
| - values.assign(
|
| - 1, l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_INSECURE_CONNECTION));
|
| - labels.assign(1, string16());
|
| - icons.assign(1, string16());
|
| - unique_ids.assign(1, -1);
|
| - host->AutoFillSuggestionsReturned(values, labels, icons, unique_ids);
|
| - return true;
|
| - }
|
| -
|
| // If the form is auto-filled and the renderer is querying for suggestions,
|
| // then the user is editing the value of a field. In this case, mimick
|
| // autocomplete. In particular, don't display labels, as that information is
|
| @@ -256,7 +231,8 @@
|
| }
|
| }
|
|
|
| - host->AutoFillSuggestionsReturned(values, labels, icons, unique_ids);
|
| + host->AutoFillSuggestionsReturned(
|
| + query_id, values, labels, icons, unique_ids);
|
| return true;
|
| }
|
|
|
| @@ -549,6 +525,10 @@
|
| std::vector<string16>* labels,
|
| std::vector<string16>* icons,
|
| std::vector<int>* unique_ids) {
|
| + // Don't return CC suggestions for non-HTTPS pages.
|
| + if (!FormIsHTTPS(form))
|
| + return;
|
| +
|
| for (std::vector<CreditCard*>::const_iterator iter =
|
| personal_data_->credit_cards().begin();
|
| iter != personal_data_->credit_cards().end(); ++iter) {
|
| @@ -619,33 +599,22 @@
|
| }
|
| }
|
|
|
| -void AutoFillManager::ParseForms(const std::vector<FormData>& forms) {
|
| - std::vector<FormStructure *> non_queryable_forms;
|
| - for (std::vector<FormData>::const_iterator iter = forms.begin();
|
| +void AutoFillManager::ParseForms(
|
| + const std::vector<webkit_glue::FormData>& forms) {
|
| + for (std::vector<FormData>::const_iterator iter =
|
| + forms.begin();
|
| iter != forms.end(); ++iter) {
|
| scoped_ptr<FormStructure> form_structure(new FormStructure(*iter));
|
| - if (!form_structure->ShouldBeParsed(false))
|
| + if (!form_structure->ShouldBeParsed())
|
| continue;
|
|
|
| DeterminePossibleFieldTypes(form_structure.get());
|
| -
|
| - // Set aside forms with method GET so that they are not included in the
|
| - // query to the server.
|
| - if (form_structure->ShouldBeParsed(true))
|
| - form_structures_.push_back(form_structure.release());
|
| - else
|
| - non_queryable_forms.push_back(form_structure.release());
|
| + form_structures_.push_back(form_structure.release());
|
| }
|
|
|
| // If none of the forms were parsed, no use querying the server.
|
| if (!form_structures_.empty() && !disable_download_manager_requests_)
|
| download_manager_.StartQueryRequest(form_structures_);
|
| -
|
| - for (std::vector<FormStructure *>::const_iterator iter =
|
| - non_queryable_forms.begin();
|
| - iter != non_queryable_forms.end(); ++iter) {
|
| - form_structures_.push_back(*iter);
|
| - }
|
| }
|
|
|
| // When sending IDs (across processes) to the renderer we pack credit card and
|
|
|