| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "sync/internal_api/public/base/invalidation_state.h" |
| 6 |
| 7 #include "base/values.h" |
| 8 |
| 9 namespace syncer { |
| 10 |
| 11 bool AckHandle::Equals(const AckHandle& other) const { |
| 12 return true; |
| 13 } |
| 14 |
| 15 scoped_ptr<base::Value> AckHandle::ToValue() const { |
| 16 return scoped_ptr<base::Value>(new DictionaryValue()); |
| 17 } |
| 18 |
| 19 bool AckHandle::ResetFromValue(const base::Value& value) { |
| 20 return true; |
| 21 } |
| 22 |
| 23 bool InvalidationState::Equals(const InvalidationState& other) const { |
| 24 return (payload == other.payload) && ack_handle.Equals(other.ack_handle); |
| 25 } |
| 26 |
| 27 scoped_ptr<base::DictionaryValue> InvalidationState::ToValue() const { |
| 28 scoped_ptr<DictionaryValue> value(new DictionaryValue()); |
| 29 value->SetString("payload", payload); |
| 30 value->Set("ackHandle", ack_handle.ToValue().release()); |
| 31 return value.Pass(); |
| 32 } |
| 33 |
| 34 bool InvalidationState::ResetFromValue(const base::DictionaryValue& value) { |
| 35 const base::Value* ack_handle_value = NULL; |
| 36 return |
| 37 value.GetString("payload", &payload) && |
| 38 value.Get("ackHandle", &ack_handle_value) && |
| 39 ack_handle.ResetFromValue(*ack_handle_value); |
| 40 } |
| 41 |
| 42 } // namespace syncer |
| OLD | NEW |