| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/syncer_util.h" | 5 #include "chrome/browser/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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // We intercept updates to the Nigori node, update the Cryptographer and | 292 // We intercept updates to the Nigori node, update the Cryptographer and |
| 293 // encrypt any unsynced changes here because there is no Nigori | 293 // encrypt any unsynced changes here because there is no Nigori |
| 294 // ChangeProcessor. | 294 // ChangeProcessor. |
| 295 const sync_pb::EntitySpecifics& specifics = entry->Get(SERVER_SPECIFICS); | 295 const sync_pb::EntitySpecifics& specifics = entry->Get(SERVER_SPECIFICS); |
| 296 if (specifics.HasExtension(sync_pb::nigori)) { | 296 if (specifics.HasExtension(sync_pb::nigori)) { |
| 297 const sync_pb::NigoriSpecifics& nigori = | 297 const sync_pb::NigoriSpecifics& nigori = |
| 298 specifics.GetExtension(sync_pb::nigori); | 298 specifics.GetExtension(sync_pb::nigori); |
| 299 cryptographer->Update(nigori); | 299 cryptographer->Update(nigori); |
| 300 | 300 |
| 301 // Make sure any unsynced changes are properly encrypted as necessary. | 301 // Make sure any unsynced changes are properly encrypted as necessary. |
| 302 const syncable::ModelEnumSet encrypted_types = | 302 const syncable::ModelTypeSet encrypted_types = |
| 303 cryptographer->GetEncryptedTypes(); | 303 cryptographer->GetEncryptedTypes(); |
| 304 if (!VerifyUnsyncedChangesAreEncrypted(trans, encrypted_types) && | 304 if (!VerifyUnsyncedChangesAreEncrypted(trans, encrypted_types) && |
| 305 (!cryptographer->is_ready() || | 305 (!cryptographer->is_ready() || |
| 306 !syncable::ProcessUnsyncedChangesForEncryption(trans, | 306 !syncable::ProcessUnsyncedChangesForEncryption(trans, |
| 307 cryptographer))) { | 307 cryptographer))) { |
| 308 // We were unable to encrypt the changes, possibly due to a missing | 308 // We were unable to encrypt the changes, possibly due to a missing |
| 309 // passphrase. We return conflict, even though the conflict is with the | 309 // passphrase. We return conflict, even though the conflict is with the |
| 310 // unsynced change and not the nigori node. We ensure foward progress | 310 // unsynced change and not the nigori node. We ensure foward progress |
| 311 // because the cryptographer already has the pending keys set, so once | 311 // because the cryptographer already has the pending keys set, so once |
| 312 // the new passphrase is entered we should be able to encrypt properly. | 312 // the new passphrase is entered we should be able to encrypt properly. |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 if (update.version() < target->Get(SERVER_VERSION)) { | 753 if (update.version() < target->Get(SERVER_VERSION)) { |
| 754 LOG(WARNING) << "Update older than current server version for " | 754 LOG(WARNING) << "Update older than current server version for " |
| 755 << *target << " Update:" | 755 << *target << " Update:" |
| 756 << SyncerProtoUtil::SyncEntityDebugString(update); | 756 << SyncerProtoUtil::SyncEntityDebugString(update); |
| 757 return VERIFY_SUCCESS; // Expected in new sync protocol. | 757 return VERIFY_SUCCESS; // Expected in new sync protocol. |
| 758 } | 758 } |
| 759 return VERIFY_UNDECIDED; | 759 return VERIFY_UNDECIDED; |
| 760 } | 760 } |
| 761 | 761 |
| 762 } // namespace browser_sync | 762 } // namespace browser_sync |
| OLD | NEW |