| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 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 |
| 5 #ifndef SYNC_ENGINE_DIRECTORY_CRYPTOGRAPHER_PROVIDER_H_ |
| 6 #define SYNC_ENGINE_DIRECTORY_CRYPTOGRAPHER_PROVIDER_H_ |
| 7 |
| 8 #include "sync/engine/cryptographer_provider.h" |
| 9 |
| 10 #include "sync/syncable/syncable_read_transaction.h" |
| 11 |
| 12 namespace syncer { |
| 13 |
| 14 namespace syncable { |
| 15 class Directory; |
| 16 } |
| 17 |
| 18 // Provides access to the Directory's cryptographer through the |
| 19 // CryptographerProvider interface. |
| 20 class DirectoryCryptographerProvider : public CryptographerProvider { |
| 21 public: |
| 22 DirectoryCryptographerProvider(syncable::Directory* dir); |
| 23 virtual ~DirectoryCryptographerProvider(); |
| 24 |
| 25 virtual bool InitScopedCryptographer(ScopedCryptographer* scoped) OVERRIDE; |
| 26 |
| 27 private: |
| 28 syncable::Directory* dir_; |
| 29 }; |
| 30 |
| 31 // An implementation detail of the DirectoryCryptographerProvider. Contains |
| 32 // the ReadTransaction used to safely access the Cryptographer. |
| 33 class ScopedDirectoryCryptographerImpl : public ScopedCryptographerImpl { |
| 34 public: |
| 35 ScopedDirectoryCryptographerImpl(syncable::Directory* dir); |
| 36 virtual ~ScopedDirectoryCryptographerImpl(); |
| 37 |
| 38 virtual Cryptographer* Get() const OVERRIDE; |
| 39 |
| 40 private: |
| 41 syncable::Directory* dir_; |
| 42 syncable::ReadTransaction trans_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(ScopedDirectoryCryptographerImpl); |
| 45 }; |
| 46 |
| 47 } // namespace syncer |
| 48 |
| 49 #endif // SYNC_ENGINE_DIRECTORY_CRYPTOGRAPHER_PROVIDER_H_ |
| OLD | NEW |