| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/sync/engine/nigori_util.h" | 5 #include "chrome/browser/sync/engine/nigori_util.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // the data, nor for determining if data is encrypted. We simply ensure it has | 64 // the data, nor for determining if data is encrypted. We simply ensure it has |
| 65 // been overwritten to avoid any possible leaks of sensitive data. | 65 // been overwritten to avoid any possible leaks of sensitive data. |
| 66 return SpecificsNeedsEncryption(encrypted_types, entry.Get(SPECIFICS)) || | 66 return SpecificsNeedsEncryption(encrypted_types, entry.Get(SPECIFICS)) || |
| 67 (encrypted_types.Has(type) && | 67 (encrypted_types.Has(type) && |
| 68 entry.Get(NON_UNIQUE_NAME) != kEncryptedString); | 68 entry.Get(NON_UNIQUE_NAME) != kEncryptedString); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool SpecificsNeedsEncryption(ModelEnumSet encrypted_types, | 71 bool SpecificsNeedsEncryption(ModelEnumSet encrypted_types, |
| 72 const sync_pb::EntitySpecifics& specifics) { | 72 const sync_pb::EntitySpecifics& specifics) { |
| 73 const ModelType type = GetModelTypeFromSpecifics(specifics); | 73 const ModelType type = GetModelTypeFromSpecifics(specifics); |
| 74 if (!syncable::IsRealDataType(type)) | |
| 75 return false; | |
| 76 if (type == PASSWORDS || type == NIGORI) | 74 if (type == PASSWORDS || type == NIGORI) |
| 77 return false; // These types have their own encryption schemes. | 75 return false; // These types have their own encryption schemes. |
| 78 if (!encrypted_types.Has(type)) | 76 if (!encrypted_types.Has(type)) |
| 79 return false; // This type does not require encryption | 77 return false; // This type does not require encryption |
| 80 return !specifics.has_encrypted(); | 78 return !specifics.has_encrypted(); |
| 81 } | 79 } |
| 82 | 80 |
| 83 // Mainly for testing. | 81 // Mainly for testing. |
| 84 bool VerifyDataTypeEncryptionForTest( | 82 bool VerifyDataTypeEncryptionForTest( |
| 85 BaseTransaction* const trans, | 83 BaseTransaction* const trans, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 return false; | 138 return false; |
| 141 } | 139 } |
| 142 } | 140 } |
| 143 // Push the successor. | 141 // Push the successor. |
| 144 to_visit.push(child.Get(NEXT_ID)); | 142 to_visit.push(child.Get(NEXT_ID)); |
| 145 } | 143 } |
| 146 return true; | 144 return true; |
| 147 } | 145 } |
| 148 | 146 |
| 149 } // namespace syncable | 147 } // namespace syncable |
| OLD | NEW |