| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 << ModelTypeToString(type) | 236 << ModelTypeToString(type) |
| 237 << " and marking for syncing."; | 237 << " and marking for syncing."; |
| 238 syncable::MarkForSyncing(entry); | 238 syncable::MarkForSyncing(entry); |
| 239 return true; | 239 return true; |
| 240 } | 240 } |
| 241 | 241 |
| 242 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, | 242 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, |
| 243 bool encrypt_everything, | 243 bool encrypt_everything, |
| 244 sync_pb::NigoriSpecifics* nigori) { | 244 sync_pb::NigoriSpecifics* nigori) { |
| 245 nigori->set_encrypt_everything(encrypt_everything); | 245 nigori->set_encrypt_everything(encrypt_everything); |
| 246 COMPILE_ASSERT(34 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); | 246 static_assert(34 == MODEL_TYPE_COUNT, "update encrypted types"); |
| 247 nigori->set_encrypt_bookmarks( | 247 nigori->set_encrypt_bookmarks( |
| 248 encrypted_types.Has(BOOKMARKS)); | 248 encrypted_types.Has(BOOKMARKS)); |
| 249 nigori->set_encrypt_preferences( | 249 nigori->set_encrypt_preferences( |
| 250 encrypted_types.Has(PREFERENCES)); | 250 encrypted_types.Has(PREFERENCES)); |
| 251 nigori->set_encrypt_autofill_profile( | 251 nigori->set_encrypt_autofill_profile( |
| 252 encrypted_types.Has(AUTOFILL_PROFILE)); | 252 encrypted_types.Has(AUTOFILL_PROFILE)); |
| 253 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL)); | 253 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL)); |
| 254 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); | 254 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); |
| 255 nigori->set_encrypt_typed_urls( | 255 nigori->set_encrypt_typed_urls( |
| 256 encrypted_types.Has(TYPED_URLS)); | 256 encrypted_types.Has(TYPED_URLS)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 272 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); | 272 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); |
| 273 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); | 273 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); |
| 274 } | 274 } |
| 275 | 275 |
| 276 ModelTypeSet GetEncryptedTypesFromNigori( | 276 ModelTypeSet GetEncryptedTypesFromNigori( |
| 277 const sync_pb::NigoriSpecifics& nigori) { | 277 const sync_pb::NigoriSpecifics& nigori) { |
| 278 if (nigori.encrypt_everything()) | 278 if (nigori.encrypt_everything()) |
| 279 return ModelTypeSet::All(); | 279 return ModelTypeSet::All(); |
| 280 | 280 |
| 281 ModelTypeSet encrypted_types; | 281 ModelTypeSet encrypted_types; |
| 282 COMPILE_ASSERT(34 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); | 282 static_assert(34 == MODEL_TYPE_COUNT, "update encrypted types"); |
| 283 if (nigori.encrypt_bookmarks()) | 283 if (nigori.encrypt_bookmarks()) |
| 284 encrypted_types.Put(BOOKMARKS); | 284 encrypted_types.Put(BOOKMARKS); |
| 285 if (nigori.encrypt_preferences()) | 285 if (nigori.encrypt_preferences()) |
| 286 encrypted_types.Put(PREFERENCES); | 286 encrypted_types.Put(PREFERENCES); |
| 287 if (nigori.encrypt_autofill_profile()) | 287 if (nigori.encrypt_autofill_profile()) |
| 288 encrypted_types.Put(AUTOFILL_PROFILE); | 288 encrypted_types.Put(AUTOFILL_PROFILE); |
| 289 if (nigori.encrypt_autofill()) | 289 if (nigori.encrypt_autofill()) |
| 290 encrypted_types.Put(AUTOFILL); | 290 encrypted_types.Put(AUTOFILL); |
| 291 if (nigori.encrypt_themes()) | 291 if (nigori.encrypt_themes()) |
| 292 encrypted_types.Put(THEMES); | 292 encrypted_types.Put(THEMES); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 314 encrypted_types.Put(FAVICON_TRACKING); | 314 encrypted_types.Put(FAVICON_TRACKING); |
| 315 if (nigori.encrypt_articles()) | 315 if (nigori.encrypt_articles()) |
| 316 encrypted_types.Put(ARTICLES); | 316 encrypted_types.Put(ARTICLES); |
| 317 if (nigori.encrypt_app_list()) | 317 if (nigori.encrypt_app_list()) |
| 318 encrypted_types.Put(APP_LIST); | 318 encrypted_types.Put(APP_LIST); |
| 319 return encrypted_types; | 319 return encrypted_types; |
| 320 } | 320 } |
| 321 | 321 |
| 322 } // namespace syncable | 322 } // namespace syncable |
| 323 } // namespace syncer | 323 } // namespace syncer |
| OLD | NEW |