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_H_ | 5 #ifndef CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ |
6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ | 6 #define CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 21 matching lines...) Expand all Loading... |
32 ~BackgroundSyncRegistration(); | 32 ~BackgroundSyncRegistration(); |
33 | 33 |
34 bool Equals(const BackgroundSyncRegistration& other) const; | 34 bool Equals(const BackgroundSyncRegistration& other) const; |
35 bool IsValid() const; | 35 bool IsValid() const; |
36 void AddFinishedCallback(const StateCallback& callback); | 36 void AddFinishedCallback(const StateCallback& callback); |
37 void RunFinishedCallbacks(); | 37 void RunFinishedCallbacks(); |
38 bool HasCompleted() const; | 38 bool HasCompleted() const; |
39 bool IsFiring() const; | 39 bool IsFiring() const; |
40 | 40 |
41 // If the registration is currently firing, sets its state to | 41 // If the registration is currently firing, sets its state to |
42 // BACKGROUND_SYNC_STATE_UNREGISTERED_WHILE_FIRING. If it is firing, it sets | 42 // BackgroundSyncState::UNREGISTERED_WHILE_FIRING. If it is firing, it sets |
43 // the state to BACKGROUND_SYNC_STATE_UNREGISTERED and calls | 43 // the state to BackgroundSyncState::UNREGISTERED and calls |
44 // RunFinishedCallbacks. | 44 // RunFinishedCallbacks. |
45 void SetUnregisteredState(); | 45 void SetUnregisteredState(); |
46 | 46 |
47 const BackgroundSyncRegistrationOptions* options() const { return &options_; } | 47 const BackgroundSyncRegistrationOptions* options() const { return &options_; } |
48 BackgroundSyncRegistrationOptions* options() { return &options_; } | 48 BackgroundSyncRegistrationOptions* options() { return &options_; } |
49 | 49 |
50 RegistrationId id() const { return id_; } | 50 RegistrationId id() const { return id_; } |
51 void set_id(RegistrationId id) { id_ = id; } | 51 void set_id(RegistrationId id) { id_ = id; } |
52 | 52 |
53 BackgroundSyncState sync_state() const { return sync_state_; } | 53 BackgroundSyncState sync_state() const { return sync_state_; } |
54 void set_sync_state(BackgroundSyncState state) { sync_state_ = state; } | 54 void set_sync_state(BackgroundSyncState state) { sync_state_ = state; } |
55 | 55 |
56 int num_attempts() const { return num_attempts_; } | 56 int num_attempts() const { return num_attempts_; } |
57 void set_num_attempts(int num_attempts) { num_attempts_ = num_attempts; } | 57 void set_num_attempts(int num_attempts) { num_attempts_ = num_attempts; } |
58 | 58 |
59 base::Time delay_until() const { return delay_until_; } | 59 base::Time delay_until() const { return delay_until_; } |
60 void set_delay_until(base::Time delay_until) { delay_until_ = delay_until; } | 60 void set_delay_until(base::Time delay_until) { delay_until_ = delay_until; } |
61 | 61 |
62 private: | 62 private: |
63 static const RegistrationId kInvalidRegistrationId; | 63 static const RegistrationId kInvalidRegistrationId; |
64 | 64 |
65 BackgroundSyncRegistrationOptions options_; | 65 BackgroundSyncRegistrationOptions options_; |
66 RegistrationId id_ = kInvalidRegistrationId; | 66 RegistrationId id_ = kInvalidRegistrationId; |
67 BackgroundSyncState sync_state_ = BACKGROUND_SYNC_STATE_PENDING; | 67 BackgroundSyncState sync_state_ = BackgroundSyncState::PENDING; |
68 int num_attempts_ = 0; | 68 int num_attempts_ = 0; |
69 base::Time delay_until_; | 69 base::Time delay_until_; |
70 | 70 |
71 std::list<StateCallback> notify_finished_callbacks_; | 71 std::list<StateCallback> notify_finished_callbacks_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncRegistration); | 73 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncRegistration); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace content | 76 } // namespace content |
77 | 77 |
(...skipping 10 matching lines...) Expand all Loading... |
88 template <> | 88 template <> |
89 struct CONTENT_EXPORT TypeConverter<content::SyncRegistrationPtr, | 89 struct CONTENT_EXPORT TypeConverter<content::SyncRegistrationPtr, |
90 content::BackgroundSyncRegistration> { | 90 content::BackgroundSyncRegistration> { |
91 static content::SyncRegistrationPtr Convert( | 91 static content::SyncRegistrationPtr Convert( |
92 const content::BackgroundSyncRegistration& input); | 92 const content::BackgroundSyncRegistration& input); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace | 95 } // namespace |
96 | 96 |
97 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ | 97 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ |
OLD | NEW |