| 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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_vector.h" | |
| 15 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 16 #include "components/password_manager/core/browser/login_database.h" | 15 #include "components/password_manager/core/browser/login_database.h" |
| 17 #include "components/password_manager/core/browser/password_store.h" | 16 #include "components/password_manager/core/browser/password_store.h" |
| 18 | 17 |
| 19 namespace crypto { | 18 namespace crypto { |
| 20 class AppleKeychain; | 19 class AppleKeychain; |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace password_manager { | 22 namespace password_manager { |
| 24 class LoginDatabase; | 23 class LoginDatabase; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // to). | 120 // to). |
| 122 bool AddToKeychainIfNecessary(const autofill::PasswordForm& form); | 121 bool AddToKeychainIfNecessary(const autofill::PasswordForm& form); |
| 123 | 122 |
| 124 // Returns true if our database contains a form that exactly matches the given | 123 // Returns true if our database contains a form that exactly matches the given |
| 125 // keychain form. | 124 // keychain form. |
| 126 bool DatabaseHasFormMatchingKeychainForm( | 125 bool DatabaseHasFormMatchingKeychainForm( |
| 127 const autofill::PasswordForm& form); | 126 const autofill::PasswordForm& form); |
| 128 | 127 |
| 129 // Removes the given forms from the database. After the call |forms| contains | 128 // Removes the given forms from the database. After the call |forms| contains |
| 130 // only those forms which were successfully removed. | 129 // only those forms which were successfully removed. |
| 131 void RemoveDatabaseForms(ScopedVector<autofill::PasswordForm>* forms); | 130 void RemoveDatabaseForms( |
| 131 std::vector<std::unique_ptr<autofill::PasswordForm>>* forms); |
| 132 | 132 |
| 133 // Removes the given forms from the Keychain. | 133 // Removes the given forms from the Keychain. |
| 134 void RemoveKeychainForms( | 134 void RemoveKeychainForms( |
| 135 const std::vector<autofill::PasswordForm*>& forms); | 135 const std::vector<std::unique_ptr<autofill::PasswordForm>>& forms); |
| 136 | 136 |
| 137 // Searches the database for forms without a corresponding entry in the | 137 // Searches the database for forms without a corresponding entry in the |
| 138 // keychain. Removes those forms from the database, and adds them to | 138 // keychain. Removes those forms from the database, and adds them to |
| 139 // |orphaned_forms|. | 139 // |orphaned_forms|. |
| 140 void CleanOrphanedForms(ScopedVector<autofill::PasswordForm>* orphaned_forms); | 140 void CleanOrphanedForms( |
| 141 std::vector<std::unique_ptr<autofill::PasswordForm>>* orphaned_forms); |
| 141 | 142 |
| 142 std::unique_ptr<crypto::AppleKeychain> keychain_; | 143 std::unique_ptr<crypto::AppleKeychain> keychain_; |
| 143 | 144 |
| 144 // The login metadata SQL database. The caller is resonsible for initializing | 145 // The login metadata SQL database. The caller is resonsible for initializing |
| 145 // it. | 146 // it. |
| 146 password_manager::LoginDatabase* login_metadata_db_; | 147 password_manager::LoginDatabase* login_metadata_db_; |
| 147 | 148 |
| 148 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac); | 149 DISALLOW_COPY_AND_ASSIGN(PasswordStoreMac); |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ | 152 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_MAC_H_ |
| OLD | NEW |