Chromium Code Reviews| Index: components/autofill/browser/personal_data_manager.cc |
| diff --git a/components/autofill/browser/personal_data_manager.cc b/components/autofill/browser/personal_data_manager.cc |
| index 7317a6b8998305247638f9c842cbe7c3874d68ed..b4686e76ac19610ea0f11479a2a543ebbafd0411 100644 |
| --- a/components/autofill/browser/personal_data_manager.cc |
| +++ b/components/autofill/browser/personal_data_manager.cc |
| @@ -131,15 +131,17 @@ void PersonalDataManager::Init(BrowserContext* browser_context) { |
| LoadProfiles(); |
| LoadCreditCards(); |
| - notification_registrar_.Add( |
| - this, |
| - chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED, |
| - autofill_data->GetNotificationSource()); |
| + autofill_data->AddObserver(this); |
|
dhollowa
2013/03/12 22:22:28
Please use ScopedObserver.
kaiwang
2013/03/13 04:57:20
Can not do it here.. AutofillWebDataService is a w
dhollowa
2013/03/13 16:15:28
This should work:
scoped_observer_.Add(autofill_
kaiwang
2013/03/13 17:27:40
AutofillWebDataService is a thin wrapper. Every ti
dhollowa
2013/03/14 00:35:17
Got it. Ok.
|
| } |
| PersonalDataManager::~PersonalDataManager() { |
| CancelPendingQuery(&pending_profiles_query_); |
| CancelPendingQuery(&pending_creditcards_query_); |
| + |
| + scoped_ptr<AutofillWebDataService> autofill_data( |
| + AutofillWebDataService::FromBrowserContext(browser_context_)); |
| + if (autofill_data.get()) |
| + autofill_data->RemoveObserver(this); |
| } |
| void PersonalDataManager::OnWebDataServiceRequestDone( |
| @@ -182,6 +184,10 @@ void PersonalDataManager::OnWebDataServiceRequestDone( |
| } |
| } |
| +void PersonalDataManager::AutofillMultipleChanged() { |
| + Refresh(); |
| +} |
| + |
| void PersonalDataManager::AddObserver(PersonalDataManagerObserver* observer) { |
| observers_.AddObserver(observer); |
| } |
| @@ -191,22 +197,6 @@ void PersonalDataManager::RemoveObserver( |
| observers_.RemoveObserver(observer); |
| } |
| -void PersonalDataManager::Observe(int type, |
| - const content::NotificationSource& source, |
| - const content::NotificationDetails& details) { |
| - DCHECK_EQ(type, chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED); |
| - |
| - if (DCHECK_IS_ON()) { |
| - scoped_ptr<AutofillWebDataService> autofill_data( |
| - AutofillWebDataService::FromBrowserContext(browser_context_)); |
| - |
| - DCHECK(autofill_data.get() && |
| - autofill_data->GetNotificationSource() == source); |
| - } |
| - |
| - Refresh(); |
| -} |
| - |
| bool PersonalDataManager::ImportFormData( |
| const FormStructure& form, |
| const CreditCard** imported_credit_card) { |