| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/invalidation/public/invalidation.h" | 5 #include "components/invalidation/public/invalidation.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool Invalidation::Equals(const Invalidation& other) const { | 136 bool Invalidation::Equals(const Invalidation& other) const { |
| 137 return id_ == other.id_ && is_unknown_version_ == other.is_unknown_version_ && | 137 return id_ == other.id_ && is_unknown_version_ == other.is_unknown_version_ && |
| 138 version_ == other.version_ && payload_ == other.payload_; | 138 version_ == other.version_ && payload_ == other.payload_; |
| 139 } | 139 } |
| 140 | 140 |
| 141 std::unique_ptr<base::DictionaryValue> Invalidation::ToValue() const { | 141 std::unique_ptr<base::DictionaryValue> Invalidation::ToValue() const { |
| 142 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); | 142 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); |
| 143 value->Set(kObjectIdKey, ObjectIdToValue(id_).release()); | 143 value->Set(kObjectIdKey, ObjectIdToValue(id_)); |
| 144 if (is_unknown_version_) { | 144 if (is_unknown_version_) { |
| 145 value->SetBoolean(kIsUnknownVersionKey, true); | 145 value->SetBoolean(kIsUnknownVersionKey, true); |
| 146 } else { | 146 } else { |
| 147 value->SetBoolean(kIsUnknownVersionKey, false); | 147 value->SetBoolean(kIsUnknownVersionKey, false); |
| 148 value->SetString(kVersionKey, base::Int64ToString(version_)); | 148 value->SetString(kVersionKey, base::Int64ToString(version_)); |
| 149 value->SetString(kPayloadKey, payload_); | 149 value->SetString(kPayloadKey, payload_); |
| 150 } | 150 } |
| 151 return value; | 151 return value; |
| 152 } | 152 } |
| 153 | 153 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 164 int64_t version, | 164 int64_t version, |
| 165 const std::string& payload, | 165 const std::string& payload, |
| 166 AckHandle ack_handle) | 166 AckHandle ack_handle) |
| 167 : id_(id), | 167 : id_(id), |
| 168 is_unknown_version_(is_unknown_version), | 168 is_unknown_version_(is_unknown_version), |
| 169 version_(version), | 169 version_(version), |
| 170 payload_(payload), | 170 payload_(payload), |
| 171 ack_handle_(ack_handle) {} | 171 ack_handle_(ack_handle) {} |
| 172 | 172 |
| 173 } // namespace syncer | 173 } // namespace syncer |
| OLD | NEW |