summaryrefslogtreecommitdiffstats
path: root/sync/syncable/nigori_handler.h
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-16 02:34:16 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-16 02:34:16 +0000
commit4cda788849ffa2942fe593d7b1e4ddd2ff8e30d6 (patch)
tree503db151113cb71fc5a26bc0c9f0d4b748f2865b /sync/syncable/nigori_handler.h
parent10df83e1635617ef38ca9c40bdaf725e00154bb7 (diff)
downloadchromium_src-4cda788849ffa2942fe593d7b1e4ddd2ff8e30d6.zip
chromium_src-4cda788849ffa2942fe593d7b1e4ddd2ff8e30d6.tar.gz
chromium_src-4cda788849ffa2942fe593d7b1e4ddd2ff8e30d6.tar.bz2
[Sync] Add SyncEncryptionHandler
All sync-specific encryption state (types, encrypt everything, explicit passphrase, keys) is now tracked within the new class SyncEncryptionHandler. It's owned by the sync manager, and unifies some of the observer logic we previously had. In addition, it's capable of creating its own transactions, taking us a step closer to have a nigori datatype. In addition, we add a NigoriHandler to abstract the chrome-side of encryption from the sync visible side of encryption. BUG=139848 Review URL: https://chromiumcodereview.appspot.com/10827266 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/syncable/nigori_handler.h')
-rw-r--r--sync/syncable/nigori_handler.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/sync/syncable/nigori_handler.h b/sync/syncable/nigori_handler.h
new file mode 100644
index 0000000..94bb644
--- /dev/null
+++ b/sync/syncable/nigori_handler.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_SYNCABLE_NIGORI_HANDLER_H_
+#define SYNC_SYNCABLE_NIGORI_HANDLER_H_
+
+#include "sync/internal_api/public/base/model_type.h"
+
+namespace sync_pb {
+class NigoriSpecifics;
+}
+
+namespace syncer {
+namespace syncable {
+
+class BaseTransaction;
+
+// Sync internal interface for dealing with nigori node and querying
+// the current set of encrypted types. Not thread safe, so a sync transaction
+// must be held by a caller whenever invoking methods.
+class NigoriHandler {
+ public:
+ NigoriHandler();
+ virtual ~NigoriHandler();
+
+ // Apply a nigori node update, updating the internal encryption state
+ // accordingly.
+ virtual void ApplyNigoriUpdate(
+ const sync_pb::NigoriSpecifics& nigori,
+ syncable::BaseTransaction* const trans) = 0;
+
+ // Store the current encrypt everything/encrypted types state into |nigori|.
+ virtual void UpdateNigoriFromEncryptedTypes(
+ sync_pb::NigoriSpecifics* nigori,
+ syncable::BaseTransaction* const trans) const = 0;
+
+ // Returns the set of currently encrypted types.
+ // TODO(zea): force callers to pass their syncable trans here.
+ virtual ModelTypeSet GetEncryptedTypes() const = 0;
+};
+
+} // namespace syncable
+} // namespace syncer
+
+#endif // SYNC_SYNCABLE_NIGORI_HANDLER_H_