OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/get_commit_ids_command.h" | 5 #include "chrome/browser/sync/engine/get_commit_ids_command.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 syncable::ModelTypeSet throttled_types) { | 80 syncable::ModelTypeSet throttled_types) { |
81 if (!entry.Get(syncable::IS_UNSYNCED)) | 81 if (!entry.Get(syncable::IS_UNSYNCED)) |
82 return false; | 82 return false; |
83 | 83 |
84 if (entry.Get(syncable::SERVER_VERSION) > 0 && | 84 if (entry.Get(syncable::SERVER_VERSION) > 0 && |
85 (entry.Get(syncable::SERVER_VERSION) > | 85 (entry.Get(syncable::SERVER_VERSION) > |
86 entry.Get(syncable::BASE_VERSION))) { | 86 entry.Get(syncable::BASE_VERSION))) { |
87 // The local and server versions don't match. The item must be in | 87 // The local and server versions don't match. The item must be in |
88 // conflict, so there's no point in attempting to commit. | 88 // conflict, so there's no point in attempting to commit. |
89 DCHECK(entry.Get(syncable::IS_UNAPPLIED_UPDATE)); // In conflict. | 89 DCHECK(entry.Get(syncable::IS_UNAPPLIED_UPDATE)); // In conflict. |
90 // TODO(zea): switch this to DVLOG once it's clear bug 100660 is fixed. | |
91 DVLOG(1) << "Excluding entry from commit due to version mismatch " | 90 DVLOG(1) << "Excluding entry from commit due to version mismatch " |
92 << entry; | 91 << entry; |
93 return false; | 92 return false; |
94 } | 93 } |
95 | 94 |
96 const syncable::ModelType type = entry.GetModelType(); | 95 const syncable::ModelType type = entry.GetModelType(); |
97 // We special case the nigori node because even though it is considered an | 96 // We special case the nigori node because even though it is considered an |
98 // "encrypted type", not all nigori node changes require valid encryption | 97 // "encrypted type", not all nigori node changes require valid encryption |
99 // (ex: sync_tabs). | 98 // (ex: sync_tabs). |
100 if ((type != syncable::NIGORI) && | 99 if ((type != syncable::NIGORI) && |
101 encrypted_types.Has(type) && | 100 encrypted_types.Has(type) && |
102 (passphrase_missing || | 101 (passphrase_missing || |
103 syncable::EntryNeedsEncryption(encrypted_types, entry))) { | 102 syncable::EntryNeedsEncryption(encrypted_types, entry))) { |
104 // This entry requires encryption but is not properly encrypted (possibly | 103 // This entry requires encryption but is not properly encrypted (possibly |
105 // due to the cryptographer not being initialized or the user hasn't | 104 // due to the cryptographer not being initialized or the user hasn't |
106 // provided the most recent passphrase). | 105 // provided the most recent passphrase). |
107 // TODO(zea): switch this to DVLOG once it's clear bug 100660 is fixed. | |
108 DVLOG(1) << "Excluding entry from commit due to lack of encryption " | 106 DVLOG(1) << "Excluding entry from commit due to lack of encryption " |
109 << entry; | 107 << entry; |
110 return false; | 108 return false; |
111 } | 109 } |
112 | 110 |
113 // Look at the throttled types. | 111 // Look at the throttled types. |
114 if (throttled_types.Has(type)) | 112 if (throttled_types.Has(type)) |
115 return false; | 113 return false; |
116 | 114 |
117 return true; | 115 return true; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 352 |
355 // Add moves and creates, and prepend their uncommitted parents. | 353 // Add moves and creates, and prepend their uncommitted parents. |
356 AddCreatesAndMoves(unsynced_handles, write_transaction, routes, | 354 AddCreatesAndMoves(unsynced_handles, write_transaction, routes, |
357 throttled_types); | 355 throttled_types); |
358 | 356 |
359 // Add all deletes. | 357 // Add all deletes. |
360 AddDeletes(unsynced_handles, write_transaction); | 358 AddDeletes(unsynced_handles, write_transaction); |
361 } | 359 } |
362 | 360 |
363 } // namespace browser_sync | 361 } // namespace browser_sync |
OLD | NEW |