| 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 // Various utilities for dealing with invalidation data types. | 5 // Various utilities for dealing with invalidation data types. |
| 6 | 6 |
| 7 #ifndef SYNC_NOTIFIER_INVALIDATION_UTIL_H_ | 7 #ifndef SYNC_NOTIFIER_INVALIDATION_UTIL_H_ |
| 8 #define SYNC_NOTIFIER_INVALIDATION_UTIL_H_ | 8 #define SYNC_NOTIFIER_INVALIDATION_UTIL_H_ |
| 9 | 9 |
| 10 #include <iosfwd> | 10 #include <iosfwd> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "sync/base/sync_export.h" | 15 #include "sync/base/sync_export.h" |
| 16 #include "sync/internal_api/public/base/model_type.h" | 16 #include "sync/internal_api/public/base/model_type.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class DictionaryValue; | 19 class DictionaryValue; |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 namespace invalidation { | 22 namespace invalidation { |
| 23 | 23 |
| 24 class Invalidation; | 24 class Invalidation; |
| 25 class ObjectId; | 25 class ObjectId; |
| 26 | 26 |
| 27 // Gmock print helper | 27 // Gmock print helper |
| 28 void PrintTo(const invalidation::ObjectId& id, std::ostream* os); | 28 SYNC_EXPORT_PRIVATE void PrintTo(const invalidation::ObjectId& id, |
| 29 std::ostream* os); |
| 29 | 30 |
| 30 } // namespace invalidation | 31 } // namespace invalidation |
| 31 | 32 |
| 32 namespace syncer { | 33 namespace syncer { |
| 33 | 34 |
| 34 struct SYNC_EXPORT ObjectIdLessThan { | 35 struct SYNC_EXPORT ObjectIdLessThan { |
| 35 bool operator()(const invalidation::ObjectId& lhs, | 36 bool operator()(const invalidation::ObjectId& lhs, |
| 36 const invalidation::ObjectId& rhs) const; | 37 const invalidation::ObjectId& rhs) const; |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; | 40 typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet; |
| 40 | 41 |
| 41 SYNC_EXPORT bool RealModelTypeToObjectId(ModelType model_type, | 42 SYNC_EXPORT bool RealModelTypeToObjectId(ModelType model_type, |
| 42 invalidation::ObjectId* object_id); | 43 invalidation::ObjectId* object_id); |
| 43 | 44 |
| 44 bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, | 45 bool ObjectIdToRealModelType(const invalidation::ObjectId& object_id, |
| 45 ModelType* model_type); | 46 ModelType* model_type); |
| 46 | 47 |
| 47 // Caller owns the returned DictionaryValue. | 48 // Caller owns the returned DictionaryValue. |
| 48 scoped_ptr<base::DictionaryValue> ObjectIdToValue( | 49 scoped_ptr<base::DictionaryValue> ObjectIdToValue( |
| 49 const invalidation::ObjectId& object_id); | 50 const invalidation::ObjectId& object_id); |
| 50 | 51 |
| 51 bool ObjectIdFromValue(const base::DictionaryValue& value, | 52 bool ObjectIdFromValue(const base::DictionaryValue& value, |
| 52 invalidation::ObjectId* out); | 53 invalidation::ObjectId* out); |
| 53 | 54 |
| 54 std::string ObjectIdToString(const invalidation::ObjectId& object_id); | 55 SYNC_EXPORT_PRIVATE std::string ObjectIdToString( |
| 56 const invalidation::ObjectId& object_id); |
| 55 | 57 |
| 56 SYNC_EXPORT_PRIVATE ObjectIdSet ModelTypeSetToObjectIdSet(ModelTypeSet models); | 58 SYNC_EXPORT_PRIVATE ObjectIdSet ModelTypeSetToObjectIdSet(ModelTypeSet models); |
| 57 ModelTypeSet ObjectIdSetToModelTypeSet(const ObjectIdSet& ids); | 59 ModelTypeSet ObjectIdSetToModelTypeSet(const ObjectIdSet& ids); |
| 58 | 60 |
| 59 std::string InvalidationToString( | 61 std::string InvalidationToString( |
| 60 const invalidation::Invalidation& invalidation); | 62 const invalidation::Invalidation& invalidation); |
| 61 | 63 |
| 62 } // namespace syncer | 64 } // namespace syncer |
| 63 | 65 |
| 64 #endif // SYNC_NOTIFIER_INVALIDATION_UTIL_H_ | 66 #endif // SYNC_NOTIFIER_INVALIDATION_UTIL_H_ |
| OLD | NEW |