OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_STATE_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_STATE_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_STATE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_STATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 class DictionaryValue; | 14 class DictionaryValue; |
14 class Value; | 15 class Value; |
15 } // namespace | 16 } // namespace |
16 | 17 |
17 namespace syncer { | 18 namespace syncer { |
18 | 19 |
19 // Opaque class that represents an ack handle. | 20 // Opaque class that represents an ack handle. We don't reuse the Tango ack |
20 // TODO(dcheng): This is just a refactoring change, so the class is empty for | 21 // handles to avoid unnecessary dependencies. |
21 // the moment. It will be filled once we start implementing 'reminders'. | |
22 class AckHandle { | 22 class AckHandle { |
23 public: | 23 public: |
24 static AckHandle CreateUnique(); | |
25 static AckHandle InvalidAckHandle(); | |
26 | |
24 bool Equals(const AckHandle& other) const; | 27 bool Equals(const AckHandle& other) const; |
25 | 28 |
26 scoped_ptr<base::Value> ToValue() const; | 29 scoped_ptr<base::Value> ToValue() const; |
30 bool ResetFromValue(const base::Value& value); | |
27 | 31 |
28 bool ResetFromValue(const base::Value& value); | 32 private: |
33 AckHandle(const std::string& state); | |
34 | |
35 std::string state_; | |
akalin
2012/09/17 23:59:54
since we have complete freedom in what the AckHand
dcheng
2012/09/25 22:35:06
I'd prefer to leave this sort of thing out of rele
akalin
2012/10/01 23:23:08
We can keep a lid on people trying to expose it, r
| |
29 }; | 36 }; |
30 | 37 |
31 struct InvalidationState { | 38 struct InvalidationState { |
32 std::string payload; | 39 InvalidationState(); |
33 AckHandle ack_handle; | |
34 | 40 |
35 bool Equals(const InvalidationState& other) const; | 41 bool Equals(const InvalidationState& other) const; |
36 | 42 |
37 // Caller owns the returned DictionaryValue. | |
38 scoped_ptr<base::DictionaryValue> ToValue() const; | 43 scoped_ptr<base::DictionaryValue> ToValue() const; |
44 bool ResetFromValue(const base::DictionaryValue& value); | |
39 | 45 |
40 bool ResetFromValue(const base::DictionaryValue& value); | 46 std::string payload; |
47 AckHandle ack_handle; | |
41 }; | 48 }; |
42 | 49 |
43 } // namespace syncer | 50 } // namespace syncer |
44 | 51 |
45 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_STATE_H_ | 52 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_STATE_H_ |
OLD | NEW |