OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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 // Various utility methods for nigory-based multi-type encryption. | |
6 | |
7 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_NIGORI_UTIL_H_ | |
8 #define CHROME_BROWSER_SYNC_SYNCABLE_NIGORI_UTIL_H_ | |
9 #pragma once | |
10 | |
11 #include "chrome/browser/sync/protocol/nigori_specifics.pb.h" | |
12 #include "chrome/browser/sync/syncable/model_type.h" | |
13 | |
14 namespace browser_sync { | |
15 class Cryptographer; | |
16 } | |
17 | |
18 namespace syncable { | |
19 | |
20 const char kEncryptedString[] = "encrypted"; | |
21 | |
22 class BaseTransaction; | |
23 class ReadTransaction; | |
24 class WriteTransaction; | |
25 | |
26 // Set the encrypted datatypes on the nigori node. | |
27 void FillNigoriEncryptedTypes(const ModelTypeSet& types, | |
28 sync_pb::NigoriSpecifics* nigori); | |
29 | |
30 // Check if our unsyced changes are encrypted if they need to be based on | |
31 // |encrypted_types|. | |
32 // Returns: true if all unsynced data that should be encrypted is. | |
33 // false if some unsynced changes need to be encrypted. | |
34 // This method is similar to ProcessUnsyncedChangesForEncryption but does not | |
35 // modify the data and does not care if data is unnecessarily encrypted. | |
36 bool VerifyUnsyncedChangesAreEncrypted( | |
37 BaseTransaction* const trans, | |
38 const ModelTypeSet& encrypted_types); | |
39 | |
40 // Processes all unsynced changes and ensures they are appropriately encrypted | |
41 // or unencrypted, based on |encrypted_types|. | |
42 bool ProcessUnsyncedChangesForEncryption( | |
43 WriteTransaction* const trans, | |
44 browser_sync::Cryptographer* cryptographer); | |
45 | |
46 // Verifies all data of type |type| is encrypted appropriately. | |
47 bool VerifyDataTypeEncryption(BaseTransaction* const trans, | |
48 browser_sync::Cryptographer* cryptographer, | |
49 ModelType type, | |
50 bool is_encrypted); | |
51 | |
52 } // namespace syncable | |
53 | |
54 #endif // CHROME_BROWSER_SYNC_SYNCABLE_NIGORI_UTIL_H_ | |
OLD | NEW |