Index: chrome/browser/autofill/personal_data_manager.cc |
=================================================================== |
--- chrome/browser/autofill/personal_data_manager.cc (revision 136877) |
+++ chrome/browser/autofill/personal_data_manager.cc (working copy) |
@@ -25,6 +25,7 @@ |
#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/browser/webdata/autofill_entry.h" |
#include "chrome/browser/webdata/web_data_service.h" |
+#include "chrome/browser/webdata/web_data_service_factory.h" |
#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/pref_names.h" |
#include "content/public/browser/browser_thread.h" |
@@ -170,10 +171,11 @@ |
ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); |
if (sync_service && (!sync_service->HasSyncSetupCompleted() || |
!profile_->GetPrefs()->GetBoolean(prefs::kSyncAutofill))) { |
- WebDataService* wds = |
- profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (wds) |
- wds->RemoveExpiredFormElements(); |
+ scoped_refptr<WebDataService> web_data_service = |
+ WebDataServiceFactory::GetForProfile(profile_, |
+ Profile::EXPLICIT_ACCESS); |
+ if (web_data_service) |
+ web_data_service->RemoveExpiredFormElements(); |
} |
} |
} |
@@ -198,9 +200,9 @@ |
if (!profile_ || profile_->IsOffTheRecord()) |
return; |
- WebDataService* web_data_service = |
- profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!web_data_service) { |
+ scoped_refptr<WebDataService> web_data_service = |
+ WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
+ if (!web_data_service.get()) { |
NOTREACHED(); |
return; |
} |
@@ -226,12 +228,12 @@ |
const content::NotificationSource& source, |
const content::NotificationDetails& details) { |
DCHECK_EQ(type, chrome::NOTIFICATION_AUTOFILL_MULTIPLE_CHANGED); |
- WebDataService* web_data_service = |
+ scoped_refptr<WebDataService> web_data_service = |
content::Source<WebDataService>(source).ptr(); |
- DCHECK(web_data_service && |
- web_data_service == |
- profile_->GetWebDataService(Profile::EXPLICIT_ACCESS)); |
+ DCHECK(web_data_service.get() && |
+ web_data_service.get() == WebDataServiceFactory::GetForProfile( |
+ profile_, Profile::EXPLICIT_ACCESS).get()); |
Refresh(); |
} |
@@ -364,8 +366,9 @@ |
if (FindByGUID<AutofillProfile>(web_profiles_, profile.guid())) |
return; |
- WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!wds) |
+ scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( |
+ profile_, Profile::EXPLICIT_ACCESS); |
+ if (!wds.get()) |
return; |
// Don't add a duplicate. |
@@ -391,8 +394,9 @@ |
return; |
} |
- WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!wds) |
+ scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( |
+ profile_, Profile::EXPLICIT_ACCESS); |
+ if (!wds.get()) |
return; |
// Make the update. |
@@ -409,8 +413,9 @@ |
if (!FindByGUID<AutofillProfile>(web_profiles_, guid)) |
return; |
- WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!wds) |
+ scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( |
+ profile_, Profile::EXPLICIT_ACCESS); |
+ if (!wds.get()) |
return; |
// Remove the profile. |
@@ -440,8 +445,9 @@ |
if (FindByGUID<CreditCard>(credit_cards_, credit_card.guid())) |
return; |
- WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!wds) |
+ scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( |
+ profile_, Profile::EXPLICIT_ACCESS); |
+ if (!wds.get()) |
return; |
// Don't add a duplicate. |
@@ -467,8 +473,9 @@ |
return; |
} |
- WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!wds) |
+ scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( |
+ profile_, Profile::EXPLICIT_ACCESS); |
+ if (!wds.get()) |
return; |
// Make the update. |
@@ -485,8 +492,9 @@ |
if (!FindByGUID<CreditCard>(credit_cards_, guid)) |
return; |
- WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!wds) |
+ scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( |
+ profile_, Profile::EXPLICIT_ACCESS); |
+ if (!wds.get()) |
return; |
// Remove the credit card. |
@@ -572,9 +580,9 @@ |
metric_logger_->LogIsAutofillEnabledAtStartup(IsAutofillEnabled()); |
// WebDataService may not be available in tests. |
- WebDataService* web_data_service = |
- profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!web_data_service) |
+ scoped_refptr<WebDataService> web_data_service = |
+ WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
+ if (!web_data_service.get()) |
return; |
LoadProfiles(); |
@@ -667,8 +675,9 @@ |
address_of<AutofillProfile>); |
AutofillProfile::AdjustInferredLabels(&profile_pointers); |
- WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!wds) |
+ scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( |
+ profile_, Profile::EXPLICIT_ACCESS); |
+ if (!wds.get()) |
return; |
// Any profiles that are not in the new profile list should be removed from |
@@ -718,8 +727,9 @@ |
std::mem_fun_ref(&CreditCard::IsEmpty)), |
credit_cards->end()); |
- WebDataService* wds = profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!wds) |
+ scoped_refptr<WebDataService> wds = WebDataServiceFactory::GetForProfile( |
+ profile_, Profile::EXPLICIT_ACCESS); |
+ if (!wds.get()) |
return; |
// Any credit cards that are not in the new credit card list should be |
@@ -757,9 +767,9 @@ |
} |
void PersonalDataManager::LoadProfiles() { |
- WebDataService* web_data_service = |
- profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!web_data_service) { |
+ scoped_refptr<WebDataService> web_data_service = |
+ WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
+ if (!web_data_service.get()) { |
NOTREACHED(); |
return; |
} |
@@ -777,9 +787,9 @@ |
#endif |
void PersonalDataManager::LoadCreditCards() { |
- WebDataService* web_data_service = |
- profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!web_data_service) { |
+ scoped_refptr<WebDataService> web_data_service = |
+ WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
+ if (!web_data_service.get()) { |
NOTREACHED(); |
return; |
} |
@@ -828,9 +838,10 @@ |
void PersonalDataManager::CancelPendingQuery(WebDataService::Handle* handle) { |
if (*handle) { |
- WebDataService* web_data_service = |
- profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!web_data_service) { |
+ scoped_refptr<WebDataService> web_data_service = |
+ WebDataServiceFactory::GetForProfile(profile_, |
+ Profile::EXPLICIT_ACCESS); |
+ if (!web_data_service.get()) { |
NOTREACHED(); |
return; |
} |
@@ -898,9 +909,9 @@ |
if (!profile_ || profile_->IsOffTheRecord()) |
return; |
- WebDataService* web_data_service = |
- profile_->GetWebDataService(Profile::EXPLICIT_ACCESS); |
- if (!web_data_service) { |
+ scoped_refptr<WebDataService> web_data_service = |
+ WebDataServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
+ if (!web_data_service.get()) { |
NOTREACHED(); |
return; |
} |