OLD | NEW |
| (Empty) |
1 // Copyright 2012 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_SYNCABLE_NIGORI_HANDLER_H_ | |
6 #define SYNC_SYNCABLE_NIGORI_HANDLER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "sync/base/sync_export.h" | |
11 #include "sync/internal_api/public/base/model_type.h" | |
12 | |
13 namespace google { | |
14 namespace protobuf { | |
15 template <typename T> | |
16 class RepeatedPtrField; | |
17 } | |
18 } | |
19 | |
20 namespace sync_pb { | |
21 class NigoriSpecifics; | |
22 } | |
23 | |
24 namespace syncer { | |
25 namespace syncable { | |
26 | |
27 class BaseTransaction; | |
28 | |
29 // Sync internal interface for dealing with nigori node and querying | |
30 // the current set of encrypted types. Not thread safe, so a sync transaction | |
31 // must be held by a caller whenever invoking methods. | |
32 class SYNC_EXPORT NigoriHandler { | |
33 public: | |
34 NigoriHandler(); | |
35 virtual ~NigoriHandler(); | |
36 | |
37 // Apply a nigori node update, updating the internal encryption state | |
38 // accordingly. | |
39 virtual void ApplyNigoriUpdate( | |
40 const sync_pb::NigoriSpecifics& nigori, | |
41 syncable::BaseTransaction* const trans) = 0; | |
42 | |
43 // Store the current encrypt everything/encrypted types state into |nigori|. | |
44 virtual void UpdateNigoriFromEncryptedTypes( | |
45 sync_pb::NigoriSpecifics* nigori, | |
46 syncable::BaseTransaction* const trans) const = 0; | |
47 | |
48 // Whether a keystore key needs to be requested from the sync server. | |
49 virtual bool NeedKeystoreKey( | |
50 syncable::BaseTransaction* const trans) const = 0; | |
51 | |
52 // Set the keystore keys the server returned for this account. | |
53 // Returns true on success, false otherwise. | |
54 virtual bool SetKeystoreKeys( | |
55 const google::protobuf::RepeatedPtrField<std::string>& keys, | |
56 syncable::BaseTransaction* const trans) = 0; | |
57 | |
58 // Returns the set of currently encrypted types. | |
59 virtual ModelTypeSet GetEncryptedTypes( | |
60 syncable::BaseTransaction* const trans) const = 0; | |
61 }; | |
62 | |
63 } // namespace syncable | |
64 } // namespace syncer | |
65 | |
66 #endif // SYNC_SYNCABLE_NIGORI_HANDLER_H_ | |
OLD | NEW |