| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/util/cryptographer.h" | 5 #include "sync/util/cryptographer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 if (nigori.encrypt_search_engines()) | 392 if (nigori.encrypt_search_engines()) |
| 393 encrypted_types.Put(SEARCH_ENGINES); | 393 encrypted_types.Put(SEARCH_ENGINES); |
| 394 if (nigori.encrypt_sessions()) | 394 if (nigori.encrypt_sessions()) |
| 395 encrypted_types.Put(SESSIONS); | 395 encrypted_types.Put(SESSIONS); |
| 396 if (nigori.encrypt_app_settings()) | 396 if (nigori.encrypt_app_settings()) |
| 397 encrypted_types.Put(APP_SETTINGS); | 397 encrypted_types.Put(APP_SETTINGS); |
| 398 if (nigori.encrypt_apps()) | 398 if (nigori.encrypt_apps()) |
| 399 encrypted_types.Put(APPS); | 399 encrypted_types.Put(APPS); |
| 400 if (nigori.encrypt_app_notifications()) | 400 if (nigori.encrypt_app_notifications()) |
| 401 encrypted_types.Put(APP_NOTIFICATIONS); | 401 encrypted_types.Put(APP_NOTIFICATIONS); |
| 402 if (nigori.encrypt_history_delete_directives()) |
| 403 encrypted_types.Put(HISTORY_DELETE_DIRECTIVES); |
| 402 | 404 |
| 403 // Note: the initial version with encryption did not support the | 405 // Note: the initial version with encryption did not support the |
| 404 // encrypt_everything field. If anything more than the sensitive types were | 406 // encrypt_everything field. If anything more than the sensitive types were |
| 405 // encrypted, it meant we were encrypting everything. | 407 // encrypted, it meant we were encrypting everything. |
| 406 if (!nigori.has_encrypt_everything() && | 408 if (!nigori.has_encrypt_everything() && |
| 407 !Difference(encrypted_types, SensitiveTypes()).Empty()) { | 409 !Difference(encrypted_types, SensitiveTypes()).Empty()) { |
| 408 set_encrypt_everything(); | 410 set_encrypt_everything(); |
| 409 return; | 411 return; |
| 410 } | 412 } |
| 411 | 413 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 430 nigori->set_encrypt_extensions( | 432 nigori->set_encrypt_extensions( |
| 431 encrypted_types_.Has(EXTENSIONS)); | 433 encrypted_types_.Has(EXTENSIONS)); |
| 432 nigori->set_encrypt_search_engines( | 434 nigori->set_encrypt_search_engines( |
| 433 encrypted_types_.Has(SEARCH_ENGINES)); | 435 encrypted_types_.Has(SEARCH_ENGINES)); |
| 434 nigori->set_encrypt_sessions(encrypted_types_.Has(SESSIONS)); | 436 nigori->set_encrypt_sessions(encrypted_types_.Has(SESSIONS)); |
| 435 nigori->set_encrypt_app_settings( | 437 nigori->set_encrypt_app_settings( |
| 436 encrypted_types_.Has(APP_SETTINGS)); | 438 encrypted_types_.Has(APP_SETTINGS)); |
| 437 nigori->set_encrypt_apps(encrypted_types_.Has(APPS)); | 439 nigori->set_encrypt_apps(encrypted_types_.Has(APPS)); |
| 438 nigori->set_encrypt_app_notifications( | 440 nigori->set_encrypt_app_notifications( |
| 439 encrypted_types_.Has(APP_NOTIFICATIONS)); | 441 encrypted_types_.Has(APP_NOTIFICATIONS)); |
| 442 nigori->set_encrypt_history_delete_directives( |
| 443 encrypted_types_.Has(HISTORY_DELETE_DIRECTIVES)); |
| 440 } | 444 } |
| 441 | 445 |
| 442 void Cryptographer::set_encrypt_everything() { | 446 void Cryptographer::set_encrypt_everything() { |
| 443 if (encrypt_everything_) { | 447 if (encrypt_everything_) { |
| 444 DCHECK(encrypted_types_.Equals(ModelTypeSet::All())); | 448 DCHECK(encrypted_types_.Equals(ModelTypeSet::All())); |
| 445 return; | 449 return; |
| 446 } | 450 } |
| 447 encrypt_everything_ = true; | 451 encrypt_everything_ = true; |
| 448 // Change |encrypted_types_| directly to avoid sending more than one | 452 // Change |encrypted_types_| directly to avoid sending more than one |
| 449 // notification. | 453 // notification. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 key.mac_key())) { | 493 key.mac_key())) { |
| 490 NOTREACHED(); | 494 NOTREACHED(); |
| 491 continue; | 495 continue; |
| 492 } | 496 } |
| 493 nigoris_[key.name()] = make_linked_ptr(new_nigori.release()); | 497 nigoris_[key.name()] = make_linked_ptr(new_nigori.release()); |
| 494 } | 498 } |
| 495 } | 499 } |
| 496 } | 500 } |
| 497 | 501 |
| 498 } // namespace syncer | 502 } // namespace syncer |
| OLD | NEW |