| 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/engine/model_safe_worker.h" | 5 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 std::string ModelSafeRoutingInfoToString( | 24 std::string ModelSafeRoutingInfoToString( |
| 25 const ModelSafeRoutingInfo& routing_info) { | 25 const ModelSafeRoutingInfo& routing_info) { |
| 26 scoped_ptr<DictionaryValue> dict(ModelSafeRoutingInfoToValue(routing_info)); | 26 scoped_ptr<DictionaryValue> dict(ModelSafeRoutingInfoToValue(routing_info)); |
| 27 std::string json; | 27 std::string json; |
| 28 base::JSONWriter::Write(dict.get(), &json); | 28 base::JSONWriter::Write(dict.get(), &json); |
| 29 return json; | 29 return json; |
| 30 } | 30 } |
| 31 | 31 |
| 32 ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( | 32 ModelTypeStateMap ModelSafeRoutingInfoToStateMap( |
| 33 const ModelSafeRoutingInfo& routes, | 33 const ModelSafeRoutingInfo& routes, |
| 34 const std::string& payload) { | 34 const std::string& payload) { |
| 35 ModelTypePayloadMap types_with_payloads; | 35 ModelTypeStateMap type_state_map; |
| 36 for (ModelSafeRoutingInfo::const_iterator i = routes.begin(); | 36 for (ModelSafeRoutingInfo::const_iterator i = routes.begin(); |
| 37 i != routes.end(); ++i) { | 37 i != routes.end(); ++i) { |
| 38 types_with_payloads[i->first] = payload; | 38 type_state_map[i->first].payload = payload; |
| 39 } | 39 } |
| 40 return types_with_payloads; | 40 return type_state_map; |
| 41 } | 41 } |
| 42 | 42 |
| 43 ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info) { | 43 ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info) { |
| 44 ModelTypeSet types; | 44 ModelTypeSet types; |
| 45 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); | 45 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); |
| 46 it != routing_info.end(); ++it) { | 46 it != routing_info.end(); ++it) { |
| 47 types.Put(it->first); | 47 types.Put(it->first); |
| 48 } | 48 } |
| 49 return types; | 49 return types; |
| 50 } | 50 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 76 return "GROUP_PASSWORD"; | 76 return "GROUP_PASSWORD"; |
| 77 default: | 77 default: |
| 78 NOTREACHED(); | 78 NOTREACHED(); |
| 79 return "INVALID"; | 79 return "INVALID"; |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 ModelSafeWorker::~ModelSafeWorker() {} | 83 ModelSafeWorker::~ModelSafeWorker() {} |
| 84 | 84 |
| 85 } // namespace syncer | 85 } // namespace syncer |
| OLD | NEW |