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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 DCHECK(background_sync_manager_); | 43 DCHECK(background_sync_manager_); |
44 return registration_->sync_state(); | 44 return registration_->sync_state(); |
45 } | 45 } |
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 BACKGROUND_SYNC_STATE_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 // BACKGROUND_SYNC_STATE_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. NotifyWhenFinished should only be called for |
57 // SYNC_ONE_SHOT registrations. | 57 // SYNC_ONE_SHOT registrations. |
58 void NotifyWhenFinished(const StatusAndStateCallback& callback); | 58 void NotifyWhenFinished(const StatusAndStateCallback& callback); |
59 | 59 |
60 // Returns true if the handle is backed by a BackgroundSyncRegistration in the | 60 // Returns true if the handle is backed by a BackgroundSyncRegistration in the |
61 // BackgroundSyncManager. | 61 // BackgroundSyncManager. |
62 bool IsValid() const; | 62 bool IsValid() const; |
63 | 63 |
64 HandleId handle_id() const { return handle_id_; } | 64 HandleId handle_id() const { return handle_id_; } |
65 | 65 |
(...skipping 20 matching lines...) Expand all Loading... |
86 // This is owned by background_sync_manager_ and is valid until handle_id_ is | 86 // 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. | 87 // released in the destructor or background_sync_manager_ has been destroyed. |
88 BackgroundSyncRegistration* registration_; | 88 BackgroundSyncRegistration* registration_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncRegistrationHandle); | 90 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncRegistrationHandle); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_HANDLE_H
_ | 95 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_HANDLE_H
_ |
OLD | NEW |