Chromium Code Reviews| 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 "components/sync/core/write_node.h" | 5 #include "components/sync/core/write_node.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 // This will only update password_specifics if the underlying unencrypted blob | 139 // This will only update password_specifics if the underlying unencrypted blob |
| 140 // was different from |data| or was not encrypted with the proper passphrase. | 140 // was different from |data| or was not encrypted with the proper passphrase. |
| 141 if (!cryptographer->Encrypt(data, password_specifics->mutable_encrypted())) { | 141 if (!cryptographer->Encrypt(data, password_specifics->mutable_encrypted())) { |
| 142 LOG(ERROR) << "Failed to encrypt password, possibly due to sync node " | 142 LOG(ERROR) << "Failed to encrypt password, possibly due to sync node " |
| 143 << "corruption"; | 143 << "corruption"; |
| 144 return; | 144 return; |
| 145 } | 145 } |
| 146 SetEntitySpecifics(entity_specifics); | 146 SetEntitySpecifics(entity_specifics); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void WriteNode::SetPasswordSpecificsMetadata( | |
| 150 const sync_pb::PasswordSpecificsMetadata& specifics) {} | |
|
Nicolas Zea
2016/08/20 00:23:43
I wonder if we really need this. Couldn't you set
| |
| 151 | |
| 149 void WriteNode::SetEntitySpecifics(const sync_pb::EntitySpecifics& new_value) { | 152 void WriteNode::SetEntitySpecifics(const sync_pb::EntitySpecifics& new_value) { |
| 150 ModelType new_specifics_type = GetModelTypeFromSpecifics(new_value); | 153 ModelType new_specifics_type = GetModelTypeFromSpecifics(new_value); |
| 151 CHECK(!new_value.password().has_client_only_encrypted_data()); | 154 CHECK(!new_value.password().has_client_only_encrypted_data()); |
| 152 DCHECK_NE(new_specifics_type, UNSPECIFIED); | 155 DCHECK_NE(new_specifics_type, UNSPECIFIED); |
| 153 DVLOG(1) << "Writing entity specifics of type " | 156 DVLOG(1) << "Writing entity specifics of type " |
| 154 << ModelTypeToString(new_specifics_type); | 157 << ModelTypeToString(new_specifics_type); |
| 155 DCHECK_EQ(new_specifics_type, GetModelType()); | 158 DCHECK_EQ(new_specifics_type, GetModelType()); |
| 156 | 159 |
| 157 // Preserve unknown fields. | 160 // Preserve unknown fields. |
| 158 const sync_pb::EntitySpecifics& old_specifics = entry_->GetSpecifics(); | 161 const sync_pb::EntitySpecifics& old_specifics = entry_->GetSpecifics(); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 syncable::Id predecessor_id = | 472 syncable::Id predecessor_id = |
| 470 predecessor ? predecessor->GetSyncId() : syncable::Id(); | 473 predecessor ? predecessor->GetSyncId() : syncable::Id(); |
| 471 return entry_->PutPredecessor(predecessor_id); | 474 return entry_->PutPredecessor(predecessor_id); |
| 472 } | 475 } |
| 473 | 476 |
| 474 void WriteNode::MarkForSyncing() { | 477 void WriteNode::MarkForSyncing() { |
| 475 syncable::MarkForSyncing(entry_); | 478 syncable::MarkForSyncing(entry_); |
| 476 } | 479 } |
| 477 | 480 |
| 478 } // namespace syncer | 481 } // namespace syncer |
| OLD | NEW |