| 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(31 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); | 245 COMPILE_ASSERT(32 == 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 15 matching lines...) Expand all Loading... |
| 271 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); | 271 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); |
| 272 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); | 272 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); |
| 273 } | 273 } |
| 274 | 274 |
| 275 ModelTypeSet GetEncryptedTypesFromNigori( | 275 ModelTypeSet GetEncryptedTypesFromNigori( |
| 276 const sync_pb::NigoriSpecifics& nigori) { | 276 const sync_pb::NigoriSpecifics& nigori) { |
| 277 if (nigori.encrypt_everything()) | 277 if (nigori.encrypt_everything()) |
| 278 return ModelTypeSet::All(); | 278 return ModelTypeSet::All(); |
| 279 | 279 |
| 280 ModelTypeSet encrypted_types; | 280 ModelTypeSet encrypted_types; |
| 281 COMPILE_ASSERT(31 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); | 281 COMPILE_ASSERT(32 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); |
| 282 if (nigori.encrypt_bookmarks()) | 282 if (nigori.encrypt_bookmarks()) |
| 283 encrypted_types.Put(BOOKMARKS); | 283 encrypted_types.Put(BOOKMARKS); |
| 284 if (nigori.encrypt_preferences()) | 284 if (nigori.encrypt_preferences()) |
| 285 encrypted_types.Put(PREFERENCES); | 285 encrypted_types.Put(PREFERENCES); |
| 286 if (nigori.encrypt_autofill_profile()) | 286 if (nigori.encrypt_autofill_profile()) |
| 287 encrypted_types.Put(AUTOFILL_PROFILE); | 287 encrypted_types.Put(AUTOFILL_PROFILE); |
| 288 if (nigori.encrypt_autofill()) | 288 if (nigori.encrypt_autofill()) |
| 289 encrypted_types.Put(AUTOFILL); | 289 encrypted_types.Put(AUTOFILL); |
| 290 if (nigori.encrypt_themes()) | 290 if (nigori.encrypt_themes()) |
| 291 encrypted_types.Put(THEMES); | 291 encrypted_types.Put(THEMES); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 313 encrypted_types.Put(FAVICON_TRACKING); | 313 encrypted_types.Put(FAVICON_TRACKING); |
| 314 if (nigori.encrypt_articles()) | 314 if (nigori.encrypt_articles()) |
| 315 encrypted_types.Put(ARTICLES); | 315 encrypted_types.Put(ARTICLES); |
| 316 if (nigori.encrypt_app_list()) | 316 if (nigori.encrypt_app_list()) |
| 317 encrypted_types.Put(APP_LIST); | 317 encrypted_types.Put(APP_LIST); |
| 318 return encrypted_types; | 318 return encrypted_types; |
| 319 } | 319 } |
| 320 | 320 |
| 321 } // namespace syncable | 321 } // namespace syncable |
| 322 } // namespace syncer | 322 } // namespace syncer |
| OLD | NEW |