| 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_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_STATE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class DictionaryValue; | 13 class DictionaryValue; |
| 14 class Value; | 14 class Value; |
| 15 } // namespace | 15 } // namespace |
| 16 | 16 |
| 17 namespace syncer { | 17 namespace syncer { |
| 18 | 18 |
| 19 // Opaque class that represents an ack handle. | 19 // Opaque class that represents an ack handle. |
| 20 // TODO(dcheng): This is just a refactoring change, so the class is empty for | 20 // TODO(dcheng): This is just a refactoring change, so the class is empty for |
| 21 // the moment. It will be filled once we start implementing 'reminders'. | 21 // the moment. It will be filled once we start implementing 'reminders'. |
| 22 class AckHandle { | 22 class AckHandle { |
| 23 public: | 23 public: |
| 24 bool Equals(const AckHandle& other) const; | 24 bool Equals(const AckHandle& other) const; |
| 25 | 25 |
| 26 scoped_ptr<base::Value> ToValue() const; | 26 scoped_ptr<base::Value> ToValue() const; |
| 27 | 27 |
| 28 bool ResetFromValue(const base::Value& value); | 28 bool ResetFromValue(const base::Value& value); |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 struct InvalidationState { | 31 // Represents a local invalidation, and is roughly analogous to |
| 32 // invalidation::Invalidation. It contains a payload (which may be empty) and an |
| 33 // associated ack handle that an InvalidationHandler implementation can use to |
| 34 // acknowledge receipt of the invalidation. It does not embed the object ID, |
| 35 // since it is typically associated with it through ObjectIdInvalidationMap. |
| 36 struct Invalidation { |
| 32 std::string payload; | 37 std::string payload; |
| 33 AckHandle ack_handle; | 38 AckHandle ack_handle; |
| 34 | 39 |
| 35 bool Equals(const InvalidationState& other) const; | 40 bool Equals(const Invalidation& other) const; |
| 36 | 41 |
| 37 // Caller owns the returned DictionaryValue. | 42 // Caller owns the returned DictionaryValue. |
| 38 scoped_ptr<base::DictionaryValue> ToValue() const; | 43 scoped_ptr<base::DictionaryValue> ToValue() const; |
| 39 | 44 |
| 40 bool ResetFromValue(const base::DictionaryValue& value); | 45 bool ResetFromValue(const base::DictionaryValue& value); |
| 41 }; | 46 }; |
| 42 | 47 |
| 43 } // namespace syncer | 48 } // namespace syncer |
| 44 | 49 |
| 45 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_STATE_H_ | 50 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_INVALIDATION_H_ |
| OLD | NEW |