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