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 "components/sync/syncable/nigori_util.h" | 5 #include "components/sync/syncable/nigori_util.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 DVLOG(1) << "Overwriting specifics of type " << ModelTypeToString(type) | 239 DVLOG(1) << "Overwriting specifics of type " << ModelTypeToString(type) |
240 << " and marking for syncing."; | 240 << " and marking for syncing."; |
241 syncable::MarkForSyncing(entry); | 241 syncable::MarkForSyncing(entry); |
242 return true; | 242 return true; |
243 } | 243 } |
244 | 244 |
245 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, | 245 void UpdateNigoriFromEncryptedTypes(ModelTypeSet encrypted_types, |
246 bool encrypt_everything, | 246 bool encrypt_everything, |
247 sync_pb::NigoriSpecifics* nigori) { | 247 sync_pb::NigoriSpecifics* nigori) { |
248 nigori->set_encrypt_everything(encrypt_everything); | 248 nigori->set_encrypt_everything(encrypt_everything); |
249 static_assert(38 == MODEL_TYPE_COUNT, "update encrypted types"); | 249 static_assert(39 == MODEL_TYPE_COUNT, "update encrypted types"); |
250 nigori->set_encrypt_bookmarks(encrypted_types.Has(BOOKMARKS)); | 250 nigori->set_encrypt_bookmarks(encrypted_types.Has(BOOKMARKS)); |
251 nigori->set_encrypt_preferences(encrypted_types.Has(PREFERENCES)); | 251 nigori->set_encrypt_preferences(encrypted_types.Has(PREFERENCES)); |
252 nigori->set_encrypt_autofill_profile(encrypted_types.Has(AUTOFILL_PROFILE)); | 252 nigori->set_encrypt_autofill_profile(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_autofill_wallet_metadata( | 254 nigori->set_encrypt_autofill_wallet_metadata( |
255 encrypted_types.Has(AUTOFILL_WALLET_METADATA)); | 255 encrypted_types.Has(AUTOFILL_WALLET_METADATA)); |
256 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); | 256 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); |
257 nigori->set_encrypt_typed_urls(encrypted_types.Has(TYPED_URLS)); | 257 nigori->set_encrypt_typed_urls(encrypted_types.Has(TYPED_URLS)); |
258 nigori->set_encrypt_extension_settings( | 258 nigori->set_encrypt_extension_settings( |
259 encrypted_types.Has(EXTENSION_SETTINGS)); | 259 encrypted_types.Has(EXTENSION_SETTINGS)); |
260 nigori->set_encrypt_extensions(encrypted_types.Has(EXTENSIONS)); | 260 nigori->set_encrypt_extensions(encrypted_types.Has(EXTENSIONS)); |
261 nigori->set_encrypt_search_engines(encrypted_types.Has(SEARCH_ENGINES)); | 261 nigori->set_encrypt_search_engines(encrypted_types.Has(SEARCH_ENGINES)); |
262 nigori->set_encrypt_sessions(encrypted_types.Has(SESSIONS)); | 262 nigori->set_encrypt_sessions(encrypted_types.Has(SESSIONS)); |
263 nigori->set_encrypt_app_settings(encrypted_types.Has(APP_SETTINGS)); | 263 nigori->set_encrypt_app_settings(encrypted_types.Has(APP_SETTINGS)); |
264 nigori->set_encrypt_apps(encrypted_types.Has(APPS)); | 264 nigori->set_encrypt_apps(encrypted_types.Has(APPS)); |
265 nigori->set_encrypt_app_notifications(encrypted_types.Has(APP_NOTIFICATIONS)); | 265 nigori->set_encrypt_app_notifications(encrypted_types.Has(APP_NOTIFICATIONS)); |
266 nigori->set_encrypt_dictionary(encrypted_types.Has(DICTIONARY)); | 266 nigori->set_encrypt_dictionary(encrypted_types.Has(DICTIONARY)); |
267 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES)); | 267 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES)); |
268 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING)); | 268 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING)); |
269 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); | 269 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); |
270 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); | 270 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); |
271 nigori->set_encrypt_arc_package(encrypted_types.Has(ARC_PACKAGE)); | 271 nigori->set_encrypt_arc_package(encrypted_types.Has(ARC_PACKAGE)); |
272 nigori->set_encrypt_printers(encrypted_types.Has(PRINTERS)); | 272 nigori->set_encrypt_printers(encrypted_types.Has(PRINTERS)); |
| 273 nigori->set_encrypt_reading_list(encrypted_types.Has(READING_LIST)); |
273 } | 274 } |
274 | 275 |
275 ModelTypeSet GetEncryptedTypesFromNigori( | 276 ModelTypeSet GetEncryptedTypesFromNigori( |
276 const sync_pb::NigoriSpecifics& nigori) { | 277 const sync_pb::NigoriSpecifics& nigori) { |
277 if (nigori.encrypt_everything()) | 278 if (nigori.encrypt_everything()) |
278 return ModelTypeSet::All(); | 279 return ModelTypeSet::All(); |
279 | 280 |
280 ModelTypeSet encrypted_types; | 281 ModelTypeSet encrypted_types; |
281 static_assert(38 == MODEL_TYPE_COUNT, "update encrypted types"); | 282 static_assert(39 == MODEL_TYPE_COUNT, "update encrypted types"); |
282 if (nigori.encrypt_bookmarks()) | 283 if (nigori.encrypt_bookmarks()) |
283 encrypted_types.Put(BOOKMARKS); | 284 encrypted_types.Put(BOOKMARKS); |
284 if (nigori.encrypt_preferences()) | 285 if (nigori.encrypt_preferences()) |
285 encrypted_types.Put(PREFERENCES); | 286 encrypted_types.Put(PREFERENCES); |
286 if (nigori.encrypt_autofill_profile()) | 287 if (nigori.encrypt_autofill_profile()) |
287 encrypted_types.Put(AUTOFILL_PROFILE); | 288 encrypted_types.Put(AUTOFILL_PROFILE); |
288 if (nigori.encrypt_autofill()) | 289 if (nigori.encrypt_autofill()) |
289 encrypted_types.Put(AUTOFILL); | 290 encrypted_types.Put(AUTOFILL); |
290 if (nigori.encrypt_autofill_wallet_metadata()) | 291 if (nigori.encrypt_autofill_wallet_metadata()) |
291 encrypted_types.Put(AUTOFILL_WALLET_METADATA); | 292 encrypted_types.Put(AUTOFILL_WALLET_METADATA); |
(...skipping 22 matching lines...) Expand all Loading... |
314 if (nigori.encrypt_favicon_tracking()) | 315 if (nigori.encrypt_favicon_tracking()) |
315 encrypted_types.Put(FAVICON_TRACKING); | 316 encrypted_types.Put(FAVICON_TRACKING); |
316 if (nigori.encrypt_articles()) | 317 if (nigori.encrypt_articles()) |
317 encrypted_types.Put(ARTICLES); | 318 encrypted_types.Put(ARTICLES); |
318 if (nigori.encrypt_app_list()) | 319 if (nigori.encrypt_app_list()) |
319 encrypted_types.Put(APP_LIST); | 320 encrypted_types.Put(APP_LIST); |
320 if (nigori.encrypt_arc_package()) | 321 if (nigori.encrypt_arc_package()) |
321 encrypted_types.Put(ARC_PACKAGE); | 322 encrypted_types.Put(ARC_PACKAGE); |
322 if (nigori.encrypt_printers()) | 323 if (nigori.encrypt_printers()) |
323 encrypted_types.Put(PRINTERS); | 324 encrypted_types.Put(PRINTERS); |
| 325 if (nigori.encrypt_reading_list()) |
| 326 encrypted_types.Put(READING_LIST); |
324 return encrypted_types; | 327 return encrypted_types; |
325 } | 328 } |
326 | 329 |
327 } // namespace syncable | 330 } // namespace syncable |
328 } // namespace syncer | 331 } // namespace syncer |
OLD | NEW |