Chromium Code Reviews| Index: sync/engine/directory_cryptographer_provider.cc |
| diff --git a/sync/engine/directory_cryptographer_provider.cc b/sync/engine/directory_cryptographer_provider.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..94f5fd867625baf71d76c276624562f81fcdfd40 |
| --- /dev/null |
| +++ b/sync/engine/directory_cryptographer_provider.cc |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "sync/engine/directory_cryptographer_provider.h" |
| + |
| +#include "sync/syncable/directory.h" |
| +#include "sync/syncable/syncable_read_transaction.h" |
| + |
| +namespace syncer { |
| + |
| +DirectoryCryptographerProvider::DirectoryCryptographerProvider( |
| + syncable::Directory* dir) |
| + : dir_(dir) { |
| +} |
| + |
| +DirectoryCryptographerProvider::~DirectoryCryptographerProvider() { |
| +} |
| + |
| +bool DirectoryCryptographerProvider::InitScopedCryptographer( |
| + ScopedCryptographer* scoped) { |
| + scoped->Initialize(new ScopedDirectoryCryptographerImpl(dir_)); |
| + return scoped->IsValid(); |
| +} |
| + |
| +ScopedDirectoryCryptographerImpl::ScopedDirectoryCryptographerImpl( |
| + syncable::Directory* dir) |
| + : dir_(dir), trans_(FROM_HERE, dir) { |
| +} |
| + |
| +ScopedDirectoryCryptographerImpl::~ScopedDirectoryCryptographerImpl() { |
| +} |
| + |
| +Cryptographer* ScopedDirectoryCryptographerImpl::Get() const { |
| + return dir_->GetCryptographer(&trans_); |
| +} |
| +}; |
|
Nicolas Zea
2014/07/24 22:16:42
here too
rlarocque
2014/07/24 22:23:13
Done.
|