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