| 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_SYNCABLE_SYNCABLE_UTIL_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ |
| 6 #define COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | |
| 11 #include <vector> | 10 #include <vector> |
| 12 | 11 |
| 13 #include "components/sync/base/model_type.h" | |
| 14 | |
| 15 namespace tracked_objects { | 12 namespace tracked_objects { |
| 16 class Location; | 13 class Location; |
| 17 } | 14 } |
| 18 | 15 |
| 19 namespace syncer { | 16 namespace syncer { |
| 20 namespace syncable { | 17 namespace syncable { |
| 21 | 18 |
| 22 class BaseTransaction; | 19 class BaseTransaction; |
| 23 class BaseWriteTransaction; | 20 class BaseWriteTransaction; |
| 24 class ModelNeutralMutableEntry; | 21 class ModelNeutralMutableEntry; |
| 25 class Id; | 22 class Id; |
| 26 | 23 |
| 27 void ChangeEntryIDAndUpdateChildren(BaseWriteTransaction* trans, | 24 void ChangeEntryIDAndUpdateChildren(BaseWriteTransaction* trans, |
| 28 ModelNeutralMutableEntry* entry, | 25 ModelNeutralMutableEntry* entry, |
| 29 const Id& new_id); | 26 const Id& new_id); |
| 30 | 27 |
| 31 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid); | 28 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid); |
| 32 | 29 |
| 33 bool SyncAssert(bool condition, | 30 bool SyncAssert(bool condition, |
| 34 const tracked_objects::Location& location, | 31 const tracked_objects::Location& location, |
| 35 const char* msg, | 32 const char* msg, |
| 36 BaseTransaction* trans); | 33 BaseTransaction* trans); |
| 37 | 34 |
| 38 int GetUnsyncedEntries(BaseTransaction* trans, std::vector<int64_t>* handles); | 35 int GetUnsyncedEntries(BaseTransaction* trans, std::vector<int64_t>* handles); |
| 39 | 36 |
| 40 // Generates a fixed-length tag for the given string under the given model_type. | |
| 41 std::string GenerateSyncableHash(ModelType model_type, | |
| 42 const std::string& client_tag); | |
| 43 | |
| 44 // A helper for generating the bookmark type's tag. This is required in more | |
| 45 // than one place, so we define the algorithm here to make sure the | |
| 46 // implementation is consistent. | |
| 47 std::string GenerateSyncableBookmarkHash( | |
| 48 const std::string& originator_cache_guid, | |
| 49 const std::string& originator_client_item_id); | |
| 50 | |
| 51 } // namespace syncable | 37 } // namespace syncable |
| 52 } // namespace syncer | 38 } // namespace syncer |
| 53 | 39 |
| 54 #endif // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ | 40 #endif // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ |
| OLD | NEW |