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 fb82842ddcb1241f40a1abbf3b8419c4db70ac38..b39fdef8597f972103f34f01736cd4b55299ea88 100644 |
--- a/chrome/browser/password_manager/password_store_mac.cc |
+++ b/chrome/browser/password_manager/password_store_mac.cc |
@@ -1196,16 +1196,35 @@ PasswordStoreChangeList PasswordStoreMac::RemoveLoginsSyncedBetweenImpl( |
return changes; |
} |
-PasswordStoreChangeList PasswordStoreMac::DisableAutoSignInForAllLoginsImpl() { |
- ScopedVector<PasswordForm> forms; |
- PasswordStoreChangeList list; |
- if (login_metadata_db_ && login_metadata_db_->GetAutoSignInLogins(&forms) && |
- login_metadata_db_->DisableAutoSignInForAllLogins()) { |
- for (const auto& form : forms) |
- list.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, *form)); |
+PasswordStoreChangeList PasswordStoreMac::DisableAutoSignInForOriginsImpl( |
+ const base::Callback<bool(const GURL&)>& origin_filter) { |
+ ScopedVector<autofill::PasswordForm> forms; |
+ PasswordStoreChangeList changes; |
+ if (!login_metadata_db_ || |
+ !login_metadata_db_->GetAutoSignInLogins(&forms)) { |
+ return changes; |
+ } |
+ |
+ std::set<GURL> origins_to_update; |
+ for (const auto* form : forms) { |
+ if (origin_filter.Run(form->origin)) |
+ origins_to_update.insert(form->origin); |
} |
- return list; |
+ std::set<GURL> origins_updated; |
+ for (const GURL& origin : origins_to_update) { |
+ if (login_metadata_db_->DisableAutoSignInForOrigin(origin)) |
+ origins_updated.insert(origin); |
+ } |
+ |
+ for (const auto* form : forms) { |
+ if (origins_updated.count(form->origin)) { |
+ changes.push_back( |
+ PasswordStoreChange(PasswordStoreChange::UPDATE, *form)); |
+ } |
+ } |
+ |
+ return changes; |
} |
bool PasswordStoreMac::RemoveStatisticsCreatedBetweenImpl( |