summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorahutter@chromium.org <ahutter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-11 03:00:48 +0000
committerahutter@chromium.org <ahutter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-11 03:00:48 +0000
commite13ca411a78ee4cab69a51e099a53a77c9108028 (patch)
treeb048eb22fd22b05825352044b2891e900400219e /components
parentbaeb657b6b1413efdc5550570c974d846a9a794c (diff)
downloadchromium_src-e13ca411a78ee4cab69a51e099a53a77c9108028.zip
chromium_src-e13ca411a78ee4cab69a51e099a53a77c9108028.tar.gz
chromium_src-e13ca411a78ee4cab69a51e099a53a77c9108028.tar.bz2
Preventing Autofill saving user entered data during Autocheckout.
BUG=226740 Review URL: https://chromiumcodereview.appspot.com/13839003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193552 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r--components/autofill/browser/autocheckout_manager.cc11
-rw-r--r--components/autofill/browser/autofill_manager.cc4
-rw-r--r--components/autofill/browser/form_structure.cc4
-rw-r--r--components/autofill/browser/form_structure.h8
4 files changed, 20 insertions, 7 deletions
diff --git a/components/autofill/browser/autocheckout_manager.cc b/components/autofill/browser/autocheckout_manager.cc
index 4eadf45..b1998a6 100644
--- a/components/autofill/browser/autocheckout_manager.cc
+++ b/components/autofill/browser/autocheckout_manager.cc
@@ -114,12 +114,13 @@ void AutocheckoutManager::FillForms() {
autofill_manager_->GetFormStructures();
for (std::vector<FormStructure*>::const_iterator iter =
form_structures.begin(); iter != form_structures.end(); ++iter) {
- const FormStructure& form_structure = **iter;
- FormData form = form_structure.ToFormData();
- DCHECK_EQ(form_structure.field_count(), form.fields.size());
+ FormStructure* form_structure = *iter;
+ form_structure->set_filled_by_autocheckout(true);
+ FormData form = form_structure->ToFormData();
+ DCHECK_EQ(form_structure->field_count(), form.fields.size());
- for (size_t i = 0; i < form_structure.field_count(); ++i) {
- const AutofillField* field = form_structure.field(i);
+ for (size_t i = 0; i < form_structure->field_count(); ++i) {
+ const AutofillField* field = form_structure->field(i);
SetValue(*field, &form.fields[i]);
}
diff --git a/components/autofill/browser/autofill_manager.cc b/components/autofill/browser/autofill_manager.cc
index cca6f87..e82aec8 100644
--- a/components/autofill/browser/autofill_manager.cc
+++ b/components/autofill/browser/autofill_manager.cc
@@ -403,7 +403,9 @@ bool AutofillManager::OnFormSubmitted(const FormData& form,
return false;
submitted_form->UpdateFromCache(*cached_submitted_form);
- if (submitted_form->IsAutofillable(true))
+ // Don't prompt the user to save data entered by Autocheckout.
+ if (submitted_form->IsAutofillable(true) &&
+ !submitted_form->filled_by_autocheckout())
ImportFormData(*submitted_form);
// Only upload server statistics and UMA metrics if at least some local data
diff --git a/components/autofill/browser/form_structure.cc b/components/autofill/browser/form_structure.cc
index 40b0f36..d7927a2 100644
--- a/components/autofill/browser/form_structure.cc
+++ b/components/autofill/browser/form_structure.cc
@@ -296,7 +296,8 @@ FormStructure::FormStructure(const FormData& form,
upload_required_(USE_UPLOAD_RATES),
server_experiment_id_("no server response"),
has_author_specified_types_(false),
- autocheckout_url_prefix_(autocheckout_url_prefix) {
+ autocheckout_url_prefix_(autocheckout_url_prefix),
+ filled_by_autocheckout_(false) {
// Copy the form fields.
std::map<string16, size_t> unique_names;
for (std::vector<FormFieldData>::const_iterator field =
@@ -745,6 +746,7 @@ void FormStructure::UpdateFromCache(const FormStructure& cached_form) {
UpdateAutofillCount();
+ filled_by_autocheckout_ = cached_form.filled_by_autocheckout();
server_experiment_id_ = cached_form.server_experiment_id();
// The form signature should match between query and upload requests to the
diff --git a/components/autofill/browser/form_structure.h b/components/autofill/browser/form_structure.h
index f7abd78..5512acc 100644
--- a/components/autofill/browser/form_structure.h
+++ b/components/autofill/browser/form_structure.h
@@ -165,6 +165,11 @@ class FormStructure {
// |user_submitted| is currently always false.
FormData ToFormData() const;
+ bool filled_by_autocheckout() const { return filled_by_autocheckout_; }
+ void set_filled_by_autocheckout(bool filled_by_autocheckout) {
+ filled_by_autocheckout_ = filled_by_autocheckout;
+ }
+
bool operator==(const FormData& form) const;
bool operator!=(const FormData& form) const;
@@ -244,6 +249,9 @@ class FormStructure {
// autocheckout is not enabled for this form.
std::string autocheckout_url_prefix_;
+ // Whether or not this form was filled by Autocheckout.
+ bool filled_by_autocheckout_;
+
DISALLOW_COPY_AND_ASSIGN(FormStructure);
};