| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/password_manager/core/browser/login_database.h" | 5 #include "components/password_manager/core/browser/login_database.h" |
| 6 | 6 |
| 7 // On the Mac, the LoginDatabase nulls out passwords, so that we can use the | 7 #include "components/os_crypt/os_crypt.h" |
| 8 // rest of the database as a suplemental storage system to complement Keychain, | |
| 9 // providing storage of fields Keychain doesn't allow. | |
| 10 | 8 |
| 11 namespace password_manager { | 9 namespace password_manager { |
| 12 | 10 |
| 13 // static | 11 // static |
| 14 LoginDatabase::EncryptionResult LoginDatabase::EncryptedString( | 12 LoginDatabase::EncryptionResult LoginDatabase::EncryptedString( |
| 15 const base::string16& plain_text, | 13 const base::string16& plain_text, |
| 16 std::string* cipher_text) { | 14 std::string* cipher_text) { |
| 17 *cipher_text = std::string(); | 15 return OSCrypt::EncryptString16(plain_text, cipher_text) |
| 18 return ENCRYPTION_RESULT_SUCCESS; | 16 ? ENCRYPTION_RESULT_SUCCESS |
| 17 : ENCRYPTION_RESULT_SERVICE_FAILURE; |
| 19 } | 18 } |
| 20 | 19 |
| 21 // static | 20 // static |
| 22 LoginDatabase::EncryptionResult LoginDatabase::DecryptedString( | 21 LoginDatabase::EncryptionResult LoginDatabase::DecryptedString( |
| 23 const std::string& cipher_text, | 22 const std::string& cipher_text, |
| 24 base::string16* plain_text) { | 23 base::string16* plain_text) { |
| 25 *plain_text = base::string16(); | 24 return OSCrypt::DecryptString16(cipher_text, plain_text) |
| 26 return ENCRYPTION_RESULT_SUCCESS; | 25 ? ENCRYPTION_RESULT_SUCCESS |
| 26 : ENCRYPTION_RESULT_SERVICE_FAILURE; |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace password_manager | 29 } // namespace password_manager |
| OLD | NEW |