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 #ifndef COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ | 5 #ifndef COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ |
6 #define COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ | 6 #define COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <ostream> | 10 #include <ostream> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "components/sync/base/enum_set.h" | 15 #include "components/sync/base/enum_set.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class ListValue; | 18 class ListValue; |
19 class Value; | 19 class Value; |
20 using StringValue = Value; | |
21 } | 20 } |
22 | 21 |
23 namespace sync_pb { | 22 namespace sync_pb { |
24 class EntitySpecifics; | 23 class EntitySpecifics; |
25 class SyncEntity; | 24 class SyncEntity; |
26 } | 25 } |
27 | 26 |
28 namespace syncer { | 27 namespace syncer { |
29 | 28 |
30 // Enumerate the various item subtypes that are supported by sync. | 29 // Enumerate the various item subtypes that are supported by sync. |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 const char* ModelTypeToString(ModelType model_type); | 278 const char* ModelTypeToString(ModelType model_type); |
280 | 279 |
281 // Some histograms take an integer parameter that represents a model type. | 280 // Some histograms take an integer parameter that represents a model type. |
282 // The mapping from ModelType to integer is defined here. It should match | 281 // The mapping from ModelType to integer is defined here. It should match |
283 // the mapping from integer to labels defined in histograms.xml. | 282 // the mapping from integer to labels defined in histograms.xml. |
284 int ModelTypeToHistogramInt(ModelType model_type); | 283 int ModelTypeToHistogramInt(ModelType model_type); |
285 | 284 |
286 // Handles all model types, and not just real ones. | 285 // Handles all model types, and not just real ones. |
287 // | 286 // |
288 // Caller takes ownership of returned value. | 287 // Caller takes ownership of returned value. |
289 base::StringValue* ModelTypeToValue(ModelType model_type); | 288 base::Value* ModelTypeToValue(ModelType model_type); |
290 | 289 |
291 // Converts a Value into a ModelType - complement to ModelTypeToValue(). | 290 // Converts a Value into a ModelType - complement to ModelTypeToValue(). |
292 ModelType ModelTypeFromValue(const base::Value& value); | 291 ModelType ModelTypeFromValue(const base::Value& value); |
293 | 292 |
294 // Returns the ModelType corresponding to the name |model_type_string|. | 293 // Returns the ModelType corresponding to the name |model_type_string|. |
295 ModelType ModelTypeFromString(const std::string& model_type_string); | 294 ModelType ModelTypeFromString(const std::string& model_type_string); |
296 | 295 |
297 // Returns the comma-separated string representation of |model_types|. | 296 // Returns the comma-separated string representation of |model_types|. |
298 std::string ModelTypeSetToString(ModelTypeSet model_types); | 297 std::string ModelTypeSetToString(ModelTypeSet model_types); |
299 | 298 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 349 |
351 // Returns true if |model_type| supports parent-child hierarchy or entries. | 350 // Returns true if |model_type| supports parent-child hierarchy or entries. |
352 bool TypeSupportsHierarchy(ModelType model_type); | 351 bool TypeSupportsHierarchy(ModelType model_type); |
353 | 352 |
354 // Returns true if |model_type| supports ordering of sibling entries. | 353 // Returns true if |model_type| supports ordering of sibling entries. |
355 bool TypeSupportsOrdering(ModelType model_type); | 354 bool TypeSupportsOrdering(ModelType model_type); |
356 | 355 |
357 } // namespace syncer | 356 } // namespace syncer |
358 | 357 |
359 #endif // COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ | 358 #endif // COMPONENTS_SYNC_BASE_MODEL_TYPE_H_ |
OLD | NEW |