Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: chrome/browser/password_manager/password_store_mac.cc

Issue 335893002: Support to remove passwords by date_synced timestamp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync integration tests Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 it != forms.end(); ++it) { 958 it != forms.end(); ++it) {
959 changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE, 959 changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE,
960 **it)); 960 **it));
961 } 961 }
962 LogStatsForBulkDeletion(changes.size()); 962 LogStatsForBulkDeletion(changes.size());
963 } 963 }
964 } 964 }
965 return changes; 965 return changes;
966 } 966 }
967 967
968 PasswordStoreChangeList PasswordStoreMac::RemoveLoginsSyncedBetweenImpl(
969 const base::Time& delete_begin, const base::Time& delete_end) {
970 PasswordStoreChangeList changes;
971 std::vector<PasswordForm*> forms;
972 if (login_metadata_db_->GetLoginsSyncedBetween(delete_begin, delete_end,
973 &forms)) {
974 if (login_metadata_db_->RemoveLoginsSyncedBetween(delete_begin,
975 delete_end)) {
976 // We can't delete from the Keychain by date because we may be sharing
977 // items with database entries that weren't in the delete range. Instead,
978 // we find all the Keychain items we own but aren't using any more and
979 // delete those.
980 std::vector<PasswordForm*> orphan_keychain_forms =
981 GetUnusedKeychainForms();
982 // This is inefficient, since we have to re-look-up each keychain item
983 // one at a time to delete it even though the search step already had a
984 // list of Keychain item references. If this turns out to be noticeably
985 // slow we'll need to rearchitect to allow the search and deletion steps
986 // to share.
987 RemoveKeychainForms(orphan_keychain_forms);
988 STLDeleteElements(&orphan_keychain_forms);
989
990 for (std::vector<PasswordForm*>::const_iterator it = forms.begin();
991 it != forms.end(); ++it) {
992 changes.push_back(PasswordStoreChange(PasswordStoreChange::REMOVE,
993 **it));
994 }
995 }
996 }
997 return changes;
998 }
999
968 void PasswordStoreMac::GetLoginsImpl( 1000 void PasswordStoreMac::GetLoginsImpl(
969 const autofill::PasswordForm& form, 1001 const autofill::PasswordForm& form,
970 AuthorizationPromptPolicy prompt_policy, 1002 AuthorizationPromptPolicy prompt_policy,
971 const ConsumerCallbackRunner& callback_runner) { 1003 const ConsumerCallbackRunner& callback_runner) {
972 chrome::ScopedSecKeychainSetUserInteractionAllowed user_interaction_allowed( 1004 chrome::ScopedSecKeychainSetUserInteractionAllowed user_interaction_allowed(
973 prompt_policy == ALLOW_PROMPT); 1005 prompt_policy == ALLOW_PROMPT);
974 1006
975 std::vector<PasswordForm*> database_forms; 1007 std::vector<PasswordForm*> database_forms;
976 login_metadata_db_->GetLogins(form, &database_forms); 1008 login_metadata_db_->GetLogins(form, &database_forms);
977 1009
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 1151
1120 void PasswordStoreMac::RemoveKeychainForms( 1152 void PasswordStoreMac::RemoveKeychainForms(
1121 const std::vector<PasswordForm*>& forms) { 1153 const std::vector<PasswordForm*>& forms) {
1122 MacKeychainPasswordFormAdapter owned_keychain_adapter(keychain_.get()); 1154 MacKeychainPasswordFormAdapter owned_keychain_adapter(keychain_.get());
1123 owned_keychain_adapter.SetFindsOnlyOwnedItems(true); 1155 owned_keychain_adapter.SetFindsOnlyOwnedItems(true);
1124 for (std::vector<PasswordForm*>::const_iterator i = forms.begin(); 1156 for (std::vector<PasswordForm*>::const_iterator i = forms.begin();
1125 i != forms.end(); ++i) { 1157 i != forms.end(); ++i) {
1126 owned_keychain_adapter.RemovePassword(**i); 1158 owned_keychain_adapter.RemovePassword(**i);
1127 } 1159 }
1128 } 1160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698