| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Various utility methods for nigori-based multi-type encryption. | |
| 6 | |
| 7 #ifndef COMPONENTS_SYNC_SYNCABLE_NIGORI_UTIL_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_NIGORI_UTIL_H_ |
| 8 #define COMPONENTS_SYNC_SYNCABLE_NIGORI_UTIL_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_NIGORI_UTIL_H_ |
| 9 | 7 |
| 10 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 11 #include "components/sync/base/model_type.h" | 9 #include "components/sync/base/model_type.h" |
| 12 #include "components/sync/protocol/nigori_specifics.pb.h" | 10 #include "components/sync/protocol/nigori_specifics.pb.h" |
| 13 | 11 |
| 14 namespace sync_pb { | 12 namespace sync_pb { |
| 15 class EntitySpecifics; | 13 class EntitySpecifics; |
| 16 } // namespace sync_pb | 14 } // namespace sync_pb |
| 17 | 15 |
| 18 namespace syncer { | 16 namespace syncer { |
| 19 | 17 |
| 20 class Cryptographer; | 18 class Cryptographer; |
| 21 | 19 |
| 22 namespace syncable { | 20 namespace syncable { |
| 23 | 21 |
| 24 const char kEncryptedString[] = "encrypted"; | 22 const char kEncryptedString[] = "encrypted"; |
| 25 | 23 |
| 26 class BaseTransaction; | 24 class BaseTransaction; |
| 27 class Entry; | 25 class Entry; |
| 28 class MutableEntry; | 26 class MutableEntry; |
| 29 class WriteTransaction; | 27 class WriteTransaction; |
| 30 | 28 |
| 29 // Various utility methods for nigori-based multi-type encryption. |
| 30 |
| 31 // Check if our unsyced changes are encrypted if they need to be based on | 31 // Check if our unsyced changes are encrypted if they need to be based on |
| 32 // |encrypted_types|. | 32 // |encrypted_types|. |
| 33 // Returns: true if all unsynced data that should be encrypted is. | 33 // Returns: true if all unsynced data that should be encrypted is. |
| 34 // false if some unsynced changes need to be encrypted. | 34 // false if some unsynced changes need to be encrypted. |
| 35 // This method is similar to ProcessUnsyncedChangesForEncryption but does not | 35 // This method is similar to ProcessUnsyncedChangesForEncryption but does not |
| 36 // modify the data and does not care if data is unnecessarily encrypted. | 36 // modify the data and does not care if data is unnecessarily encrypted. |
| 37 bool VerifyUnsyncedChangesAreEncrypted(BaseTransaction* const trans, | 37 bool VerifyUnsyncedChangesAreEncrypted(BaseTransaction* const trans, |
| 38 ModelTypeSet encrypted_types); | 38 ModelTypeSet encrypted_types); |
| 39 | 39 |
| 40 // Processes all unsynced changes and ensures they are appropriately encrypted | 40 // Processes all unsynced changes and ensures they are appropriately encrypted |
| (...skipping 28 matching lines...) Expand all Loading... |
| 69 sync_pb::NigoriSpecifics* nigori); | 69 sync_pb::NigoriSpecifics* nigori); |
| 70 | 70 |
| 71 // Extracts the set of encrypted types from a nigori node. | 71 // Extracts the set of encrypted types from a nigori node. |
| 72 ModelTypeSet GetEncryptedTypesFromNigori( | 72 ModelTypeSet GetEncryptedTypesFromNigori( |
| 73 const sync_pb::NigoriSpecifics& nigori); | 73 const sync_pb::NigoriSpecifics& nigori); |
| 74 | 74 |
| 75 } // namespace syncable | 75 } // namespace syncable |
| 76 } // namespace syncer | 76 } // namespace syncer |
| 77 | 77 |
| 78 #endif // COMPONENTS_SYNC_SYNCABLE_NIGORI_UTIL_H_ | 78 #endif // COMPONENTS_SYNC_SYNCABLE_NIGORI_UTIL_H_ |
| OLD | NEW |