Index: content/browser/background_sync/background_sync_registration_handle.h |
diff --git a/content/browser/background_sync/background_sync_registration_handle.h b/content/browser/background_sync/background_sync_registration_handle.h |
index 564bd584dc6dc6946696d8ff256ff4bae79a471a..f2915d19dbb89f6bf0048c1226bafca254d81097 100644 |
--- a/content/browser/background_sync/background_sync_registration_handle.h |
+++ b/content/browser/background_sync/background_sync_registration_handle.h |
@@ -10,6 +10,7 @@ |
#include "base/memory/weak_ptr.h" |
#include "content/browser/background_sync/background_sync_registration.h" |
#include "content/browser/background_sync/background_sync_status.h" |
+#include "content/common/background_sync_service.mojom.h" |
#include "content/common/content_export.h" |
namespace content { |
@@ -25,6 +26,8 @@ class CONTENT_EXPORT BackgroundSyncRegistrationHandle { |
public: |
using HandleId = int; |
using StatusCallback = base::Callback<void(BackgroundSyncStatus)>; |
+ using StatusAndStateCallback = |
+ base::Callback<void(BackgroundSyncStatus, BackgroundSyncState)>; |
~BackgroundSyncRegistrationHandle(); |
@@ -42,6 +45,15 @@ class CONTENT_EXPORT BackgroundSyncRegistrationHandle { |
// with BACKGROUND_SYNC_STATUS_OK if it succeeds. |
void Unregister(int64_t service_worker_id, const StatusCallback& callback); |
+ // Runs |callback| when the registration associated with |handle_id| |
+ // completes.The provided status is BACKGROUND_SYNC_STATUS_OK if the operation |
+ // succeeded. The provided state is BACKGROUND_SYNC_STATE_SUCCESS on success, |
+ // BACKGRUOND_SYNC_STATE_FAILED on final failure, and |
+ // BACKGROUND_SYNC_STATE_UNREGISTERED if the registration was unregistered |
+ // before it could complete. NotifyWhenDone should only be called for |
+ // SYNC_ONE_SHOT registrations. |
+ void NotifyWhenDone(const StatusAndStateCallback& callback); |
+ |
// Returns true if the handle is backed by a BackgroundSyncRegistration in the |
// BackgroundSyncManager. |
bool IsValid() const; |