Chromium Code Reviews| 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..39e4217acc8426f29b118ed76e42cab54a8ba5f9 |
| --- /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 { |
|
michaeln
2015/08/19 01:56:01
This derivation seems a little odd to me.
(I thin
jkarlin
2015/08/19 12:47:06
That's fair. Perhaps it shouldn't be a sub-class o
jkarlin
2015/08/19 17:24:22
Ah, I think perhaps you're getting at something li
|
| + 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 if it succeeds. |
| + void Unregister(int64 service_worker_id, const StatusCallback& callback); |
|
michaeln
2015/08/19 01:56:01
ah, now i see there unregister has gone
jkarlin
2015/08/19 12:47:06
Acknowledged.
|
| + |
| + bool IsValid() const override; |
| + |
| + private: |
| + // This object must be deleted before the BackgroundSyncManager |
| + // is deleted. |
|
michaeln
2015/08/19 01:56:01
It might be worth using weakptrs here since these
jkarlin
2015/08/19 12:47:06
There is a DCHECK to verify that clients call it p
|
| + BackgroundSyncManager* background_sync_manager_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ClientBackgroundSyncRegistration); |
| +}; |
| + |
| +} // namespace |
| + |
| +#endif // CONTENT_BROWSER_BACKGROUND_SYNC_CLIENT_BACKGROUND_SYNC_REGISTRATION_H_ |