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_SYNCABLE_SYNCABLE_UTIL_H_ | 5 #ifndef SYNC_SYNCABLE_SYNCABLE_UTIL_H_ |
6 #define SYNC_SYNCABLE_SYNCABLE_UTIL_H_ | 6 #define SYNC_SYNCABLE_SYNCABLE_UTIL_H_ |
7 | 7 |
| 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "sync/internal_api/public/base/model_type.h" |
11 | 13 |
12 namespace tracked_objects { | 14 namespace tracked_objects { |
13 class Location; | 15 class Location; |
14 } | 16 } |
15 | 17 |
16 namespace syncer { | 18 namespace syncer { |
17 namespace syncable { | 19 namespace syncable { |
18 | 20 |
19 class BaseTransaction; | 21 class BaseTransaction; |
20 class WriteTransaction; | 22 class WriteTransaction; |
21 class MutableEntry; | 23 class MutableEntry; |
22 class Id; | 24 class Id; |
23 | 25 |
24 void ChangeEntryIDAndUpdateChildren(WriteTransaction* trans, | 26 void ChangeEntryIDAndUpdateChildren(WriteTransaction* trans, |
25 MutableEntry* entry, | 27 MutableEntry* entry, |
26 const Id& new_id); | 28 const Id& new_id); |
27 | 29 |
28 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid); | 30 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid); |
29 | 31 |
30 bool SyncAssert(bool condition, | 32 bool SyncAssert(bool condition, |
31 const tracked_objects::Location& location, | 33 const tracked_objects::Location& location, |
32 const char* msg, | 34 const char* msg, |
33 BaseTransaction* trans); | 35 BaseTransaction* trans); |
34 | 36 |
35 int GetUnsyncedEntries(BaseTransaction* trans, | 37 int GetUnsyncedEntries(BaseTransaction* trans, |
36 std::vector<int64> *handles); | 38 std::vector<int64> *handles); |
37 | 39 |
| 40 // Generates a fixed-length tag for the given string under the given model_type. |
| 41 std::string GenerateSyncableHash( |
| 42 ModelType model_type, 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 |
38 } // namespace syncable | 51 } // namespace syncable |
39 } // namespace syncer | 52 } // namespace syncer |
40 | 53 |
41 #endif // SYNC_SYNCABLE_SYNCABLE_UTIL_H_ | 54 #endif // SYNC_SYNCABLE_SYNCABLE_UTIL_H_ |
OLD | NEW |