Roll src/third_party/WebKit 96fb88b:6bbd108 (svn 201045:201047)
[chromium-blink-merge.git] / sync / syncable / nigori_handler.h
blobd39ddf92a50ac6e278fd1a6fb346fa4c6766f484
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.
5 #ifndef SYNC_SYNCABLE_NIGORI_HANDLER_H_
6 #define SYNC_SYNCABLE_NIGORI_HANDLER_H_
8 #include "sync/base/sync_export.h"
9 #include "sync/internal_api/public/base/model_type.h"
11 namespace google{
12 namespace protobuf{
13 template <typename T>
14 class RepeatedPtrField;
18 namespace sync_pb {
19 class NigoriSpecifics;
22 namespace syncer {
23 namespace syncable {
25 class BaseTransaction;
27 // Sync internal interface for dealing with nigori node and querying
28 // the current set of encrypted types. Not thread safe, so a sync transaction
29 // must be held by a caller whenever invoking methods.
30 class SYNC_EXPORT_PRIVATE NigoriHandler {
31 public:
32 NigoriHandler();
33 virtual ~NigoriHandler();
35 // Apply a nigori node update, updating the internal encryption state
36 // accordingly.
37 virtual void ApplyNigoriUpdate(
38 const sync_pb::NigoriSpecifics& nigori,
39 syncable::BaseTransaction* const trans) = 0;
41 // Store the current encrypt everything/encrypted types state into |nigori|.
42 virtual void UpdateNigoriFromEncryptedTypes(
43 sync_pb::NigoriSpecifics* nigori,
44 syncable::BaseTransaction* const trans) const = 0;
46 // Whether a keystore key needs to be requested from the sync server.
47 virtual bool NeedKeystoreKey(
48 syncable::BaseTransaction* const trans) const = 0;
50 // Set the keystore keys the server returned for this account.
51 // Returns true on success, false otherwise.
52 virtual bool SetKeystoreKeys(
53 const google::protobuf::RepeatedPtrField<std::string>& keys,
54 syncable::BaseTransaction* const trans) = 0;
56 // Returns the set of currently encrypted types.
57 virtual ModelTypeSet GetEncryptedTypes(
58 syncable::BaseTransaction* const trans) const = 0;
61 } // namespace syncable
62 } // namespace syncer
64 #endif // SYNC_SYNCABLE_NIGORI_HANDLER_H_