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

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

Issue 10844005: [Sync] Refactor GetEncryptedTypes usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + add dcheck 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/apply_updates_command_unittest.cc ('k') | sync/engine/download_updates_command.cc » ('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/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>
11 11
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "sync/engine/syncer.h" 14 #include "sync/engine/syncer.h"
15 #include "sync/engine/syncer_util.h" 15 #include "sync/engine/syncer_util.h"
16 #include "sync/protocol/nigori_specifics.pb.h" 16 #include "sync/protocol/nigori_specifics.pb.h"
17 #include "sync/sessions/status_controller.h" 17 #include "sync/sessions/status_controller.h"
18 #include "sync/syncable/directory.h" 18 #include "sync/syncable/directory.h"
19 #include "sync/syncable/mutable_entry.h" 19 #include "sync/syncable/mutable_entry.h"
20 #include "sync/syncable/nigori_handler.h"
20 #include "sync/syncable/write_transaction.h" 21 #include "sync/syncable/write_transaction.h"
21 #include "sync/util/cryptographer.h" 22 #include "sync/util/cryptographer.h"
22 23
23 using std::list; 24 using std::list;
24 using std::map; 25 using std::map;
25 using std::set; 26 using std::set;
26 27
27 namespace syncer { 28 namespace syncer {
28 29
29 using sessions::ConflictProgress; 30 using sessions::ConflictProgress;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 223
223 // We manually merge nigori data. 224 // We manually merge nigori data.
224 if (entry.GetModelType() == NIGORI) { 225 if (entry.GetModelType() == NIGORI) {
225 // Create a new set of specifics based on the server specifics (which 226 // Create a new set of specifics based on the server specifics (which
226 // preserves their encryption keys). 227 // preserves their encryption keys).
227 sync_pb::EntitySpecifics specifics = 228 sync_pb::EntitySpecifics specifics =
228 entry.Get(syncable::SERVER_SPECIFICS); 229 entry.Get(syncable::SERVER_SPECIFICS);
229 sync_pb::NigoriSpecifics* server_nigori = specifics.mutable_nigori(); 230 sync_pb::NigoriSpecifics* server_nigori = specifics.mutable_nigori();
230 // Store the merged set of encrypted types (cryptographer->Update(..) will 231 // Store the merged set of encrypted types (cryptographer->Update(..) will
231 // have merged the local types already). 232 // have merged the local types already).
232 cryptographer->UpdateNigoriFromEncryptedTypes(server_nigori, trans); 233 trans->directory()->GetNigoriHandler()->UpdateNigoriFromEncryptedTypes(
234 server_nigori,
235 trans);
233 // The cryptographer has the both the local and remote encryption keys 236 // The cryptographer has the both the local and remote encryption keys
234 // (added at cryptographer->Update(..) time). 237 // (added at cryptographer->Update(..) time).
235 // If the cryptographer is ready, then it already merged both sets of keys 238 // If the cryptographer is ready, then it already merged both sets of keys
236 // and we can store them back in. In that case, the remote key was already 239 // and we can store them back in. In that case, the remote key was already
237 // part of the local keybag, so we preserve the local key as the default 240 // part of the local keybag, so we preserve the local key as the default
238 // (including whether it's an explicit key). 241 // (including whether it's an explicit key).
239 // If the cryptographer is not ready, then the user will have to provide 242 // If the cryptographer is not ready, then the user will have to provide
240 // the passphrase to decrypt the pending keys. When they do so, the 243 // the passphrase to decrypt the pending keys. When they do so, the
241 // SetDecryptionPassphrase code will act based on whether the server 244 // SetDecryptionPassphrase code will act based on whether the server
242 // update has an explicit passphrase or not. 245 // update has an explicit passphrase or not.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 forward_progress = true; 412 forward_progress = true;
410 break; 413 break;
411 } 414 }
412 processed_items.insert(id); 415 processed_items.insert(id);
413 } 416 }
414 } 417 }
415 return forward_progress; 418 return forward_progress;
416 } 419 }
417 420
418 } // namespace syncer 421 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/apply_updates_command_unittest.cc ('k') | sync/engine/download_updates_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698