| 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/internal_api/public/base_node.h" | 5 #include "sync/internal_api/public/base_node.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <stack> | 9 #include <stack> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 BaseNode::~BaseNode() {} | 50 BaseNode::~BaseNode() {} |
| 51 | 51 |
| 52 bool BaseNode::DecryptIfNecessary() { | 52 bool BaseNode::DecryptIfNecessary() { |
| 53 if (GetIsPermanentFolder()) | 53 if (GetIsPermanentFolder()) |
| 54 return true; // Ignore unique folders. | 54 return true; // Ignore unique folders. |
| 55 const sync_pb::EntitySpecifics& specifics = | 55 const sync_pb::EntitySpecifics& specifics = |
| 56 GetEntry()->GetSpecifics(); | 56 GetEntry()->GetSpecifics(); |
| 57 if (specifics.has_password()) { | 57 if (specifics.has_password()) { |
| 58 // Passwords have their own legacy encryption structure. | 58 // Passwords have their own legacy encryption structure. |
| 59 scoped_ptr<sync_pb::PasswordSpecificsData> data(DecryptPasswordSpecifics( | 59 std::unique_ptr<sync_pb::PasswordSpecificsData> data( |
| 60 specifics, GetTransaction()->GetCryptographer())); | 60 DecryptPasswordSpecifics(specifics, |
| 61 GetTransaction()->GetCryptographer())); |
| 61 if (!data) { | 62 if (!data) { |
| 62 GetTransaction()->GetWrappedTrans()->OnUnrecoverableError( | 63 GetTransaction()->GetWrappedTrans()->OnUnrecoverableError( |
| 63 FROM_HERE, std::string("Failed to decrypt encrypted node of type ") + | 64 FROM_HERE, std::string("Failed to decrypt encrypted node of type ") + |
| 64 ModelTypeToString(GetModelType())); | 65 ModelTypeToString(GetModelType())); |
| 65 return false; | 66 return false; |
| 66 } | 67 } |
| 67 password_data_.swap(data); | 68 password_data_.swap(data); |
| 68 return true; | 69 return true; |
| 69 } | 70 } |
| 70 | 71 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 const sync_pb::EntitySpecifics& specifics) { | 281 const sync_pb::EntitySpecifics& specifics) { |
| 281 ModelType type = GetModelTypeFromSpecifics(specifics); | 282 ModelType type = GetModelTypeFromSpecifics(specifics); |
| 282 DCHECK_NE(UNSPECIFIED, type); | 283 DCHECK_NE(UNSPECIFIED, type); |
| 283 if (GetModelType() != UNSPECIFIED) { | 284 if (GetModelType() != UNSPECIFIED) { |
| 284 DCHECK_EQ(GetModelType(), type); | 285 DCHECK_EQ(GetModelType(), type); |
| 285 } | 286 } |
| 286 unencrypted_data_.CopyFrom(specifics); | 287 unencrypted_data_.CopyFrom(specifics); |
| 287 } | 288 } |
| 288 | 289 |
| 289 } // namespace syncer | 290 } // namespace syncer |
| OLD | NEW |