hash_util.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SYNC_BASE_HASH_UTIL_H_
  5. #define COMPONENTS_SYNC_BASE_HASH_UTIL_H_
  6. #include <string>
  7. namespace sync_pb {
  8. class AutofillOfferSpecifics;
  9. class AutofillWalletSpecifics;
  10. } // namespace sync_pb
  11. // TODO(crbug.com/881289): Rename this file to model_type_util.h or something
  12. // else that better reflects GetUnhashedClientTagFromAutofillWalletSpecifics()
  13. // has nothing to do with hashes.
  14. namespace syncer {
  15. // A helper for generating the bookmark type's tag. This is required in more
  16. // than one place, so we define the algorithm here to make sure the
  17. // implementation is consistent.
  18. std::string GenerateSyncableBookmarkHash(
  19. const std::string& originator_cache_guid,
  20. const std::string& originator_client_item_id);
  21. // A helper for extracting client tag out of the specifics for wallet data (as
  22. // client tags don't get populated by the server). This is required in more than
  23. // one place, so we define the algorithm here to make sure the implementation is
  24. // consistent.
  25. std::string GetUnhashedClientTagFromAutofillWalletSpecifics(
  26. const sync_pb::AutofillWalletSpecifics& specifics);
  27. // Helper function to extract client tag from the specifics. For offer data,
  28. // every time it is synced, it will be a full sync and this client tag is not
  29. // populated by server.
  30. std::string GetUnhashedClientTagFromAutofillOfferSpecifics(
  31. const sync_pb::AutofillOfferSpecifics& specifics);
  32. } // namespace syncer
  33. #endif // COMPONENTS_SYNC_BASE_HASH_UTIL_H_