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

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

Issue 2132063002: Implement origin-based deletion for password manager's auto-signin bit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed PasswordStoreMac Created 4 years, 5 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
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 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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 &forms_to_remove) && 1189 &forms_to_remove) &&
1190 login_metadata_db_->RemoveLoginsSyncedBetween(delete_begin, delete_end)) { 1190 login_metadata_db_->RemoveLoginsSyncedBetween(delete_begin, delete_end)) {
1191 RemoveKeychainForms(forms_to_remove.get()); 1191 RemoveKeychainForms(forms_to_remove.get());
1192 CleanOrphanedForms(&forms_to_remove); // Add the orphaned forms_to_remove. 1192 CleanOrphanedForms(&forms_to_remove); // Add the orphaned forms_to_remove.
1193 changes = FormsToRemoveChangeList(forms_to_remove.get()); 1193 changes = FormsToRemoveChangeList(forms_to_remove.get());
1194 LogStatsForBulkDeletionDuringRollback(changes.size()); 1194 LogStatsForBulkDeletionDuringRollback(changes.size());
1195 } 1195 }
1196 return changes; 1196 return changes;
1197 } 1197 }
1198 1198
1199 PasswordStoreChangeList PasswordStoreMac::DisableAutoSignInForAllLoginsImpl() { 1199 PasswordStoreChangeList PasswordStoreMac::DisableAutoSignInForOriginsImpl(
1200 ScopedVector<PasswordForm> forms; 1200 const base::Callback<bool(const GURL&)>& origin_filter) {
1201 PasswordStoreChangeList list; 1201 ScopedVector<autofill::PasswordForm> forms;
1202 if (login_metadata_db_ && login_metadata_db_->GetAutoSignInLogins(&forms) && 1202 PasswordStoreChangeList changes;
1203 login_metadata_db_->DisableAutoSignInForAllLogins()) { 1203 if (!login_metadata_db_ ||
1204 for (const auto& form : forms) 1204 !login_metadata_db_->GetAutoSignInLogins(&forms)) {
1205 list.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, *form)); 1205 return changes;
1206 } 1206 }
1207 1207
1208 return list; 1208 std::set<GURL> origins_to_update;
1209 for (const auto* form : forms) {
1210 if (origin_filter.Run(form->origin))
1211 origins_to_update.insert(form->origin);
1212 }
1213
1214 std::set<GURL> origins_updated;
1215 for (const GURL& origin : origins_to_update) {
1216 if (login_metadata_db_->DisableAutoSignInForOrigin(origin))
1217 origins_updated.insert(origin);
1218 }
1219
1220 for (const auto* form : forms) {
1221 if (origins_updated.count(form->origin)) {
1222 changes.push_back(
1223 PasswordStoreChange(PasswordStoreChange::UPDATE, *form));
1224 }
1225 }
1226
1227 return changes;
1209 } 1228 }
1210 1229
1211 bool PasswordStoreMac::RemoveStatisticsCreatedBetweenImpl( 1230 bool PasswordStoreMac::RemoveStatisticsCreatedBetweenImpl(
1212 base::Time delete_begin, 1231 base::Time delete_begin,
1213 base::Time delete_end) { 1232 base::Time delete_end) {
1214 return login_metadata_db_ && 1233 return login_metadata_db_ &&
1215 login_metadata_db_->stats_table().RemoveStatsBetween(delete_begin, 1234 login_metadata_db_->stats_table().RemoveStatsBetween(delete_begin,
1216 delete_end); 1235 delete_end);
1217 } 1236 }
1218 1237
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 ScopedVector<PasswordForm> forms_with_keychain_entry; 1396 ScopedVector<PasswordForm> forms_with_keychain_entry;
1378 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms, 1397 internal_keychain_helpers::GetPasswordsForForms(*keychain_, &database_forms,
1379 &forms_with_keychain_entry); 1398 &forms_with_keychain_entry);
1380 1399
1381 // Clean up any orphaned database entries. 1400 // Clean up any orphaned database entries.
1382 RemoveDatabaseForms(&database_forms); 1401 RemoveDatabaseForms(&database_forms);
1383 1402
1384 // Move the orphaned DB forms to the output parameter. 1403 // Move the orphaned DB forms to the output parameter.
1385 AppendSecondToFirst(orphaned_forms, &database_forms); 1404 AppendSecondToFirst(orphaned_forms, &database_forms);
1386 } 1405 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698