| Index: chrome/browser/webdata/web_data_service.cc
|
| diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc
|
| index 6fa69b4d1258e6e69c2840633540f73ac5d8e207..1391dbfadaa1dc2d749dce4d8b08ea26ae285753 100644
|
| --- a/chrome/browser/webdata/web_data_service.cc
|
| +++ b/chrome/browser/webdata/web_data_service.cc
|
| @@ -434,6 +434,16 @@ WebDataService::Handle WebDataService::GetAutofillProfiles(
|
| return request->GetHandle();
|
| }
|
|
|
| +void WebDataService::EmptyMigrationTrash(bool notify_sync) {
|
| + GenericRequest<bool>* request =
|
| + new GenericRequest<bool>(
|
| + this, GetNextRequestHandle(), NULL, notify_sync);
|
| + RegisterRequest(request);
|
| + ScheduleTask(NewRunnableMethod(this,
|
| + &WebDataService::EmptyMigrationTrashImpl,
|
| + request));
|
| +}
|
| +
|
| void WebDataService::AddCreditCard(const CreditCard& credit_card) {
|
| GenericRequest<CreditCard>* request =
|
| new GenericRequest<CreditCard>(
|
| @@ -1088,6 +1098,57 @@ void WebDataService::GetAutofillProfilesImpl(WebDataRequest* request) {
|
| request->RequestComplete();
|
| }
|
|
|
| +void WebDataService::EmptyMigrationTrashImpl(
|
| + GenericRequest<bool>* request) {
|
| + InitializeDatabaseIfNecessary();
|
| + if (db_ && !request->IsCancelled()) {
|
| + bool notify_sync = request->GetArgument();
|
| + if (notify_sync) {
|
| + std::vector<std::string> guids;
|
| + if (!db_->GetAutofillProfilesInTrash(&guids)) {
|
| + NOTREACHED();
|
| + return;
|
| + }
|
| +
|
| + for (std::vector<std::string>::const_iterator iter = guids.begin();
|
| + iter != guids.end(); ++iter) {
|
| + // Send GUID-based notification.
|
| + AutofillProfileChange change(AutofillProfileChange::REMOVE,
|
| + *iter, NULL);
|
| + NotificationService::current()->Notify(
|
| + NotificationType::AUTOFILL_PROFILE_CHANGED,
|
| + Source<WebDataService>(this),
|
| + Details<AutofillProfileChange>(&change));
|
| + }
|
| +
|
| + // If we trashed any profiles they may have been merged, so send out
|
| + // update notifications as well.
|
| + if (!guids.empty()) {
|
| + std::vector<AutofillProfile*> profiles;
|
| + db_->GetAutofillProfiles(&profiles);
|
| + for (std::vector<AutofillProfile*>::const_iterator
|
| + iter = profiles.begin();
|
| + iter != profiles.end(); ++iter) {
|
| + AutofillProfileChange change(AutofillProfileChange::UPDATE,
|
| + (*iter)->guid(), *iter);
|
| + NotificationService::current()->Notify(
|
| + NotificationType::AUTOFILL_PROFILE_CHANGED,
|
| + Source<WebDataService>(this),
|
| + Details<AutofillProfileChange>(&change));
|
| + }
|
| + STLDeleteElements(&profiles);
|
| + }
|
| + }
|
| +
|
| + if (!db_->EmptyAutofillProfilesTrash()) {
|
| + NOTREACHED();
|
| + return;
|
| + }
|
| + ScheduleCommit();
|
| + }
|
| + request->RequestComplete();
|
| +}
|
| +
|
| void WebDataService::AddCreditCardImpl(
|
| GenericRequest<CreditCard>* request) {
|
| InitializeDatabaseIfNecessary();
|
|
|