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/invalidation_util.h" | 5 #include "components/invalidation/invalidation_util.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 std::string name; | 54 std::string name; |
55 int source = 0; | 55 int source = 0; |
56 if (!value.GetInteger("source", &source) || !value.GetString("name", &name)) { | 56 if (!value.GetInteger("source", &source) || !value.GetString("name", &name)) { |
57 return false; | 57 return false; |
58 } | 58 } |
59 *out = invalidation::ObjectId(source, name); | 59 *out = invalidation::ObjectId(source, name); |
60 return true; | 60 return true; |
61 } | 61 } |
62 | 62 |
63 std::string ObjectIdToString(const invalidation::ObjectId& object_id) { | 63 std::string ObjectIdToString(const invalidation::ObjectId& object_id) { |
64 scoped_ptr<base::DictionaryValue> value(ObjectIdToValue(object_id)); | |
65 std::string str; | 64 std::string str; |
66 base::JSONWriter::Write(value.get(), &str); | 65 base::JSONWriter::Write(*ObjectIdToValue(object_id), &str); |
67 return str; | 66 return str; |
68 } | 67 } |
69 | 68 |
70 } // namespace syncer | 69 } // namespace syncer |
OLD | NEW |