Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: content/browser/background_sync/background_sync_registration_handle.h

Issue 1344843003: [BackgroundSync] Add browser side support for SyncRegistration.done (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ncn_max
Patch Set: Address comments from PS7 Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698