nigori_storage_impl.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2019 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_NIGORI_NIGORI_STORAGE_IMPL_H_
  5. #define COMPONENTS_SYNC_NIGORI_NIGORI_STORAGE_IMPL_H_
  6. #include "base/files/file_path.h"
  7. #include "base/sequence_checker.h"
  8. #include "components/sync/nigori/nigori_storage.h"
  9. namespace syncer {
  10. class NigoriStorageImpl : public NigoriStorage {
  11. public:
  12. // |encryptor| must be not null and must outlive this object.
  13. explicit NigoriStorageImpl(const base::FilePath& path);
  14. NigoriStorageImpl(const NigoriStorageImpl&) = delete;
  15. NigoriStorageImpl& operator=(const NigoriStorageImpl&) = delete;
  16. ~NigoriStorageImpl() override;
  17. // NigoriStorage implementation.
  18. // Encrypts |data| and atomically stores it in binary file.
  19. void StoreData(const sync_pb::NigoriLocalData& data) override;
  20. absl::optional<sync_pb::NigoriLocalData> RestoreData() override;
  21. void ClearData() override;
  22. private:
  23. base::FilePath path_;
  24. SEQUENCE_CHECKER(sequence_checker_);
  25. };
  26. } // namespace syncer
  27. #endif // COMPONENTS_SYNC_NIGORI_NIGORI_STORAGE_IMPL_H_