entity_change.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2015 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. #include "components/sync/model/entity_change.h"
  5. #include <utility>
  6. #include "base/memory/ptr_util.h"
  7. namespace syncer {
  8. // static
  9. std::unique_ptr<EntityChange> EntityChange::CreateAdd(
  10. const std::string& storage_key,
  11. EntityData data) {
  12. return base::WrapUnique(
  13. new EntityChange(storage_key, ACTION_ADD, std::move(data)));
  14. }
  15. // static
  16. std::unique_ptr<EntityChange> EntityChange::CreateUpdate(
  17. const std::string& storage_key,
  18. EntityData data) {
  19. return base::WrapUnique(
  20. new EntityChange(storage_key, ACTION_UPDATE, std::move(data)));
  21. }
  22. // static
  23. std::unique_ptr<EntityChange> EntityChange::CreateDelete(
  24. const std::string& storage_key) {
  25. return base::WrapUnique(
  26. new EntityChange(storage_key, ACTION_DELETE, EntityData()));
  27. }
  28. EntityChange::EntityChange(const std::string& storage_key,
  29. ChangeType type,
  30. EntityData data)
  31. : storage_key_(storage_key), type_(type), data_(std::move(data)) {}
  32. EntityChange::~EntityChange() = default;
  33. } // namespace syncer