| 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/engine/model_safe_worker.h" | 5 #include "sync/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 21 matching lines...) Expand all Loading... |
| 32 syncable::ModelTypeSet GetRoutingInfoTypes( | 32 syncable::ModelTypeSet GetRoutingInfoTypes( |
| 33 const ModelSafeRoutingInfo& routing_info) { | 33 const ModelSafeRoutingInfo& routing_info) { |
| 34 syncable::ModelTypeSet types; | 34 syncable::ModelTypeSet types; |
| 35 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); | 35 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); |
| 36 it != routing_info.end(); ++it) { | 36 it != routing_info.end(); ++it) { |
| 37 types.Put(it->first); | 37 types.Put(it->first); |
| 38 } | 38 } |
| 39 return types; | 39 return types; |
| 40 } | 40 } |
| 41 | 41 |
| 42 syncable::FullModelTypeSet GetModelTypesForGroup( |
| 43 ModelSafeGroup group, |
| 44 const ModelSafeRoutingInfo& routing_info) { |
| 45 syncable::FullModelTypeSet result; |
| 46 for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); |
| 47 it != routing_info.end(); ++it) { |
| 48 if (it->second == group) |
| 49 result.Put(it->first); |
| 50 } |
| 51 return result; |
| 52 } |
| 53 |
| 42 ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, | 54 ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, |
| 43 const ModelSafeRoutingInfo& routes) { | 55 const ModelSafeRoutingInfo& routes) { |
| 44 ModelSafeRoutingInfo::const_iterator it = routes.find(type); | 56 ModelSafeRoutingInfo::const_iterator it = routes.find(type); |
| 45 if (it == routes.end()) { | 57 if (it == routes.end()) { |
| 46 if (type != syncable::UNSPECIFIED && type != syncable::TOP_LEVEL_FOLDER) | 58 if (type != syncable::UNSPECIFIED && type != syncable::TOP_LEVEL_FOLDER) |
| 47 LOG(WARNING) << "Entry does not belong to active ModelSafeGroup!"; | 59 LOG(WARNING) << "Entry does not belong to active ModelSafeGroup!"; |
| 48 return GROUP_PASSIVE; | 60 return GROUP_PASSIVE; |
| 49 } | 61 } |
| 50 return it->second; | 62 return it->second; |
| 51 } | 63 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 66 return "GROUP_PASSWORD"; | 78 return "GROUP_PASSWORD"; |
| 67 default: | 79 default: |
| 68 NOTREACHED(); | 80 NOTREACHED(); |
| 69 return "INVALID"; | 81 return "INVALID"; |
| 70 } | 82 } |
| 71 } | 83 } |
| 72 | 84 |
| 73 ModelSafeWorker::~ModelSafeWorker() {} | 85 ModelSafeWorker::~ModelSafeWorker() {} |
| 74 | 86 |
| 75 } // namespace browser_sync | 87 } // namespace browser_sync |
| OLD | NEW |