| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/syncable/syncable_id.h" | 5 #include "chrome/browser/sync/syncable/syncable_id.h" |
| 6 | 6 |
| 7 #include <iosfwd> | 7 #include <iosfwd> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 | 11 |
| 12 using std::ostream; | 12 using std::ostream; |
| 13 using std::string; | 13 using std::string; |
| 14 | 14 |
| 15 namespace syncable { | 15 namespace syncable { |
| 16 const Id kNullId; // Currently == root. | 16 const Id kNullId; // Currently == root. |
| 17 | 17 |
| 18 ostream& operator<<(ostream& out, const Id& id) { | 18 ostream& operator<<(ostream& out, const Id& id) { |
| 19 out << id.s_; | 19 out << id.s_; |
| 20 return out; | 20 return out; |
| 21 } | 21 } |
| 22 | 22 |
| 23 StringValue* Id::ToValue() const { | 23 StringValue* Id::ToValue() const { |
| 24 return Value::CreateStringValue(s_); | 24 return base::StringValue::New(s_); |
| 25 } | 25 } |
| 26 | 26 |
| 27 string Id::GetServerId() const { | 27 string Id::GetServerId() const { |
| 28 // Currently root is the string "0". We need to decide on a true value. | 28 // Currently root is the string "0". We need to decide on a true value. |
| 29 // "" would be convenient here, as the IsRoot call would not be needed. | 29 // "" would be convenient here, as the IsRoot call would not be needed. |
| 30 if (IsRoot()) | 30 if (IsRoot()) |
| 31 return "0"; | 31 return "0"; |
| 32 return s_.substr(1); | 32 return s_.substr(1); |
| 33 } | 33 } |
| 34 | 34 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 // static | 67 // static |
| 68 Id Id::GetLeastIdForLexicographicComparison() { | 68 Id Id::GetLeastIdForLexicographicComparison() { |
| 69 Id id; | 69 Id id; |
| 70 id.s_.clear(); | 70 id.s_.clear(); |
| 71 return id; | 71 return id; |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace syncable | 74 } // namespace syncable |
| OLD | NEW |