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

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

Issue 10916036: [Sync] Implement keystore migration support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 8 years, 3 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
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/conflict_resolver.h" 5 #include "sync/engine/conflict_resolver.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // default encryption key marked as an implicit passphrase. 250 // default encryption key marked as an implicit passphrase.
251 // This works fine except for the case where we had locally set an 251 // This works fine except for the case where we had locally set an
252 // explicit passphrase. In that case the nigori node will have the default 252 // explicit passphrase. In that case the nigori node will have the default
253 // key based on the local explicit passphassphrase, but will not have it 253 // key based on the local explicit passphassphrase, but will not have it
254 // marked as explicit. To fix this we'd have to track whether we have a 254 // marked as explicit. To fix this we'd have to track whether we have a
255 // explicit passphrase or not separate from the nigori, which would 255 // explicit passphrase or not separate from the nigori, which would
256 // introduce even more complexity, so we leave it up to the user to 256 // introduce even more complexity, so we leave it up to the user to
257 // reset that passphrase as an explicit one via settings. The goal here 257 // reset that passphrase as an explicit one via settings. The goal here
258 // is to ensure both sets of encryption keys are preserved. 258 // is to ensure both sets of encryption keys are preserved.
259 if (cryptographer->is_ready()) { 259 if (cryptographer->is_ready()) {
260 cryptographer->GetKeys(server_nigori->mutable_encrypted()); 260 cryptographer->GetKeys(server_nigori->mutable_encryption_keybag());
261 server_nigori->set_using_explicit_passphrase( 261 server_nigori->set_frozen_keybag(
262 entry.Get(syncable::SPECIFICS).nigori(). 262 entry.Get(syncable::SPECIFICS).nigori().frozen_keybag());
263 using_explicit_passphrase()); 263 // TODO(zea): tackle migration-induced conflicts here.
264 } 264 }
265 // We deliberately leave the server's device information. This client will 265 // We deliberately leave the server's device information. This client will
266 // add its own device information on restart. 266 // add its own device information on restart.
267 entry.Put(syncable::SPECIFICS, specifics); 267 entry.Put(syncable::SPECIFICS, specifics);
268 DVLOG(1) << "Resolving simple conflict, merging nigori nodes: " << entry; 268 DVLOG(1) << "Resolving simple conflict, merging nigori nodes: " << entry;
269 status->increment_num_server_overwrites(); 269 status->increment_num_server_overwrites();
270 OverwriteServerChanges(trans, &entry); 270 OverwriteServerChanges(trans, &entry);
271 UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict", 271 UMA_HISTOGRAM_ENUMERATION("Sync.ResolveSimpleConflict",
272 NIGORI_MERGE, 272 NIGORI_MERGE,
273 CONFLICT_RESOLUTION_SIZE); 273 CONFLICT_RESOLUTION_SIZE);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 forward_progress = true; 412 forward_progress = true;
413 break; 413 break;
414 } 414 }
415 processed_items.insert(id); 415 processed_items.insert(id);
416 } 416 }
417 } 417 }
418 return forward_progress; 418 return forward_progress;
419 } 419 }
420 420
421 } // namespace syncer 421 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698