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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 << ModelTypeToString(type) | 245 << ModelTypeToString(type) |
246 << " and marking for syncing."; | 246 << " and marking for syncing."; |
247 syncable::MarkForSyncing(entry); | 247 syncable::MarkForSyncing(entry); |
248 return true; | 248 return true; |
249 } | 249 } |
250 | 250 |
251 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, | 251 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, |
252 bool encrypt_everything, | 252 bool encrypt_everything, |
253 sync_pb::NigoriSpecifics* nigori) { | 253 sync_pb::NigoriSpecifics* nigori) { |
254 nigori->set_encrypt_everything(encrypt_everything); | 254 nigori->set_encrypt_everything(encrypt_everything); |
255 COMPILE_ASSERT(25 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); | 255 COMPILE_ASSERT(26 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); |
256 nigori->set_encrypt_bookmarks( | 256 nigori->set_encrypt_bookmarks( |
257 encrypted_types.Has(BOOKMARKS)); | 257 encrypted_types.Has(BOOKMARKS)); |
258 nigori->set_encrypt_preferences( | 258 nigori->set_encrypt_preferences( |
259 encrypted_types.Has(PREFERENCES)); | 259 encrypted_types.Has(PREFERENCES)); |
260 nigori->set_encrypt_autofill_profile( | 260 nigori->set_encrypt_autofill_profile( |
261 encrypted_types.Has(AUTOFILL_PROFILE)); | 261 encrypted_types.Has(AUTOFILL_PROFILE)); |
262 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL)); | 262 nigori->set_encrypt_autofill(encrypted_types.Has(AUTOFILL)); |
263 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); | 263 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); |
264 nigori->set_encrypt_typed_urls( | 264 nigori->set_encrypt_typed_urls( |
265 encrypted_types.Has(TYPED_URLS)); | 265 encrypted_types.Has(TYPED_URLS)); |
(...skipping 13 matching lines...) Expand all Loading... |
279 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES)); | 279 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES)); |
280 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING)); | 280 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING)); |
281 } | 281 } |
282 | 282 |
283 ModelTypeSet GetEncryptedTypesFromNigori( | 283 ModelTypeSet GetEncryptedTypesFromNigori( |
284 const sync_pb::NigoriSpecifics& nigori) { | 284 const sync_pb::NigoriSpecifics& nigori) { |
285 if (nigori.encrypt_everything()) | 285 if (nigori.encrypt_everything()) |
286 return ModelTypeSet::All(); | 286 return ModelTypeSet::All(); |
287 | 287 |
288 ModelTypeSet encrypted_types; | 288 ModelTypeSet encrypted_types; |
289 COMPILE_ASSERT(25 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); | 289 COMPILE_ASSERT(26 == MODEL_TYPE_COUNT, UpdateEncryptedTypes); |
290 if (nigori.encrypt_bookmarks()) | 290 if (nigori.encrypt_bookmarks()) |
291 encrypted_types.Put(BOOKMARKS); | 291 encrypted_types.Put(BOOKMARKS); |
292 if (nigori.encrypt_preferences()) | 292 if (nigori.encrypt_preferences()) |
293 encrypted_types.Put(PREFERENCES); | 293 encrypted_types.Put(PREFERENCES); |
294 if (nigori.encrypt_autofill_profile()) | 294 if (nigori.encrypt_autofill_profile()) |
295 encrypted_types.Put(AUTOFILL_PROFILE); | 295 encrypted_types.Put(AUTOFILL_PROFILE); |
296 if (nigori.encrypt_autofill()) | 296 if (nigori.encrypt_autofill()) |
297 encrypted_types.Put(AUTOFILL); | 297 encrypted_types.Put(AUTOFILL); |
298 if (nigori.encrypt_themes()) | 298 if (nigori.encrypt_themes()) |
299 encrypted_types.Put(THEMES); | 299 encrypted_types.Put(THEMES); |
(...skipping 17 matching lines...) Expand all Loading... |
317 encrypted_types.Put(DICTIONARY); | 317 encrypted_types.Put(DICTIONARY); |
318 if (nigori.encrypt_favicon_images()) | 318 if (nigori.encrypt_favicon_images()) |
319 encrypted_types.Put(FAVICON_IMAGES); | 319 encrypted_types.Put(FAVICON_IMAGES); |
320 if (nigori.encrypt_favicon_tracking()) | 320 if (nigori.encrypt_favicon_tracking()) |
321 encrypted_types.Put(FAVICON_TRACKING); | 321 encrypted_types.Put(FAVICON_TRACKING); |
322 return encrypted_types; | 322 return encrypted_types; |
323 } | 323 } |
324 | 324 |
325 } // namespace syncable | 325 } // namespace syncable |
326 } // namespace syncer | 326 } // namespace syncer |
OLD | NEW |