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 InitScopedCryptographerRef( |
| 26 ScopedCryptographerRef* scoped) OVERRIDE; |
| 27 |
| 28 private: |
| 29 syncable::Directory* dir_; |
| 30 }; |
| 31 |
| 32 // An implementation detail of the DirectoryCryptographerProvider. Contains |
| 33 // the ReadTransaction used to safely access the Cryptographer. |
| 34 class ScopedDirectoryCryptographerInternal |
| 35 : public ScopedCryptographerInternal { |
| 36 public: |
| 37 ScopedDirectoryCryptographerInternal(syncable::Directory* dir); |
| 38 virtual ~ScopedDirectoryCryptographerInternal(); |
| 39 |
| 40 virtual Cryptographer* Get() const OVERRIDE; |
| 41 |
| 42 private: |
| 43 syncable::Directory* dir_; |
| 44 syncable::ReadTransaction trans_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(ScopedDirectoryCryptographerInternal); |
| 47 }; |
| 48 |
| 49 } // namespace syncer |
| 50 |
| 51 #endif // SYNC_ENGINE_DIRECTORY_CRYPTOGRAPHER_PROVIDER_H_ |
OLD | NEW |