Index: content/browser/background_sync/background_sync_service_impl.cc |
diff --git a/content/browser/background_sync/background_sync_service_impl.cc b/content/browser/background_sync/background_sync_service_impl.cc |
index 9f51f9a70af6ed03f9c631e5fbb0f07cba7ad88a..b8c03df798b7abba2e6f0ab90a4d0c8964c1e5c6 100644 |
--- a/content/browser/background_sync/background_sync_service_impl.cc |
+++ b/content/browser/background_sync/background_sync_service_impl.cc |
@@ -227,6 +227,23 @@ void BackgroundSyncServiceImpl::ReleaseRegistration( |
active_handles_.Remove(handle_id); |
} |
+void BackgroundSyncServiceImpl::NotifyWhenDone( |
+ BackgroundSyncRegistrationHandle::HandleId handle_id, |
+ const NotifyWhenDoneCallback& callback) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ BackgroundSyncRegistrationHandle* registration = |
+ active_handles_.Lookup(handle_id); |
+ if (!registration) { |
+ callback.Run(BACKGROUND_SYNC_ERROR_NOT_ALLOWED, |
+ BACKGROUND_SYNC_STATE_FAILED); |
+ return; |
+ } |
+ |
+ registration->NotifyWhenDone( |
+ base::Bind(&BackgroundSyncServiceImpl::OnNotifyWhenDoneResult, |
+ weak_ptr_factory_.GetWeakPtr(), callback)); |
+} |
+ |
void BackgroundSyncServiceImpl::OnRegisterResult( |
const RegisterCallback& callback, |
BackgroundSyncStatus status, |
@@ -271,4 +288,12 @@ void BackgroundSyncServiceImpl::OnGetRegistrationsResult( |
mojo_registrations.Pass()); |
} |
+void BackgroundSyncServiceImpl::OnNotifyWhenDoneResult( |
+ const NotifyWhenDoneCallback& callback, |
+ BackgroundSyncStatus status, |
+ BackgroundSyncState sync_state) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ callback.Run(static_cast<content::BackgroundSyncError>(status), sync_state); |
+} |
+ |
} // namespace content |