| 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 "chrome/browser/password_manager/password_store_mac.h" | 5 #include "chrome/browser/password_manager/password_store_mac.h" |
| 6 | 6 |
| 7 #include <CoreServices/CoreServices.h> | 7 #include <CoreServices/CoreServices.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 | 1229 |
| 1230 bool PasswordStoreMac::RemoveStatisticsCreatedBetweenImpl( | 1230 bool PasswordStoreMac::RemoveStatisticsCreatedBetweenImpl( |
| 1231 base::Time delete_begin, | 1231 base::Time delete_begin, |
| 1232 base::Time delete_end) { | 1232 base::Time delete_end) { |
| 1233 return login_metadata_db_ && | 1233 return login_metadata_db_ && |
| 1234 login_metadata_db_->stats_table().RemoveStatsBetween(delete_begin, | 1234 login_metadata_db_->stats_table().RemoveStatsBetween(delete_begin, |
| 1235 delete_end); | 1235 delete_end); |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 ScopedVector<autofill::PasswordForm> PasswordStoreMac::FillMatchingLogins( | 1238 ScopedVector<autofill::PasswordForm> PasswordStoreMac::FillMatchingLogins( |
| 1239 const autofill::PasswordForm& form) { | 1239 const FormDigest& form) { |
| 1240 chrome::ScopedSecKeychainSetUserInteractionAllowed user_interaction_allowed( | 1240 chrome::ScopedSecKeychainSetUserInteractionAllowed user_interaction_allowed( |
| 1241 false); | 1241 false); |
| 1242 | 1242 |
| 1243 ScopedVector<PasswordForm> database_forms; | 1243 ScopedVector<PasswordForm> database_forms; |
| 1244 if (!login_metadata_db_ || | 1244 if (!login_metadata_db_ || |
| 1245 !login_metadata_db_->GetLogins(form, &database_forms)) { | 1245 !login_metadata_db_->GetLogins(form, &database_forms)) { |
| 1246 return ScopedVector<autofill::PasswordForm>(); | 1246 return ScopedVector<autofill::PasswordForm>(); |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 // Let's gather all signon realms we want to match with keychain entries. | 1249 // Let's gather all signon realms we want to match with keychain entries. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 return true; | 1338 return true; |
| 1339 MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get()); | 1339 MacKeychainPasswordFormAdapter keychainAdapter(keychain_.get()); |
| 1340 return keychainAdapter.AddPassword(form); | 1340 return keychainAdapter.AddPassword(form); |
| 1341 } | 1341 } |
| 1342 | 1342 |
| 1343 bool PasswordStoreMac::DatabaseHasFormMatchingKeychainForm( | 1343 bool PasswordStoreMac::DatabaseHasFormMatchingKeychainForm( |
| 1344 const autofill::PasswordForm& form) { | 1344 const autofill::PasswordForm& form) { |
| 1345 DCHECK(login_metadata_db_); | 1345 DCHECK(login_metadata_db_); |
| 1346 bool has_match = false; | 1346 bool has_match = false; |
| 1347 ScopedVector<autofill::PasswordForm> database_forms; | 1347 ScopedVector<autofill::PasswordForm> database_forms; |
| 1348 if (!login_metadata_db_->GetLogins(form, &database_forms)) | 1348 if (!login_metadata_db_->GetLogins( |
| 1349 password_manager::PasswordStore::FormDigest(form), &database_forms)) |
| 1349 return false; | 1350 return false; |
| 1350 for (const autofill::PasswordForm* db_form : database_forms) { | 1351 for (const autofill::PasswordForm* db_form : database_forms) { |
| 1351 // Below we filter out fuzzy matched forms because we are only interested | 1352 // Below we filter out fuzzy matched forms because we are only interested |
| 1352 // in exact ones. | 1353 // in exact ones. |
| 1353 if (!db_form->is_public_suffix_match && | 1354 if (!db_form->is_public_suffix_match && |
| 1354 internal_keychain_helpers::FormsMatchForMerge( | 1355 internal_keychain_helpers::FormsMatchForMerge( |
| 1355 form, *db_form, internal_keychain_helpers::STRICT_FORM_MATCH) && | 1356 form, *db_form, internal_keychain_helpers::STRICT_FORM_MATCH) && |
| 1356 db_form->origin == form.origin) { | 1357 db_form->origin == form.origin) { |
| 1357 has_match = true; | 1358 has_match = true; |
| 1358 break; | 1359 break; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 ScopedVector<PasswordForm> forms_with_keychain_entry; | 1397 ScopedVector<PasswordForm> forms_with_keychain_entry; |
| 1397 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, | 1398 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, |
| 1398 &forms_with_keychain_entry); | 1399 &forms_with_keychain_entry); |
| 1399 | 1400 |
| 1400 // Clean up any orphaned database entries. | 1401 // Clean up any orphaned database entries. |
| 1401 RemoveDatabaseForms(&database_forms); | 1402 RemoveDatabaseForms(&database_forms); |
| 1402 | 1403 |
| 1403 // Move the orphaned DB forms to the output parameter. | 1404 // Move the orphaned DB forms to the output parameter. |
| 1404 AppendSecondToFirst(orphaned_forms, &database_forms); | 1405 AppendSecondToFirst(orphaned_forms, &database_forms); |
| 1405 } | 1406 } |
| OLD | NEW |