| 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 #include "sync/syncable/nigori_util.h" | 5 #include "sync/syncable/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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 << ModelTypeToString(type) | 235 << ModelTypeToString(type) |
| 236 << " and marking for syncing."; | 236 << " and marking for syncing."; |
| 237 syncable::MarkForSyncing(entry); | 237 syncable::MarkForSyncing(entry); |
| 238 return true; | 238 return true; |
| 239 } | 239 } |
| 240 | 240 |
| 241 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, | 241 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, |
| 242 bool encrypt_everything, | 242 bool encrypt_everything, |
| 243 sync_pb::NigoriSpecifics* nigori) { | 243 sync_pb::NigoriSpecifics* nigori) { |
| 244 nigori->set_encrypt_everything(encrypt_everything); | 244 nigori->set_encrypt_everything(encrypt_everything); |
| 245 COMPILE_ASSERT(26 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); | 245 COMPILE_ASSERT(27 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); |
| 246 nigori->set_encrypt_bookmarks( | 246 nigori->set_encrypt_bookmarks( |
| 247 encrypted_types.Has(BOOKMARKS)); | 247 encrypted_types.Has(BOOKMARKS)); |
| 248 nigori->set_encrypt_preferences( | 248 nigori->set_encrypt_preferences( |
| 249 encrypted_types.Has(PREFERENCES)); | 249 encrypted_types.Has(PREFERENCES)); |
| 250 nigori->set_encrypt_autofill_profile( | 250 nigori->set_encrypt_autofill_profile( |
| 251 encrypted_types.Has(AUTOFILL_PROFILE)); | 251 encrypted_types.Has(AUTOFILL_PROFILE)); |
| 252 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL)); | 252 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL)); |
| 253 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); | 253 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); |
| 254 nigori->set_encrypt_typed_urls( | 254 nigori->set_encrypt_typed_urls( |
| 255 encrypted_types.Has(TYPED_URLS)); | 255 encrypted_types.Has(TYPED_URLS)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 269 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES)); | 269 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES)); |
| 270 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING)); | 270 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING)); |
| 271 } | 271 } |
| 272 | 272 |
| 273 ModelTypeSet GetEncryptedTypesFromNigori( | 273 ModelTypeSet GetEncryptedTypesFromNigori( |
| 274 const sync_pb::NigoriSpecifics& nigori) { | 274 const sync_pb::NigoriSpecifics& nigori) { |
| 275 if (nigori.encrypt_everything()) | 275 if (nigori.encrypt_everything()) |
| 276 return ModelTypeSet::All(); | 276 return ModelTypeSet::All(); |
| 277 | 277 |
| 278 ModelTypeSet encrypted_types; | 278 ModelTypeSet encrypted_types; |
| 279 COMPILE_ASSERT(26 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); | 279 COMPILE_ASSERT(27 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); |
| 280 if (nigori.encrypt_bookmarks()) | 280 if (nigori.encrypt_bookmarks()) |
| 281 encrypted_types.Put(BOOKMARKS); | 281 encrypted_types.Put(BOOKMARKS); |
| 282 if (nigori.encrypt_preferences()) | 282 if (nigori.encrypt_preferences()) |
| 283 encrypted_types.Put(PREFERENCES); | 283 encrypted_types.Put(PREFERENCES); |
| 284 if (nigori.encrypt_autofill_profile()) | 284 if (nigori.encrypt_autofill_profile()) |
| 285 encrypted_types.Put(AUTOFILL_PROFILE); | 285 encrypted_types.Put(AUTOFILL_PROFILE); |
| 286 if (nigori.encrypt_autofill()) | 286 if (nigori.encrypt_autofill()) |
| 287 encrypted_types.Put(AUTOFILL); | 287 encrypted_types.Put(AUTOFILL); |
| 288 if (nigori.encrypt_themes()) | 288 if (nigori.encrypt_themes()) |
| 289 encrypted_types.Put(THEMES); | 289 encrypted_types.Put(THEMES); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 307 encrypted_types.Put(DICTIONARY); | 307 encrypted_types.Put(DICTIONARY); |
| 308 if (nigori.encrypt_favicon_images()) | 308 if (nigori.encrypt_favicon_images()) |
| 309 encrypted_types.Put(FAVICON_IMAGES); | 309 encrypted_types.Put(FAVICON_IMAGES); |
| 310 if (nigori.encrypt_favicon_tracking()) | 310 if (nigori.encrypt_favicon_tracking()) |
| 311 encrypted_types.Put(FAVICON_TRACKING); | 311 encrypted_types.Put(FAVICON_TRACKING); |
| 312 return encrypted_types; | 312 return encrypted_types; |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace syncable | 315 } // namespace syncable |
| 316 } // namespace syncer | 316 } // namespace syncer |
| OLD | NEW |