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