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