| Index: chrome/browser/autofill/autofill_manager.cc
|
| ===================================================================
|
| --- chrome/browser/autofill/autofill_manager.cc (revision 36779)
|
| +++ chrome/browser/autofill/autofill_manager.cc (working copy)
|
| @@ -10,7 +10,6 @@
|
| #include "chrome/browser/autofill/autofill_dialog.h"
|
| #include "chrome/browser/autofill/autofill_infobar_delegate.h"
|
| #include "chrome/browser/autofill/form_structure.h"
|
| -#include "chrome/browser/autofill/personal_data_manager.h"
|
| #include "chrome/browser/profile.h"
|
| #include "chrome/browser/tab_contents/tab_contents.h"
|
| #include "chrome/common/chrome_switches.h"
|
| @@ -61,11 +60,26 @@
|
| }
|
|
|
| void AutoFillManager::OnAutoFillDialogApply(
|
| - const std::vector<AutoFillProfile>& profiles,
|
| - const std::vector<CreditCard>& credit_cards) {
|
| - // TODO(jhawkins): Pass the profile data onto the PersonalDataManager.
|
| + std::vector<AutoFillProfile>* profiles,
|
| + std::vector<CreditCard>* credit_cards) {
|
| + // Save the personal data.
|
| + personal_data_->SetProfiles(profiles);
|
| + // TODO(jhawkins): Set the credit cards.
|
| +
|
| + HandleSubmit();
|
| }
|
|
|
| +void AutoFillManager::OnPersonalDataLoaded() {
|
| + // We might have been alerted that the PersonalDataManager has loaded, so
|
| + // remove ourselves as observer.
|
| + personal_data_->RemoveObserver(this);
|
| +
|
| + // TODO(jhawkins): Actually send in the real credit cards from the personal
|
| + // data manager.
|
| + std::vector<CreditCard*> credit_cards;
|
| + ShowAutoFillDialog(this, personal_data_->profiles(), credit_cards);
|
| +}
|
| +
|
| void AutoFillManager::DeterminePossibleFieldTypes(
|
| FormStructure* form_structure) {
|
| // TODO(jhawkins): Update field text.
|
| @@ -93,13 +107,12 @@
|
| PrefService* prefs = tab_contents_->profile()->GetPrefs();
|
| prefs->SetBoolean(prefs::kAutoFillEnabled, true);
|
|
|
| - // TODO(jhawkins): Actually send in the real profiles and credit cards from
|
| - // the personal data manager.
|
| - std::vector<AutoFillProfile> profiles;
|
| - std::vector<CreditCard> credit_cards;
|
| - ShowAutoFillDialog(this, profiles, credit_cards);
|
| -
|
| - HandleSubmit();
|
| + // 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::SaveFormData() {
|
|
|