OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/password_manager/core/browser/suppressed_form_fetcher.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" |
| 9 #include "components/password_manager/core/browser/password_manager_client.h" |
| 10 #include "components/password_manager/core/browser/password_store.h" |
| 11 #include "url/gurl.h" |
| 12 |
| 13 namespace password_manager { |
| 14 |
| 15 SuppressedFormFetcher::SuppressedFormFetcher( |
| 16 const std::string& observed_signon_realm, |
| 17 const PasswordManagerClient* client, |
| 18 Consumer* consumer) |
| 19 : client_(client), |
| 20 consumer_(consumer), |
| 21 observed_signon_realm_(observed_signon_realm) { |
| 22 DCHECK(client_); |
| 23 DCHECK(consumer_); |
| 24 DCHECK(GURL(observed_signon_realm_).SchemeIsHTTPOrHTTPS()); |
| 25 client_->GetPasswordStore()->GetLoginsForSameOrganizationName( |
| 26 observed_signon_realm_, this); |
| 27 } |
| 28 |
| 29 SuppressedFormFetcher::~SuppressedFormFetcher() = default; |
| 30 |
| 31 void SuppressedFormFetcher::OnGetPasswordStoreResults( |
| 32 std::vector<std::unique_ptr<autofill::PasswordForm>> results) { |
| 33 base::EraseIf(results, |
| 34 [this](const std::unique_ptr<autofill::PasswordForm>& form) { |
| 35 return form->signon_realm == observed_signon_realm_; |
| 36 }); |
| 37 |
| 38 consumer_->ProcessSuppressedForms(std::move(results)); |
| 39 } |
| 40 |
| 41 } // namespace password_manager |
OLD | NEW |