| 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 #ifndef SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 virtual ModelSafeGroup GetModelSafeGroup() = 0; | 57 virtual ModelSafeGroup GetModelSafeGroup() = 0; |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 virtual ~ModelSafeWorker(); | 60 virtual ~ModelSafeWorker(); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 friend class base::RefCountedThreadSafe<ModelSafeWorker>; | 63 friend class base::RefCountedThreadSafe<ModelSafeWorker>; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // A map that details which ModelSafeGroup each syncer::ModelType | 66 // A map that details which ModelSafeGroup each ModelType |
| 67 // belongs to. Routing info can change in response to the user enabling / | 67 // belongs to. Routing info can change in response to the user enabling / |
| 68 // disabling sync for certain types, as well as model association completions. | 68 // disabling sync for certain types, as well as model association completions. |
| 69 typedef std::map<syncer::ModelType, ModelSafeGroup> | 69 typedef std::map<ModelType, ModelSafeGroup> ModelSafeRoutingInfo; |
| 70 ModelSafeRoutingInfo; | |
| 71 | 70 |
| 72 // Caller takes ownership of return value. | 71 // Caller takes ownership of return value. |
| 73 base::DictionaryValue* ModelSafeRoutingInfoToValue( | 72 base::DictionaryValue* ModelSafeRoutingInfoToValue( |
| 74 const ModelSafeRoutingInfo& routing_info); | 73 const ModelSafeRoutingInfo& routing_info); |
| 75 | 74 |
| 76 std::string ModelSafeRoutingInfoToString( | 75 std::string ModelSafeRoutingInfoToString( |
| 77 const ModelSafeRoutingInfo& routing_info); | 76 const ModelSafeRoutingInfo& routing_info); |
| 78 | 77 |
| 79 // Make a ModelTypePayloadMap for all the enabled types in a | 78 // Make a ModelTypePayloadMap for all the enabled types in a |
| 80 // ModelSafeRoutingInfo using a default payload. | 79 // ModelSafeRoutingInfo using a default payload. |
| 81 syncer::ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( | 80 ModelTypePayloadMap ModelSafeRoutingInfoToPayloadMap( |
| 82 const ModelSafeRoutingInfo& routes, | 81 const ModelSafeRoutingInfo& routes, |
| 83 const std::string& payload); | 82 const std::string& payload); |
| 84 | 83 |
| 85 syncer::ModelTypeSet GetRoutingInfoTypes( | 84 ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info); |
| 86 const ModelSafeRoutingInfo& routing_info); | |
| 87 | 85 |
| 88 ModelSafeGroup GetGroupForModelType(const syncer::ModelType type, | 86 ModelSafeGroup GetGroupForModelType(const ModelType type, |
| 89 const ModelSafeRoutingInfo& routes); | 87 const ModelSafeRoutingInfo& routes); |
| 90 | 88 |
| 91 } // namespace syncer | 89 } // namespace syncer |
| 92 | 90 |
| 93 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ | 91 #endif // SYNC_INTERNAL_API_PUBLIC_ENGINE_MODEL_SAFE_WORKER_H_ |
| OLD | NEW |