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

Side by Side Diff: sync/internal_api/write_node.cc

Issue 1161463005: [Sync] Don't crash for encryption errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 6 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
« no previous file with comments | « sync/internal_api/syncapi_internal.cc ('k') | sync/util/cryptographer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/internal_api/public/write_node.h" 5 #include "sync/internal_api/public/write_node.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "sync/internal_api/public/base_transaction.h" 10 #include "sync/internal_api/public/base_transaction.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (GetModelTypeFromSpecifics(old_specifics) == PASSWORDS) { 161 if (GetModelTypeFromSpecifics(old_specifics) == PASSWORDS) {
162 entity_specifics.CopyFrom(old_specifics); 162 entity_specifics.CopyFrom(old_specifics);
163 } else { 163 } else {
164 AddDefaultFieldValue(PASSWORDS, &entity_specifics); 164 AddDefaultFieldValue(PASSWORDS, &entity_specifics);
165 } 165 }
166 sync_pb::PasswordSpecifics* password_specifics = 166 sync_pb::PasswordSpecifics* password_specifics =
167 entity_specifics.mutable_password(); 167 entity_specifics.mutable_password();
168 // This will only update password_specifics if the underlying unencrypted blob 168 // This will only update password_specifics if the underlying unencrypted blob
169 // was different from |data| or was not encrypted with the proper passphrase. 169 // was different from |data| or was not encrypted with the proper passphrase.
170 if (!cryptographer->Encrypt(data, password_specifics->mutable_encrypted())) { 170 if (!cryptographer->Encrypt(data, password_specifics->mutable_encrypted())) {
171 NOTREACHED() << "Failed to encrypt password, possibly due to sync node " 171 LOG(ERROR) << "Failed to encrypt password, possibly due to sync node "
172 << "corruption"; 172 << "corruption";
173 return; 173 return;
174 } 174 }
175 SetEntitySpecifics(entity_specifics); 175 SetEntitySpecifics(entity_specifics);
176 } 176 }
177 177
178 void WriteNode::SetThemeSpecifics( 178 void WriteNode::SetThemeSpecifics(
179 const sync_pb::ThemeSpecifics& new_value) { 179 const sync_pb::ThemeSpecifics& new_value) {
180 sync_pb::EntitySpecifics entity_specifics; 180 sync_pb::EntitySpecifics entity_specifics;
181 entity_specifics.mutable_theme()->CopyFrom(new_value); 181 entity_specifics.mutable_theme()->CopyFrom(new_value);
182 SetEntitySpecifics(entity_specifics); 182 SetEntitySpecifics(entity_specifics);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 syncable::Id predecessor_id = predecessor ? 537 syncable::Id predecessor_id = predecessor ?
538 predecessor->GetEntry()->GetId() : syncable::Id(); 538 predecessor->GetEntry()->GetId() : syncable::Id();
539 return entry_->PutPredecessor(predecessor_id); 539 return entry_->PutPredecessor(predecessor_id);
540 } 540 }
541 541
542 void WriteNode::MarkForSyncing() { 542 void WriteNode::MarkForSyncing() {
543 syncable::MarkForSyncing(entry_); 543 syncable::MarkForSyncing(entry_);
544 } 544 }
545 545
546 } // namespace syncer 546 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/syncapi_internal.cc ('k') | sync/util/cryptographer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698