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 #ifndef CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ |
6 #define CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ | 6 #define CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // Setter/getter for whether all current and future datatypes should | 175 // Setter/getter for whether all current and future datatypes should |
176 // be encrypted. Once set you cannot unset without reading from a | 176 // be encrypted. Once set you cannot unset without reading from a |
177 // new nigori node. set_encrypt_everything() emits a notification | 177 // new nigori node. set_encrypt_everything() emits a notification |
178 // the first time it's called. | 178 // the first time it's called. |
179 void set_encrypt_everything(); | 179 void set_encrypt_everything(); |
180 bool encrypt_everything() const; | 180 bool encrypt_everything() const; |
181 | 181 |
182 // Return the set of encrypted types. | 182 // Return the set of encrypted types. |
183 syncable::ModelTypeSet GetEncryptedTypes() const; | 183 syncable::ModelTypeSet GetEncryptedTypes() const; |
184 | 184 |
185 // Forwards to SetEncryptedTypes. | 185 // Forwards to MergeEncryptedTypes. |
186 void SetEncryptedTypesForTest( | 186 void MergeEncryptedTypesForTest( |
187 const syncable::ModelTypeSet& encrypted_types); | 187 const syncable::ModelTypeSet& encrypted_types); |
188 | 188 |
189 private: | 189 private: |
190 FRIEND_TEST_ALL_PREFIXES(CryptographerTest, PackUnpack); | 190 FRIEND_TEST_ALL_PREFIXES(CryptographerTest, PackUnpack); |
191 typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap; | 191 typedef std::map<std::string, linked_ptr<const Nigori> > NigoriMap; |
192 | 192 |
193 // Changes the set of encrypted types and emits a notification if | 193 // Merges the given set of encrypted types with the existing set and emits a |
194 // necessary. | 194 // notification if necessary. |
195 void SetEncryptedTypes(const syncable::ModelTypeSet& encrypted_types); | 195 void MergeEncryptedTypes(const syncable::ModelTypeSet& encrypted_types); |
196 | 196 |
197 void EmitEncryptedTypesChangedNotification(); | 197 void EmitEncryptedTypesChangedNotification(); |
198 | 198 |
199 // Helper method to instantiate Nigori instances for each set of key | 199 // Helper method to instantiate Nigori instances for each set of key |
200 // parameters in |bag| and setting the default encryption key to | 200 // parameters in |bag| and setting the default encryption key to |
201 // |default_key_name|. | 201 // |default_key_name|. |
202 void InstallKeys(const std::string& default_key_name, | 202 void InstallKeys(const std::string& default_key_name, |
203 const sync_pb::NigoriKeyBag& bag); | 203 const sync_pb::NigoriKeyBag& bag); |
204 | 204 |
205 bool AddKeyImpl(Nigori* nigori); | 205 bool AddKeyImpl(Nigori* nigori); |
(...skipping 12 matching lines...) Expand all Loading... |
218 | 218 |
219 syncable::ModelTypeSet encrypted_types_; | 219 syncable::ModelTypeSet encrypted_types_; |
220 bool encrypt_everything_; | 220 bool encrypt_everything_; |
221 | 221 |
222 DISALLOW_COPY_AND_ASSIGN(Cryptographer); | 222 DISALLOW_COPY_AND_ASSIGN(Cryptographer); |
223 }; | 223 }; |
224 | 224 |
225 } // namespace browser_sync | 225 } // namespace browser_sync |
226 | 226 |
227 #endif // CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ | 227 #endif // CHROME_BROWSER_SYNC_UTIL_CRYPTOGRAPHER_H_ |
OLD | NEW |