summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/autofill_manager.cc40
-rw-r--r--chrome/browser/autofill/autofill_manager.h11
2 files changed, 26 insertions, 25 deletions
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index e95b1c6..d308ec1 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -46,7 +46,7 @@ void AutoFillManager::RegisterUserPrefs(PrefService* prefs) {
void AutoFillManager::FormFieldValuesSubmitted(
const webkit_glue::FormFieldValues& form) {
- if (!IsAutoFillEnabled())
+ if (!personal_data_)
return;
// Grab a copy of the form data.
@@ -63,7 +63,7 @@ void AutoFillManager::FormFieldValuesSubmitted(
if (!infobar_shown) {
// Ask the user for permission to save form information.
infobar_.reset(new AutoFillInfoBarDelegate(tab_contents_, this));
- } else {
+ } else if (IsAutoFillEnabled()) {
HandleSubmit();
}
}
@@ -233,6 +233,24 @@ void AutoFillManager::OnPersonalDataLoaded() {
this, personal_data_->profiles(), personal_data_->credit_cards());
}
+void AutoFillManager::OnInfoBarAccepted() {
+ DCHECK(personal_data_);
+
+ PrefService* prefs = tab_contents_->profile()->GetPrefs();
+ prefs->SetBoolean(prefs::kAutoFillEnabled, true);
+
+ // If the personal data manager has not loaded the data yet, set ourselves as
+ // its observer so that we can listen for the OnPersonalDataLoaded signal.
+ if (!personal_data_->IsDataLoaded())
+ personal_data_->SetObserver(this);
+ else
+ OnPersonalDataLoaded();
+}
+
+void AutoFillManager::Reset() {
+ upload_form_structure_.reset();
+}
+
void AutoFillManager::DeterminePossibleFieldTypes(
FormStructure* form_structure) {
DCHECK(personal_data_);
@@ -260,20 +278,6 @@ void AutoFillManager::HandleSubmit() {
UploadFormData();
}
-void AutoFillManager::OnInfoBarAccepted() {
- DCHECK(personal_data_);
-
- PrefService* prefs = tab_contents_->profile()->GetPrefs();
- prefs->SetBoolean(prefs::kAutoFillEnabled, true);
-
- // If the personal data manager has not loaded the data yet, set ourselves as
- // its observer so that we can listen for the OnPersonalDataLoaded signal.
- if (!personal_data_->IsDataLoaded())
- personal_data_->SetObserver(this);
- else
- OnPersonalDataLoaded();
-}
-
void AutoFillManager::UploadFormData() {
std::string xml;
bool ok = upload_form_structure_->EncodeUploadRequest(false, &xml);
@@ -282,10 +286,6 @@ void AutoFillManager::UploadFormData() {
// TODO(jhawkins): Initiate the upload request thread.
}
-void AutoFillManager::Reset() {
- upload_form_structure_.reset();
-}
-
bool AutoFillManager::IsAutoFillEnabled() {
// The PersonalDataManager is NULL in OTR.
if (!personal_data_)
diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h
index 9263e08..ecc72d9 100644
--- a/chrome/browser/autofill/autofill_manager.h
+++ b/chrome/browser/autofill/autofill_manager.h
@@ -60,6 +60,12 @@ class AutoFillManager : public RenderViewHostDelegate::AutoFill,
// PersonalDataManager::Observer implementation:
virtual void OnPersonalDataLoaded();
+ // Called by the AutoFillInfoBarDelegate when the user accepts the infobar.
+ virtual void OnInfoBarAccepted();
+
+ // Resets the stored form data.
+ virtual void Reset();
+
// Uses heuristics and existing personal data to determine the possible field
// types.
void DeterminePossibleFieldTypes(FormStructure* form_structure);
@@ -67,15 +73,10 @@ class AutoFillManager : public RenderViewHostDelegate::AutoFill,
// Handles the form data submitted by the user.
void HandleSubmit();
- // Called by the AutoFillInfoBarDelegate when the user accepts the infobar.
- void OnInfoBarAccepted();
// Uploads the form data to the autofill server.
void UploadFormData();
- // Resets the stored form data.
- void Reset();
-
// Returns the value of the AutoFillEnabled pref.
bool IsAutoFillEnabled();