| 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 static_assert(35 == MODEL_TYPE_COUNT, "update encrypted types"); | 245 static_assert(36 == MODEL_TYPE_COUNT, "update encrypted types"); |
| 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_autofill_wallet_metadata( |
| 254 encrypted_types.Has(AUTOFILL_WALLET_METADATA)); |
| 253 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); | 255 nigori->set_encrypt_themes(encrypted_types.Has(THEMES)); |
| 254 nigori->set_encrypt_typed_urls( | 256 nigori->set_encrypt_typed_urls( |
| 255 encrypted_types.Has(TYPED_URLS)); | 257 encrypted_types.Has(TYPED_URLS)); |
| 256 nigori->set_encrypt_extension_settings( | 258 nigori->set_encrypt_extension_settings( |
| 257 encrypted_types.Has(EXTENSION_SETTINGS)); | 259 encrypted_types.Has(EXTENSION_SETTINGS)); |
| 258 nigori->set_encrypt_extensions( | 260 nigori->set_encrypt_extensions( |
| 259 encrypted_types.Has(EXTENSIONS)); | 261 encrypted_types.Has(EXTENSIONS)); |
| 260 nigori->set_encrypt_search_engines( | 262 nigori->set_encrypt_search_engines( |
| 261 encrypted_types.Has(SEARCH_ENGINES)); | 263 encrypted_types.Has(SEARCH_ENGINES)); |
| 262 nigori->set_encrypt_sessions(encrypted_types.Has(SESSIONS)); | 264 nigori->set_encrypt_sessions(encrypted_types.Has(SESSIONS)); |
| 263 nigori->set_encrypt_app_settings( | 265 nigori->set_encrypt_app_settings( |
| 264 encrypted_types.Has(APP_SETTINGS)); | 266 encrypted_types.Has(APP_SETTINGS)); |
| 265 nigori->set_encrypt_apps(encrypted_types.Has(APPS)); | 267 nigori->set_encrypt_apps(encrypted_types.Has(APPS)); |
| 266 nigori->set_encrypt_app_notifications( | 268 nigori->set_encrypt_app_notifications( |
| 267 encrypted_types.Has(APP_NOTIFICATIONS)); | 269 encrypted_types.Has(APP_NOTIFICATIONS)); |
| 268 nigori->set_encrypt_dictionary(encrypted_types.Has(DICTIONARY)); | 270 nigori->set_encrypt_dictionary(encrypted_types.Has(DICTIONARY)); |
| 269 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES)); | 271 nigori->set_encrypt_favicon_images(encrypted_types.Has(FAVICON_IMAGES)); |
| 270 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING)); | 272 nigori->set_encrypt_favicon_tracking(encrypted_types.Has(FAVICON_TRACKING)); |
| 271 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); | 273 nigori->set_encrypt_articles(encrypted_types.Has(ARTICLES)); |
| 272 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); | 274 nigori->set_encrypt_app_list(encrypted_types.Has(APP_LIST)); |
| 273 } | 275 } |
| 274 | 276 |
| 275 ModelTypeSet GetEncryptedTypesFromNigori( | 277 ModelTypeSet GetEncryptedTypesFromNigori( |
| 276 const sync_pb::NigoriSpecifics& nigori) { | 278 const sync_pb::NigoriSpecifics& nigori) { |
| 277 if (nigori.encrypt_everything()) | 279 if (nigori.encrypt_everything()) |
| 278 return ModelTypeSet::All(); | 280 return ModelTypeSet::All(); |
| 279 | 281 |
| 280 ModelTypeSet encrypted_types; | 282 ModelTypeSet encrypted_types; |
| 281 static_assert(35 == MODEL_TYPE_COUNT, "update encrypted types"); | 283 static_assert(36 == MODEL_TYPE_COUNT, "update encrypted types"); |
| 282 if (nigori.encrypt_bookmarks()) | 284 if (nigori.encrypt_bookmarks()) |
| 283 encrypted_types.Put(BOOKMARKS); | 285 encrypted_types.Put(BOOKMARKS); |
| 284 if (nigori.encrypt_preferences()) | 286 if (nigori.encrypt_preferences()) |
| 285 encrypted_types.Put(PREFERENCES); | 287 encrypted_types.Put(PREFERENCES); |
| 286 if (nigori.encrypt_autofill_profile()) | 288 if (nigori.encrypt_autofill_profile()) |
| 287 encrypted_types.Put(AUTOFILL_PROFILE); | 289 encrypted_types.Put(AUTOFILL_PROFILE); |
| 288 if (nigori.encrypt_autofill()) | 290 if (nigori.encrypt_autofill()) |
| 289 encrypted_types.Put(AUTOFILL); | 291 encrypted_types.Put(AUTOFILL); |
| 292 if (nigori.encrypt_autofill_wallet_metadata()) |
| 293 encrypted_types.Put(AUTOFILL_WALLET_METADATA); |
| 290 if (nigori.encrypt_themes()) | 294 if (nigori.encrypt_themes()) |
| 291 encrypted_types.Put(THEMES); | 295 encrypted_types.Put(THEMES); |
| 292 if (nigori.encrypt_typed_urls()) | 296 if (nigori.encrypt_typed_urls()) |
| 293 encrypted_types.Put(TYPED_URLS); | 297 encrypted_types.Put(TYPED_URLS); |
| 294 if (nigori.encrypt_extension_settings()) | 298 if (nigori.encrypt_extension_settings()) |
| 295 encrypted_types.Put(EXTENSION_SETTINGS); | 299 encrypted_types.Put(EXTENSION_SETTINGS); |
| 296 if (nigori.encrypt_extensions()) | 300 if (nigori.encrypt_extensions()) |
| 297 encrypted_types.Put(EXTENSIONS); | 301 encrypted_types.Put(EXTENSIONS); |
| 298 if (nigori.encrypt_search_engines()) | 302 if (nigori.encrypt_search_engines()) |
| 299 encrypted_types.Put(SEARCH_ENGINES); | 303 encrypted_types.Put(SEARCH_ENGINES); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 313 encrypted_types.Put(FAVICON_TRACKING); | 317 encrypted_types.Put(FAVICON_TRACKING); |
| 314 if (nigori.encrypt_articles()) | 318 if (nigori.encrypt_articles()) |
| 315 encrypted_types.Put(ARTICLES); | 319 encrypted_types.Put(ARTICLES); |
| 316 if (nigori.encrypt_app_list()) | 320 if (nigori.encrypt_app_list()) |
| 317 encrypted_types.Put(APP_LIST); | 321 encrypted_types.Put(APP_LIST); |
| 318 return encrypted_types; | 322 return encrypted_types; |
| 319 } | 323 } |
| 320 | 324 |
| 321 } // namespace syncable | 325 } // namespace syncable |
| 322 } // namespace syncer | 326 } // namespace syncer |
| OLD | NEW |