OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_HANDLE_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_HANDLE_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_HANDLE_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_HANDLE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // Unregisters the background sync registration. Calls |callback| | 47 // Unregisters the background sync registration. Calls |callback| |
48 // with BACKGROUND_SYNC_STATUS_OK if it succeeds. | 48 // with BACKGROUND_SYNC_STATUS_OK if it succeeds. |
49 void Unregister(int64_t service_worker_id, const StatusCallback& callback); | 49 void Unregister(int64_t service_worker_id, const StatusCallback& callback); |
50 | 50 |
51 // Runs |callback| when the registration associated with |handle_id| | 51 // Runs |callback| when the registration associated with |handle_id| |
52 // completes.The provided status is BACKGROUND_SYNC_STATUS_OK if the operation | 52 // completes.The provided status is BACKGROUND_SYNC_STATUS_OK if the operation |
53 // succeeded. The provided state is BackgroundSyncState::SUCCESS on success, | 53 // succeeded. The provided state is BackgroundSyncState::SUCCESS on success, |
54 // BACKGRUOND_SYNC_STATE_FAILED on final failure, and | 54 // BACKGRUOND_SYNC_STATE_FAILED on final failure, and |
55 // BackgroundSyncState::UNREGISTERED if the registration was unregistered | 55 // BackgroundSyncState::UNREGISTERED if the registration was unregistered |
56 // before it could complete. NotifyWhenFinished should only be called for | 56 // before it could complete. |
57 // SYNC_ONE_SHOT registrations. | |
58 void NotifyWhenFinished(const StatusAndStateCallback& callback); | 57 void NotifyWhenFinished(const StatusAndStateCallback& callback); |
59 | 58 |
60 // Returns true if the handle is backed by a BackgroundSyncRegistration in the | 59 // Returns true if the handle is backed by a BackgroundSyncRegistration in the |
61 // BackgroundSyncManager. | 60 // BackgroundSyncManager. |
62 bool IsValid() const; | 61 bool IsValid() const; |
63 | 62 |
64 HandleId handle_id() const { return handle_id_; } | 63 HandleId handle_id() const { return handle_id_; } |
65 | 64 |
66 private: | 65 private: |
67 friend class BackgroundSyncManager; | 66 friend class BackgroundSyncManager; |
(...skipping 18 matching lines...) Expand all Loading... |
86 // This is owned by background_sync_manager_ and is valid until handle_id_ is | 85 // This is owned by background_sync_manager_ and is valid until handle_id_ is |
87 // released in the destructor or background_sync_manager_ has been destroyed. | 86 // released in the destructor or background_sync_manager_ has been destroyed. |
88 BackgroundSyncRegistration* registration_; | 87 BackgroundSyncRegistration* registration_; |
89 | 88 |
90 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncRegistrationHandle); | 89 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncRegistrationHandle); |
91 }; | 90 }; |
92 | 91 |
93 } // namespace | 92 } // namespace |
94 | 93 |
95 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_HANDLE_H
_ | 94 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_HANDLE_H
_ |
OLD | NEW |