Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: sync/engine/cryptographer_provider.h

Issue 452283003: sync: Finish non-blocking type encryption support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cryptographer testing Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/BUILD.gn ('k') | sync/engine/cryptographer_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_CRYPTOGRAPHER_PROVIDER_H_
6 #define SYNC_ENGINE_CRYPTOGRAPHER_PROVIDER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "sync/base/sync_export.h"
10
11 namespace syncer {
12
13 class Cryptographer;
14 class ScopedCryptographerRef;
15 class ScopedCryptographerInternal;
16
17 // An interface for providing clients with a ScopedCryptographerRef.
18 //
19 // Used to expose the syncable::Directory's cryptographer to clients that
20 // would otherwise not have access to the Directory.
21 class SYNC_EXPORT_PRIVATE CryptographerProvider {
22 public:
23 CryptographerProvider();
24 virtual ~CryptographerProvider();
25
26 virtual bool InitScopedCryptographerRef(ScopedCryptographerRef* scoped) = 0;
27 };
28
29 // A concrete class representing a reference to a cryptographer.
30 //
31 // Access to the cryptographer is lost when this class goes out of scope.
32 class SYNC_EXPORT_PRIVATE ScopedCryptographerRef {
33 public:
34 ScopedCryptographerRef();
35 ~ScopedCryptographerRef();
36
37 bool Initialize(ScopedCryptographerInternal* impl);
38 bool IsValid() const;
39 Cryptographer* Get() const;
40
41 private:
42 scoped_ptr<ScopedCryptographerInternal> scoped_cryptographer_internal_;
43
44 DISALLOW_COPY_AND_ASSIGN(ScopedCryptographerRef);
45 };
46
47 // An interface class used in the implementation of the ScopedCryptographerRef.
48 //
49 // We use this class to allow different implementations of
50 // CryptographerProvider to implement InitScopedCryptographer in different
51 // ways. The ScopedCryptographerRef itself must be stack-allocated, so it
52 // can't vary depending on which kind of CryptographerProvider is used to
53 // intialize it.
54 class SYNC_EXPORT_PRIVATE ScopedCryptographerInternal {
55 public:
56 ScopedCryptographerInternal();
57 virtual ~ScopedCryptographerInternal();
58
59 virtual Cryptographer* Get() const = 0;
60 };
61
62 } // namespace syncer
63
64 #endif // SYNC_ENGINE_CRYPTOGRAPHER_PROVIDER_H_
OLDNEW
« no previous file with comments | « sync/BUILD.gn ('k') | sync/engine/cryptographer_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698