Index: components/password_manager/core/browser/password_store_default.cc |
diff --git a/components/password_manager/core/browser/password_store_default.cc b/components/password_manager/core/browser/password_store_default.cc |
index 79cae2a78be01cd160f1c0522dbb9c270e5c0b6a..1a7b647eb6ede6b6bc4c22a841f33777a0c0249a 100644 |
--- a/components/password_manager/core/browser/password_store_default.cc |
+++ b/components/password_manager/core/browser/password_store_default.cc |
@@ -135,18 +135,32 @@ PasswordStoreChangeList PasswordStoreDefault::RemoveLoginsSyncedBetweenImpl( |
return changes; |
} |
-PasswordStoreChangeList |
-PasswordStoreDefault::DisableAutoSignInForAllLoginsImpl() { |
+PasswordStoreChangeList PasswordStoreDefault::DisableAutoSignInForOriginsImpl( |
+ const base::Callback<bool(const GURL&)>& origin_filter) { |
ScopedVector<autofill::PasswordForm> forms; |
PasswordStoreChangeList changes; |
- if (login_db_ && login_db_->GetAutoSignInLogins(&forms)) { |
- if (login_db_->DisableAutoSignInForAllLogins()) { |
- for (const auto* form : forms) { |
- changes.push_back( |
- PasswordStoreChange(PasswordStoreChange::UPDATE, *form)); |
- } |
+ if (!login_db_ || !login_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); |
+ } |
+ |
+ std::set<GURL> origins_updated; |
+ for (const GURL& origin : origins_to_update) { |
+ if (login_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; |
} |