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

Unified 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: vabr's comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/password_store_mac.cc
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index c46c5d891228212a0f3ae8f4bb5ca15fa0e63928..0c006dbb333bb55478ea8b0ddc6f210ed6eae003 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -965,6 +965,40 @@ PasswordStoreChangeList PasswordStoreMac::RemoveLoginsCreatedBetweenImpl(
return changes;
}
+PasswordStoreChangeList PasswordStoreMac::RemoveLoginsSyncedBetweenImpl(
+ base::Time delete_begin,
+ base::Time delete_end) {
+ PasswordStoreChangeList changes;
+ std::vector<PasswordForm*> forms;
+ if (login_metadata_db_->GetLoginsSyncedBetween(
+ delete_begin, delete_end, &forms)) {
+ if (login_metadata_db_->RemoveLoginsSyncedBetween(delete_begin,
+ delete_end)) {
+ // We can't delete from the Keychain by date because we may be sharing
+ // items with database entries that weren't in the delete range. Instead,
+ // we find all the Keychain items we own but aren't using any more and
+ // delete those.
+ std::vector<PasswordForm*> orphan_keychain_forms =
+ GetUnusedKeychainForms();
+ // This is inefficient, since we have to re-look-up each keychain item
+ // one at a time to delete it even though the search step already had a
+ // list of Keychain item references. If this turns out to be noticeably
+ // slow we'll need to rearchitect to allow the search and deletion steps
+ // to share.
+ RemoveKeychainForms(orphan_keychain_forms);
+ STLDeleteElements(&orphan_keychain_forms);
+
+ for (std::vector<PasswordForm*>::const_iterator it = forms.begin();
+ it != forms.end();
+ ++it) {
+ changes.push_back(
+ PasswordStoreChange(PasswordStoreChange::REMOVE, **it));
+ }
+ }
+ }
+ return changes;
+}
+
void PasswordStoreMac::GetLoginsImpl(
const autofill::PasswordForm& form,
AuthorizationPromptPolicy prompt_policy,

Powered by Google App Engine
This is Rietveld 408576698