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

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

Issue 413833002: sync: Introduce CryptographerProvider interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/ScopedCryptographer/ScopedCryptographerRef/ Created 6 years, 5 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
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 ScopedCryptographerImpl;
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 cryptographer.
Nicolas Zea 2014/07/25 20:03:30 nit: perhaps "representing a cryptographer" should
rlarocque 2014/07/25 20:18:17 Done.
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(ScopedCryptographerImpl* impl);
38 bool IsValid() const;
39 Cryptographer* Get() const;
40
41 private:
42 scoped_ptr<ScopedCryptographerImpl> scoped_cryptographer_impl_;
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 ScopedCryptographerImpl {
Nicolas Zea 2014/07/25 20:03:30 nit: this is the actual getter, not so much an imp
rlarocque 2014/07/25 20:18:17 Maybe Impl isn't the right suffix, given how we te
55 public:
56 ScopedCryptographerImpl();
57 virtual ~ScopedCryptographerImpl();
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 | « no previous file | sync/engine/cryptographer_provider.cc » ('j') | sync/engine/directory_cryptographer_provider.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698