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 #include "sync/syncable/syncable_util.h" | 5 #include "sync/syncable/syncable_util.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 ModelType model_type, const std::string& client_tag) { | 94 ModelType model_type, const std::string& client_tag) { |
95 // Blank PB with just the field in it has termination symbol, | 95 // Blank PB with just the field in it has termination symbol, |
96 // handy for delimiter. | 96 // handy for delimiter. |
97 sync_pb::EntitySpecifics serialized_type; | 97 sync_pb::EntitySpecifics serialized_type; |
98 AddDefaultFieldValue(model_type, &serialized_type); | 98 AddDefaultFieldValue(model_type, &serialized_type); |
99 std::string hash_input; | 99 std::string hash_input; |
100 serialized_type.AppendToString(&hash_input); | 100 serialized_type.AppendToString(&hash_input); |
101 hash_input.append(client_tag); | 101 hash_input.append(client_tag); |
102 | 102 |
103 std::string encode_output; | 103 std::string encode_output; |
104 CHECK(base::Base64Encode(base::SHA1HashString(hash_input), &encode_output)); | 104 base::Base64Encode(base::SHA1HashString(hash_input), &encode_output); |
105 return encode_output; | 105 return encode_output; |
106 } | 106 } |
107 | 107 |
108 std::string GenerateSyncableBookmarkHash( | 108 std::string GenerateSyncableBookmarkHash( |
109 const std::string& originator_cache_guid, | 109 const std::string& originator_cache_guid, |
110 const std::string& originator_client_item_id) { | 110 const std::string& originator_client_item_id) { |
111 return syncable::GenerateSyncableHash( | 111 return syncable::GenerateSyncableHash( |
112 BOOKMARKS, originator_cache_guid + originator_client_item_id); | 112 BOOKMARKS, originator_cache_guid + originator_client_item_id); |
113 } | 113 } |
114 | 114 |
115 } // namespace syncable | 115 } // namespace syncable |
116 } // namespace syncer | 116 } // namespace syncer |
OLD | NEW |