Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2758)

Unified Diff: chrome/browser/autofill/autofill_manager.cc

Issue 3149005: Fix for: Autofill on Windows does not work for the first autofillable page en... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_manager.cc
===================================================================
--- chrome/browser/autofill/autofill_manager.cc (revision 57242)
+++ chrome/browser/autofill/autofill_manager.cc (working copy)
@@ -107,10 +107,14 @@
personal_data_ =
tab_contents_->profile()->GetOriginalProfile()->GetPersonalDataManager();
download_manager_.SetObserver(this);
+ if (personal_data_)
+ personal_data_->SetObserver(this);
}
AutoFillManager::~AutoFillManager() {
download_manager_.SetObserver(NULL);
+ if (personal_data_)
+ personal_data_->RemoveObserver(this);
}
// static
@@ -159,6 +163,12 @@
if (!IsAutoFillEnabled())
return;
+ if (!personal_data_->IsDataLoaded()) {
+ // Profile data is in the process of loading: delay parsing of the forms.
+ delayed_forms_.push_back(forms);
+ return;
+ }
+
// No profiles or credit cards, no need to parse the forms.
if (personal_data_->profiles().empty() &&
personal_data_->credit_cards().empty())
@@ -403,6 +413,14 @@
int http_error) {
}
+void AutoFillManager::OnPersonalDataLoaded() {
+ DCHECK(personal_data_->IsDataLoaded());
+ while (!delayed_forms_.empty()) {
+ FormsSeen(delayed_forms_.front());
+ delayed_forms_.pop_front();
+ }
+}
+
bool AutoFillManager::IsAutoFillEnabled() const {
PrefService* prefs = tab_contents_->profile()->GetPrefs();
@@ -477,6 +495,8 @@
download_manager_(NULL),
disable_download_manager_requests_(false) {
DCHECK(tab_contents);
+ if (personal_data_)
+ personal_data_->SetObserver(this);
}
void AutoFillManager::GetProfileSuggestions(FormStructure* form,
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698