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

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

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 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 13 matching lines...) Expand all
24 using std::map; 24 using std::map;
25 using std::set; 25 using std::set;
26 26
27 namespace syncer { 27 namespace syncer {
28 28
29 using sessions::ConflictProgress; 29 using sessions::ConflictProgress;
30 using sessions::StatusController; 30 using sessions::StatusController;
31 using syncable::BaseTransaction; 31 using syncable::BaseTransaction;
32 using syncable::Directory; 32 using syncable::Directory;
33 using syncable::Entry; 33 using syncable::Entry;
34 using syncable::GetModelTypeFromSpecifics;
35 using syncable::Id; 34 using syncable::Id;
36 using syncable::IsRealDataType;
37 using syncable::MutableEntry; 35 using syncable::MutableEntry;
38 using syncable::WriteTransaction; 36 using syncable::WriteTransaction;
39 37
40 namespace { 38 namespace {
41 39
42 const int SYNC_CYCLES_BEFORE_ADMITTING_DEFEAT = 8; 40 const int SYNC_CYCLES_BEFORE_ADMITTING_DEFEAT = 8;
43 41
44 } // namespace 42 } // namespace
45 43
46 ConflictResolver::ConflictResolver() { 44 ConflictResolver::ConflictResolver() {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 base_server_specifics.SerializeAsString(); 214 base_server_specifics.SerializeAsString();
217 } else { 215 } else {
218 decrypted_base_server_specifics = cryptographer->DecryptToString( 216 decrypted_base_server_specifics = cryptographer->DecryptToString(
219 base_server_specifics.encrypted()); 217 base_server_specifics.encrypted());
220 } 218 }
221 if (decrypted_server_specifics == decrypted_base_server_specifics) 219 if (decrypted_server_specifics == decrypted_base_server_specifics)
222 base_server_specifics_match = true; 220 base_server_specifics_match = true;
223 } 221 }
224 222
225 // We manually merge nigori data. 223 // We manually merge nigori data.
226 if (entry.GetModelType() == syncable::NIGORI) { 224 if (entry.GetModelType() == syncer::NIGORI) {
227 // Create a new set of specifics based on the server specifics (which 225 // Create a new set of specifics based on the server specifics (which
228 // preserves their encryption keys). 226 // preserves their encryption keys).
229 sync_pb::EntitySpecifics specifics = 227 sync_pb::EntitySpecifics specifics =
230 entry.Get(syncable::SERVER_SPECIFICS); 228 entry.Get(syncable::SERVER_SPECIFICS);
231 sync_pb::NigoriSpecifics* server_nigori = specifics.mutable_nigori(); 229 sync_pb::NigoriSpecifics* server_nigori = specifics.mutable_nigori();
232 // Store the merged set of encrypted types (cryptographer->Update(..) will 230 // Store the merged set of encrypted types (cryptographer->Update(..) will
233 // have merged the local types already). 231 // have merged the local types already).
234 cryptographer->UpdateNigoriFromEncryptedTypes(server_nigori); 232 cryptographer->UpdateNigoriFromEncryptedTypes(server_nigori);
235 // The cryptographer has the both the local and remote encryption keys 233 // The cryptographer has the both the local and remote encryption keys
236 // (added at cryptographer->Update(..) time). 234 // (added at cryptographer->Update(..) time).
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 forward_progress = true; 409 forward_progress = true;
412 break; 410 break;
413 } 411 }
414 processed_items.insert(id); 412 processed_items.insert(id);
415 } 413 }
416 } 414 }
417 return forward_progress; 415 return forward_progress;
418 } 416 }
419 417
420 } // namespace syncer 418 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/cleanup_disabled_types_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