| 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/engine/model_safe_worker.h" | 5 #include "chrome/browser/sync/engine/model_safe_worker.h" |
| 6 #include "chrome/browser/sync/util/unrecoverable_error_info.h" | 6 #include "chrome/browser/sync/util/unrecoverable_error_info.h" |
| 7 | 7 |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 std::string ModelSafeRoutingInfoToString( | 25 std::string ModelSafeRoutingInfoToString( |
| 26 const ModelSafeRoutingInfo& routing_info) { | 26 const ModelSafeRoutingInfo& routing_info) { |
| 27 scoped_ptr<DictionaryValue> dict(ModelSafeRoutingInfoToValue(routing_info)); | 27 scoped_ptr<DictionaryValue> dict(ModelSafeRoutingInfoToValue(routing_info)); |
| 28 std::string json; | 28 std::string json; |
| 29 base::JSONWriter::Write(dict.get(), false, &json); | 29 base::JSONWriter::Write(dict.get(), false, &json); |
| 30 return json; | 30 return json; |
| 31 } | 31 } |
| 32 | 32 |
| 33 syncable::ModelEnumSet GetRoutingInfoTypes( | 33 syncable::ModelTypeSet GetRoutingInfoTypes( |
| 34 const ModelSafeRoutingInfo& routing_info) { | 34 const ModelSafeRoutingInfo& routing_info) { |
| 35 syncable::ModelEnumSet types; | 35 syncable::ModelTypeSet types; |
| 36 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); | 36 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); |
| 37 it != routing_info.end(); ++it) { | 37 it != routing_info.end(); ++it) { |
| 38 types.Put(it->first); | 38 types.Put(it->first); |
| 39 } | 39 } |
| 40 return types; | 40 return types; |
| 41 } | 41 } |
| 42 | 42 |
| 43 ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, | 43 ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, |
| 44 const ModelSafeRoutingInfo& routes) { | 44 const ModelSafeRoutingInfo& routes) { |
| 45 ModelSafeRoutingInfo::const_iterator it = routes.find(type); | 45 ModelSafeRoutingInfo::const_iterator it = routes.find(type); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 67 return "GROUP_PASSWORD"; | 67 return "GROUP_PASSWORD"; |
| 68 default: | 68 default: |
| 69 NOTREACHED(); | 69 NOTREACHED(); |
| 70 return "INVALID"; | 70 return "INVALID"; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 ModelSafeWorker::~ModelSafeWorker() {} | 74 ModelSafeWorker::~ModelSafeWorker() {} |
| 75 | 75 |
| 76 } // namespace browser_sync | 76 } // namespace browser_sync |
| OLD | NEW |