Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: sync/engine/syncer_util.cc

Issue 10827266: [Sync] Add SyncEncryptionHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/engine/syncer_unittest.cc ('k') | sync/internal_api/debug_info_event_listener.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « sync/engine/syncer_unittest.cc ('k') | sync/internal_api/debug_info_event_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698