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/engine/syncer_util.h" | 5 #include "sync/engine/syncer_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // preserve the encryption keys based on the local passphrase, while the | 210 // preserve the encryption keys based on the local passphrase, while the |
211 // nigori node will preserve the server encryption keys. | 211 // nigori node will preserve the server encryption keys. |
212 // | 212 // |
213 // If non-encryption changes are made to the nigori node, they will be | 213 // If non-encryption changes are made to the nigori node, they will be |
214 // lost as part of conflict resolution. This is intended, as we place a higher | 214 // lost as part of conflict resolution. This is intended, as we place a higher |
215 // priority on preserving the server's passphrase change to preserving local | 215 // priority on preserving the server's passphrase change to preserving local |
216 // non-encryption changes. Next time the non-encryption changes are made to | 216 // non-encryption changes. Next time the non-encryption changes are made to |
217 // the nigori node (e.g. on restart), they will commit without issue. | 217 // the nigori node (e.g. on restart), they will commit without issue. |
218 if (specifics.has_nigori()) { | 218 if (specifics.has_nigori()) { |
219 const sync_pb::NigoriSpecifics& nigori = specifics.nigori(); | 219 const sync_pb::NigoriSpecifics& nigori = specifics.nigori(); |
220 cryptographer->Update(nigori); | 220 cryptographer->ApplyNigoriUpdate(nigori, trans); |
221 | 221 |
222 // Make sure any unsynced changes are properly encrypted as necessary. | 222 // Make sure any unsynced changes are properly encrypted as necessary. |
223 // We only perform this if the cryptographer is ready. If not, these are | 223 // We only perform this if the cryptographer is ready. If not, these are |
224 // re-encrypted at SetDecryptionPassphrase time (via ReEncryptEverything). | 224 // re-encrypted at SetDecryptionPassphrase time (via ReEncryptEverything). |
225 // This logic covers the case where the nigori update marked new datatypes | 225 // This logic covers the case where the nigori update marked new datatypes |
226 // for encryption, but didn't change the passphrase. | 226 // for encryption, but didn't change the passphrase. |
227 if (cryptographer->is_ready()) { | 227 if (cryptographer->is_ready()) { |
228 // Note that we don't bother to encrypt any data for which IS_UNSYNCED | 228 // Note that we don't bother to encrypt any data for which IS_UNSYNCED |
229 // == false here. The machine that turned on encryption should know about | 229 // == false here. The machine that turned on encryption should know about |
230 // and re-encrypt all synced data. It's possible it could get interrupted | 230 // and re-encrypt all synced data. It's possible it could get interrupted |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 if (update.version() < target->Get(SERVER_VERSION)) { | 692 if (update.version() < target->Get(SERVER_VERSION)) { |
693 LOG(WARNING) << "Update older than current server version for " | 693 LOG(WARNING) << "Update older than current server version for " |
694 << *target << " Update:" | 694 << *target << " Update:" |
695 << SyncerProtoUtil::SyncEntityDebugString(update); | 695 << SyncerProtoUtil::SyncEntityDebugString(update); |
696 return VERIFY_SUCCESS; // Expected in new sync protocol. | 696 return VERIFY_SUCCESS; // Expected in new sync protocol. |
697 } | 697 } |
698 return VERIFY_UNDECIDED; | 698 return VERIFY_UNDECIDED; |
699 } | 699 } |
700 | 700 |
701 } // namespace syncer | 701 } // namespace syncer |
OLD | NEW |