| 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 "components/sync/syncable/syncable_id.h" | 5 #include "components/sync/syncable/syncable_id.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 | 9 |
| 10 using std::ostream; | 10 using std::ostream; |
| 11 using std::string; | 11 using std::string; |
| 12 | 12 |
| 13 namespace syncer { | 13 namespace syncer { |
| 14 namespace syncable { | 14 namespace syncable { |
| 15 | 15 |
| 16 ostream& operator<<(ostream& out, const Id& id) { | 16 ostream& operator<<(ostream& out, const Id& id) { |
| 17 out << id.s_; | 17 out << id.s_; |
| 18 return out; | 18 return out; |
| 19 } | 19 } |
| 20 | 20 |
| 21 base::StringValue* Id::ToValue() const { | 21 base::Value* Id::ToValue() const { |
| 22 return new base::StringValue(s_); | 22 return new base::Value(s_); |
| 23 } | 23 } |
| 24 | 24 |
| 25 string Id::GetServerId() const { | 25 string Id::GetServerId() const { |
| 26 // Currently root is the string "0". We need to decide on a true value. | 26 // Currently root is the string "0". We need to decide on a true value. |
| 27 // "" would be convenient here, as the IsRoot call would not be needed. | 27 // "" would be convenient here, as the IsRoot call would not be needed. |
| 28 DCHECK(!IsNull()); | 28 DCHECK(!IsNull()); |
| 29 if (IsRoot()) | 29 if (IsRoot()) |
| 30 return "0"; | 30 return "0"; |
| 31 return s_.substr(1); | 31 return s_.substr(1); |
| 32 } | 32 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // static | 70 // static |
| 71 Id Id::GetLeastIdForLexicographicComparison() { | 71 Id Id::GetLeastIdForLexicographicComparison() { |
| 72 Id id; | 72 Id id; |
| 73 id.s_.clear(); | 73 id.s_.clear(); |
| 74 return id; | 74 return id; |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace syncable | 77 } // namespace syncable |
| 78 } // namespace syncer | 78 } // namespace syncer |
| OLD | NEW |