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 #include "sync/engine/directory_cryptographer_provider.h" | |
6 | |
7 #include "sync/syncable/directory.h" | |
8 #include "sync/syncable/syncable_read_transaction.h" | |
9 | |
10 namespace syncer { | |
11 | |
12 DirectoryCryptographerProvider::DirectoryCryptographerProvider( | |
13 syncable::Directory* dir) | |
14 : dir_(dir) { | |
15 } | |
16 | |
17 DirectoryCryptographerProvider::~DirectoryCryptographerProvider() { | |
18 } | |
19 | |
20 bool DirectoryCryptographerProvider::InitScopedCryptographerRef( | |
21 ScopedCryptographerRef* scoped) { | |
22 scoped->Initialize(new ScopedDirectoryCryptographerInternal(dir_)); | |
23 return scoped->IsValid(); | |
24 } | |
25 | |
26 ScopedDirectoryCryptographerInternal::ScopedDirectoryCryptographerInternal( | |
27 syncable::Directory* dir) | |
28 : dir_(dir), trans_(FROM_HERE, dir) { | |
29 } | |
30 | |
31 ScopedDirectoryCryptographerInternal::~ScopedDirectoryCryptographerInternal() { | |
32 } | |
33 | |
34 Cryptographer* ScopedDirectoryCryptographerInternal::Get() const { | |
35 return dir_->GetCryptographer(&trans_); | |
36 } | |
37 | |
38 } // namespace syncer | |
OLD | NEW |