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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/browser/background_sync/background_sync.pb.h" | 9 #include "content/browser/background_sync/background_sync.pb.h" |
10 #include "content/browser/background_sync/background_sync_registration_options.h " | 10 #include "content/browser/background_sync/background_sync_registration_options.h " |
11 #include "content/common/background_sync_service.mojom.h" | 11 #include "content/common/background_sync_service.mojom.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h" | 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/type_converter.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class CONTENT_EXPORT BackgroundSyncRegistration { | 17 class CONTENT_EXPORT BackgroundSyncRegistration { |
18 public: | 18 public: |
19 using RegistrationId = int64_t; | 19 using RegistrationId = int64_t; |
20 static const RegistrationId kInitialId; | 20 static const RegistrationId kInitialId; |
21 static const RegistrationId kInvalidRegistrationId; | |
iclelland
2015/08/14 14:44:18
Is this just for consistency? It doesn't look like
jkarlin
2015/08/17 17:14:49
Needed it but then didn't, forgot to clean up. Tha
| |
21 | 22 |
22 BackgroundSyncRegistration(); | 23 BackgroundSyncRegistration(); |
24 virtual ~BackgroundSyncRegistration(); | |
25 | |
23 bool Equals(const BackgroundSyncRegistration& other) const; | 26 bool Equals(const BackgroundSyncRegistration& other) const; |
24 bool IsValid() const; | 27 bool IsValid() const; |
25 | 28 |
26 const BackgroundSyncRegistrationOptions* options() const { return &options_; } | 29 const BackgroundSyncRegistrationOptions* options() const { return &options_; } |
27 BackgroundSyncRegistrationOptions* options() { return &options_; } | 30 BackgroundSyncRegistrationOptions* options() { return &options_; } |
28 | 31 |
29 RegistrationId id() const { return id_; } | 32 RegistrationId id() const { return id_; } |
30 void set_id(RegistrationId id) { id_ = id; } | 33 void set_id(RegistrationId id) { id_ = id; } |
31 | 34 |
32 SyncState sync_state() const { return sync_state_; } | 35 SyncState sync_state() const { return sync_state_; } |
33 void set_sync_state(SyncState state) { sync_state_ = state; } | 36 void set_sync_state(SyncState state) { sync_state_ = state; } |
34 | 37 |
35 private: | 38 private: |
36 static const RegistrationId kInvalidRegistrationId; | |
37 | 39 |
38 BackgroundSyncRegistrationOptions options_; | 40 BackgroundSyncRegistrationOptions options_; |
39 RegistrationId id_ = kInvalidRegistrationId; | 41 RegistrationId id_ = kInvalidRegistrationId; |
40 SyncState sync_state_ = SYNC_STATE_PENDING; | 42 SyncState sync_state_ = SYNC_STATE_PENDING; |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncRegistration); | |
iclelland
2015/08/14 14:44:18
Should there be an include for this, or is it enou
jkarlin
2015/08/17 17:14:49
Done.
| |
41 }; | 45 }; |
42 | 46 |
43 } // namespace content | 47 } // namespace content |
44 | 48 |
45 namespace mojo { | 49 namespace mojo { |
46 | 50 |
47 template <> | 51 template <> |
48 struct CONTENT_EXPORT | 52 struct CONTENT_EXPORT |
49 TypeConverter<scoped_ptr<content::BackgroundSyncRegistration>, | 53 TypeConverter<scoped_ptr<content::BackgroundSyncRegistration>, |
50 content::SyncRegistrationPtr> { | 54 content::SyncRegistrationPtr> { |
51 static scoped_ptr<content::BackgroundSyncRegistration> Convert( | 55 static scoped_ptr<content::BackgroundSyncRegistration> Convert( |
52 const content::SyncRegistrationPtr& input); | 56 const content::SyncRegistrationPtr& input); |
53 }; | 57 }; |
54 | 58 |
55 template <> | 59 template <> |
56 struct CONTENT_EXPORT TypeConverter<content::SyncRegistrationPtr, | 60 struct CONTENT_EXPORT TypeConverter<content::SyncRegistrationPtr, |
57 content::BackgroundSyncRegistration> { | 61 content::BackgroundSyncRegistration> { |
58 static content::SyncRegistrationPtr Convert( | 62 static content::SyncRegistrationPtr Convert( |
59 const content::BackgroundSyncRegistration& input); | 63 const content::BackgroundSyncRegistration& input); |
60 }; | 64 }; |
61 | 65 |
62 } // namespace | 66 } // namespace |
63 | 67 |
64 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ | 68 #endif // CONTENT_BROWSER_BACKGROUND_SYNC_BACKGROUND_SYNC_REGISTRATION_H_ |
OLD | NEW |