| OLD | NEW |
| 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/apply_control_data_updates.h" | 5 #include "sync/engine/apply_control_data_updates.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "sync/engine/conflict_resolver.h" | 8 #include "sync/engine/conflict_resolver.h" |
| 9 #include "sync/engine/conflict_util.h" | 9 #include "sync/engine/conflict_util.h" |
| 10 #include "sync/engine/syncer_util.h" | 10 #include "sync/engine/syncer_util.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 if (!entry.Get(syncable::UNIQUE_SERVER_TAG).empty()) { | 72 if (!entry.Get(syncable::UNIQUE_SERVER_TAG).empty()) { |
| 73 // We should have already applied all top level control nodes. | 73 // We should have already applied all top level control nodes. |
| 74 DCHECK(!entry.Get(syncable::IS_UNAPPLIED_UPDATE)); | 74 DCHECK(!entry.Get(syncable::IS_UNAPPLIED_UPDATE)); |
| 75 continue; | 75 continue; |
| 76 } | 76 } |
| 77 | 77 |
| 78 ApplyControlUpdate(&trans, | 78 ApplyControlUpdate(&trans, |
| 79 &entry, | 79 &entry, |
| 80 dir->GetCryptographer(&trans)); | 80 dir->GetCryptographer(&trans)); |
| 81 } | 81 } |
| 82 | |
| 83 // Set initial sync ended bits for all control types requested. | |
| 84 for (ModelTypeSet::Iterator it = | |
| 85 session->status_controller().updates_request_types().First(); | |
| 86 it.Good(); it.Inc()) { | |
| 87 if (!IsControlType(it.Get())) | |
| 88 continue; | |
| 89 | |
| 90 // This gets persisted to the directory's backing store. | |
| 91 dir->set_initial_sync_ended_for_type(it.Get(), true); | |
| 92 } | |
| 93 } | 82 } |
| 94 | 83 |
| 95 // Update the nigori handler with the server's nigori node. | 84 // Update the nigori handler with the server's nigori node. |
| 96 // | 85 // |
| 97 // If we have a locally modified nigori node, we merge them manually. This | 86 // If we have a locally modified nigori node, we merge them manually. This |
| 98 // handles the case where two clients both set a different passphrase. The | 87 // handles the case where two clients both set a different passphrase. The |
| 99 // second client to attempt to commit will go into a state of having pending | 88 // second client to attempt to commit will go into a state of having pending |
| 100 // keys, unioned the set of encrypted types, and eventually re-encrypt | 89 // keys, unioned the set of encrypted types, and eventually re-encrypt |
| 101 // everything with the passphrase of the first client and commit the set of | 90 // everything with the passphrase of the first client and commit the set of |
| 102 // merged encryption keys. Until the second client provides the pending | 91 // merged encryption keys. Until the second client provides the pending |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 ConflictResolver::OVERWRITE_LOCAL, | 213 ConflictResolver::OVERWRITE_LOCAL, |
| 225 ConflictResolver::CONFLICT_RESOLUTION_SIZE); | 214 ConflictResolver::CONFLICT_RESOLUTION_SIZE); |
| 226 } | 215 } |
| 227 | 216 |
| 228 UpdateAttemptResponse response = AttemptToUpdateEntry( | 217 UpdateAttemptResponse response = AttemptToUpdateEntry( |
| 229 trans, entry, cryptographer); | 218 trans, entry, cryptographer); |
| 230 DCHECK_EQ(SUCCESS, response); | 219 DCHECK_EQ(SUCCESS, response); |
| 231 } | 220 } |
| 232 | 221 |
| 233 } // namespace syncer | 222 } // namespace syncer |
| OLD | NEW |