OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Enumerate the various item subtypes that are supported by sync. | 5 // Enumerate the various item subtypes that are supported by sync. |
6 // Each sync object is expected to have an immutable object type. | 6 // Each sync object is expected to have an immutable object type. |
7 // An object's type is inferred from the type of data it holds. | 7 // An object's type is inferred from the type of data it holds. |
8 | 8 |
9 #ifndef COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ | 9 #ifndef COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ |
10 #define COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ | 10 #define COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // components/sync/driver/user_selectable_sync_type.h so that the UMA | 163 // components/sync/driver/user_selectable_sync_type.h so that the UMA |
164 // histograms for sync include your new type. In this case, be sure to also | 164 // histograms for sync include your new type. In this case, be sure to also |
165 // update the UserSelectableTypes() definition in | 165 // update the UserSelectableTypes() definition in |
166 // sync/syncable/model_type.cc. | 166 // sync/syncable/model_type.cc. |
167 MODEL_TYPE_COUNT, | 167 MODEL_TYPE_COUNT, |
168 }; | 168 }; |
169 | 169 |
170 typedef EnumSet<ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE> | 170 typedef EnumSet<ModelType, FIRST_REAL_MODEL_TYPE, LAST_REAL_MODEL_TYPE> |
171 ModelTypeSet; | 171 ModelTypeSet; |
172 typedef EnumSet<ModelType, UNSPECIFIED, LAST_REAL_MODEL_TYPE> FullModelTypeSet; | 172 typedef EnumSet<ModelType, UNSPECIFIED, LAST_REAL_MODEL_TYPE> FullModelTypeSet; |
173 typedef std::map<syncer::ModelType, const char*> ModelTypeNameMap; | 173 typedef std::map<ModelType, const char*> ModelTypeNameMap; |
174 | 174 |
175 inline ModelType ModelTypeFromInt(int i) { | 175 inline ModelType ModelTypeFromInt(int i) { |
176 DCHECK_GE(i, 0); | 176 DCHECK_GE(i, 0); |
177 DCHECK_LT(i, MODEL_TYPE_COUNT); | 177 DCHECK_LT(i, MODEL_TYPE_COUNT); |
178 return static_cast<ModelType>(i); | 178 return static_cast<ModelType>(i); |
179 } | 179 } |
180 | 180 |
181 // Used by tests outside of sync/. | 181 // Used by tests outside of sync/. |
182 void AddDefaultFieldValue(ModelType datatype, | 182 void AddDefaultFieldValue(ModelType datatype, |
183 sync_pb::EntitySpecifics* specifics); | 183 sync_pb::EntitySpecifics* specifics); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 351 |
352 // Returns true if |model_type| supports parent-child hierarchy or entries. | 352 // Returns true if |model_type| supports parent-child hierarchy or entries. |
353 bool TypeSupportsHierarchy(ModelType model_type); | 353 bool TypeSupportsHierarchy(ModelType model_type); |
354 | 354 |
355 // Returns true if |model_type| supports ordering of sibling entries. | 355 // Returns true if |model_type| supports ordering of sibling entries. |
356 bool TypeSupportsOrdering(ModelType model_type); | 356 bool TypeSupportsOrdering(ModelType model_type); |
357 | 357 |
358 } // namespace syncer | 358 } // namespace syncer |
359 | 359 |
360 #endif // COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ | 360 #endif // COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ |
OLD | NEW |