Index: content/browser/background_sync/client_background_sync_registration.h |
diff --git a/content/browser/background_sync/client_background_sync_registration.h b/content/browser/background_sync/client_background_sync_registration.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b8c90462653566dc545bdf85456277a56010d867 |
--- /dev/null |
+++ b/content/browser/background_sync/client_background_sync_registration.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H_ |
+#define CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H_ |
+ |
+#include "base/callback.h" |
+#include "content/browser/background_sync/background_sync_registration.h" |
+#include "content/browser/background_sync/background_sync_status.h" |
+#include "content/common/content_export.h" |
+ |
+namespace content { |
+ |
+class BackgroundSyncManager; |
+ |
+// BackgroundSyncRegistrations that are exposed to clients. They call |
+// ReleaseRegistration on deletion and provide access to Unregister. |
+// ClientBackgroundSyncRegistration objects must be deleted before the |
+// BackgroundSyncManager is deleted. |
+class CONTENT_EXPORT ClientBackgroundSyncRegistration |
+ : public BackgroundSyncRegistration { |
+ public: |
+ using StatusCallback = base::Callback<void(BackgroundSyncStatus)>; |
+ |
+ explicit ClientBackgroundSyncRegistration( |
+ BackgroundSyncManager* background_sync_manager); |
+ ~ClientBackgroundSyncRegistration() override; |
+ |
+ // Unregisters the background sync registration. Calls |callback| |
+ // with BACKGROUND_SYNC_STATUS_OK on success. |
iclelland
2015/08/17 19:22:02
And never, ever fails ;)
(I don't know if we need
jkarlin
2015/08/18 15:12:38
:) Changed to "if it succeeds".
|
+ void Unregister(int64 service_worker_id, const StatusCallback& callback); |
+ |
+ bool IsValid() const override; |
+ |
+ private: |
+ // This object must be deleted before the BackgroundSyncManager |
+ // is deleted. |
+ BackgroundSyncManager* background_sync_manager_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ClientBackgroundSyncRegistration); |
+}; |
+ |
+} // namespace |
+ |
+#endif // CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H_ |