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 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 class CONTENT_EXPORT BackgroundSyncRegistration { | 24 class CONTENT_EXPORT BackgroundSyncRegistration { |
25 public: | 25 public: |
26 using RegistrationId = int64_t; | 26 using RegistrationId = int64_t; |
27 | 27 |
28 static const RegistrationId kInitialId; | 28 static const RegistrationId kInitialId; |
29 | 29 |
30 BackgroundSyncRegistration(); | 30 BackgroundSyncRegistration(); |
31 BackgroundSyncRegistration(const BackgroundSyncRegistration& other) = default; | |
iclelland
2016/03/08 16:48:14
Style question -- these are defined default inline
jkarlin
2016/03/08 19:37:36
Thanks. They're supposed to be in the header.
| |
32 BackgroundSyncRegistration& operator=( | |
33 const BackgroundSyncRegistration& other) = default; | |
34 | |
31 ~BackgroundSyncRegistration(); | 35 ~BackgroundSyncRegistration(); |
32 | 36 |
33 bool Equals(const BackgroundSyncRegistration& other) const; | 37 bool Equals(const BackgroundSyncRegistration& other) const; |
34 bool IsValid() const; | 38 bool IsValid() const; |
35 bool IsFiring() const; | 39 bool IsFiring() const; |
36 | 40 |
37 const BackgroundSyncRegistrationOptions* options() const { return &options_; } | 41 const BackgroundSyncRegistrationOptions* options() const { return &options_; } |
38 BackgroundSyncRegistrationOptions* options() { return &options_; } | 42 BackgroundSyncRegistrationOptions* options() { return &options_; } |
39 | 43 |
40 RegistrationId id() const { return id_; } | 44 RegistrationId id() const { return id_; } |
41 void set_id(RegistrationId id) { id_ = id; } | 45 void set_id(RegistrationId id) { id_ = id; } |
42 | 46 |
43 BackgroundSyncState sync_state() const { return sync_state_; } | 47 BackgroundSyncState sync_state() const { return sync_state_; } |
44 void set_sync_state(BackgroundSyncState state) { sync_state_ = state; } | 48 void set_sync_state(BackgroundSyncState state) { sync_state_ = state; } |
45 | 49 |
46 int num_attempts() const { return num_attempts_; } | 50 int num_attempts() const { return num_attempts_; } |
47 void set_num_attempts(int num_attempts) { num_attempts_ = num_attempts; } | 51 void set_num_attempts(int num_attempts) { num_attempts_ = num_attempts; } |
48 | 52 |
49 base::Time delay_until() const { return delay_until_; } | 53 base::Time delay_until() const { return delay_until_; } |
50 void set_delay_until(base::Time delay_until) { delay_until_ = delay_until; } | 54 void set_delay_until(base::Time delay_until) { delay_until_ = delay_until; } |
51 | 55 |
52 private: | 56 private: |
53 static const RegistrationId kInvalidRegistrationId; | 57 static const RegistrationId kInvalidRegistrationId; |
54 | 58 |
55 BackgroundSyncRegistrationOptions options_; | 59 BackgroundSyncRegistrationOptions options_; |
56 RegistrationId id_ = kInvalidRegistrationId; | 60 RegistrationId id_ = kInvalidRegistrationId; |
57 BackgroundSyncState sync_state_ = BackgroundSyncState::PENDING; | 61 BackgroundSyncState sync_state_ = BackgroundSyncState::PENDING; |
58 int num_attempts_ = 0; | 62 int num_attempts_ = 0; |
59 base::Time delay_until_; | 63 base::Time delay_until_; |
60 | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncRegistration); | |
63 }; | 64 }; |
64 | 65 |
65 } // namespace content | 66 } // namespace content |
66 | 67 |
67 namespace mojo { | 68 namespace mojo { |
68 | 69 |
69 template <> | 70 template <> |
70 struct CONTENT_EXPORT | 71 struct CONTENT_EXPORT |
71 TypeConverter<scoped_ptr<content::BackgroundSyncRegistration>, | 72 TypeConverter<scoped_ptr<content::BackgroundSyncRegistration>, |
72 content::SyncRegistrationPtr> { | 73 content::SyncRegistrationPtr> { |
73 static scoped_ptr<content::BackgroundSyncRegistration> Convert( | 74 static scoped_ptr<content::BackgroundSyncRegistration> Convert( |
74 const content::SyncRegistrationPtr& input); | 75 const content::SyncRegistrationPtr& input); |
75 }; | 76 }; |
76 | 77 |
77 template <> | 78 template <> |
78 struct CONTENT_EXPORT TypeConverter<content::SyncRegistrationPtr, | 79 struct CONTENT_EXPORT TypeConverter<content::SyncRegistrationPtr, |
79 content::BackgroundSyncRegistration> { | 80 content::BackgroundSyncRegistration> { |
80 static content::SyncRegistrationPtr Convert( | 81 static content::SyncRegistrationPtr Convert( |
81 const content::BackgroundSyncRegistration& input); | 82 const content::BackgroundSyncRegistration& input); |
82 }; | 83 }; |
83 | 84 |
84 } // namespace | 85 } // namespace |
85 | 86 |
86 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ | 87 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ |
OLD | NEW |