| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 5 |
| 6 #include "chrome/browser/sync/engine/verify_updates_command.h" | 6 #include "chrome/browser/sync/engine/verify_updates_command.h" |
| 7 | 7 |
| 8 #include "chrome/browser/sync/engine/syncer.h" | 8 #include "chrome/browser/sync/engine/syncer.h" |
| 9 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 9 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
| 10 #include "chrome/browser/sync/engine/syncer_types.h" | 10 #include "chrome/browser/sync/engine/syncer_types.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 VerifyUpdateResult result = {VERIFY_FAIL, GROUP_PASSIVE}; | 87 VerifyUpdateResult result = {VERIFY_FAIL, GROUP_PASSIVE}; |
| 88 | 88 |
| 89 const bool deleted = entry.has_deleted() && entry.deleted(); | 89 const bool deleted = entry.has_deleted() && entry.deleted(); |
| 90 const bool is_directory = entry.IsFolder(); | 90 const bool is_directory = entry.IsFolder(); |
| 91 const syncable::ModelType model_type = entry.GetModelType(); | 91 const syncable::ModelType model_type = entry.GetModelType(); |
| 92 | 92 |
| 93 if (!id.ServerKnows()) { | 93 if (!id.ServerKnows()) { |
| 94 LOG(ERROR) << "Illegal negative id in received updates"; | 94 LOG(ERROR) << "Illegal negative id in received updates"; |
| 95 return result; | 95 return result; |
| 96 } | 96 } |
| 97 if (!entry.parent_id().ServerKnows()) { | |
| 98 LOG(ERROR) << "Illegal parent id in received updates"; | |
| 99 return result; | |
| 100 } | |
| 101 { | 97 { |
| 102 const std::string name = SyncerProtoUtil::NameFromSyncEntity(entry); | 98 const std::string name = SyncerProtoUtil::NameFromSyncEntity(entry); |
| 103 if (name.empty() && !deleted) { | 99 if (name.empty() && !deleted) { |
| 104 LOG(ERROR) << "Zero length name in non-deleted update"; | 100 LOG(ERROR) << "Zero length name in non-deleted update"; |
| 105 return result; | 101 return result; |
| 106 } | 102 } |
| 107 } | 103 } |
| 108 | 104 |
| 109 syncable::MutableEntry same_id(trans, GET_BY_ID, id); | 105 syncable::MutableEntry same_id(trans, GET_BY_ID, id); |
| 110 result.value = SyncerUtil::VerifyNewEntry(entry, &same_id, deleted); | 106 result.value = SyncerUtil::VerifyNewEntry(entry, &same_id, deleted); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 129 deleted, is_directory, model_type); | 125 deleted, is_directory, model_type); |
| 130 } | 126 } |
| 131 | 127 |
| 132 if (VERIFY_UNDECIDED == result.value) | 128 if (VERIFY_UNDECIDED == result.value) |
| 133 result.value = VERIFY_SUCCESS; // No news is good news. | 129 result.value = VERIFY_SUCCESS; // No news is good news. |
| 134 | 130 |
| 135 return result; // This might be VERIFY_SUCCESS as well | 131 return result; // This might be VERIFY_SUCCESS as well |
| 136 } | 132 } |
| 137 | 133 |
| 138 } // namespace browser_sync | 134 } // namespace browser_sync |
| OLD | NEW |