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 #include "chrome/browser/password_manager/password_store_mac_internal.h" | 6 #include "chrome/browser/password_manager/password_store_mac_internal.h" |
7 | 7 |
8 #include <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 } | 1180 } |
1181 | 1181 |
1182 // Let's gather all signon realms we want to match with keychain entries. | 1182 // Let's gather all signon realms we want to match with keychain entries. |
1183 std::set<std::string> realm_set; | 1183 std::set<std::string> realm_set; |
1184 realm_set.insert(form.signon_realm); | 1184 realm_set.insert(form.signon_realm); |
1185 for (const autofill::PasswordForm* db_form : database_forms) { | 1185 for (const autofill::PasswordForm* db_form : database_forms) { |
1186 // TODO(vabr): We should not be getting different schemes here. | 1186 // TODO(vabr): We should not be getting different schemes here. |
1187 // http://crbug.com/340112 | 1187 // http://crbug.com/340112 |
1188 if (form.scheme != db_form->scheme) | 1188 if (form.scheme != db_form->scheme) |
1189 continue; // Forms with different schemes never match. | 1189 continue; // Forms with different schemes never match. |
1190 if (db_form->is_public_suffix_match) | 1190 if (db_form->is_public_suffix_match || db_form->is_affiliation_based_match) |
1191 realm_set.insert(db_form->signon_realm); | 1191 realm_set.insert(db_form->signon_realm); |
1192 } | 1192 } |
1193 ScopedVector<autofill::PasswordForm> keychain_forms; | 1193 ScopedVector<autofill::PasswordForm> keychain_forms; |
1194 for (std::set<std::string>::const_iterator realm = realm_set.begin(); | 1194 for (std::set<std::string>::const_iterator realm = realm_set.begin(); |
1195 realm != realm_set.end(); ++realm) { | 1195 realm != realm_set.end(); ++realm) { |
1196 MacKeychainPasswordFormAdapter keychain_adapter(keychain_.get()); | 1196 MacKeychainPasswordFormAdapter keychain_adapter(keychain_.get()); |
1197 ScopedVector<autofill::PasswordForm> temp_keychain_forms = | 1197 ScopedVector<autofill::PasswordForm> temp_keychain_forms = |
1198 keychain_adapter.PasswordsFillingForm(*realm, form.scheme); | 1198 keychain_adapter.PasswordsFillingForm(*realm, form.scheme); |
1199 AppendSecondToFirst(&keychain_forms, &temp_keychain_forms); | 1199 AppendSecondToFirst(&keychain_forms, &temp_keychain_forms); |
1200 } | 1200 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 ScopedVector<PasswordForm> forms_with_keychain_entry; | 1328 ScopedVector<PasswordForm> forms_with_keychain_entry; |
1329 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, | 1329 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, |
1330 &forms_with_keychain_entry); | 1330 &forms_with_keychain_entry); |
1331 | 1331 |
1332 // Clean up any orphaned database entries. | 1332 // Clean up any orphaned database entries. |
1333 RemoveDatabaseForms(&database_forms); | 1333 RemoveDatabaseForms(&database_forms); |
1334 | 1334 |
1335 // Move the orphaned DB forms to the output parameter. | 1335 // Move the orphaned DB forms to the output parameter. |
1336 AppendSecondToFirst(orphaned_forms, &database_forms); | 1336 AppendSecondToFirst(orphaned_forms, &database_forms); |
1337 } | 1337 } |
OLD | NEW |