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

Side by Side Diff: components/password_manager/core/browser/suppressed_https_form_fetcher.cc

Issue 2912783002: Measure how often PSL and same-organization name credentials are suppressed. (Closed)
Patch Set: Addressed comments from kolos@. Created 3 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 unified diff | Download patch
OLDNEW
(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_https_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 SuppressedHTTPSFormFetcher::SuppressedHTTPSFormFetcher(
16 const std::string& observed_signon_realm,
17 const PasswordManagerClient* client,
18 Consumer* consumer)
19 : client_(client),
20 consumer_(consumer),
21 observed_signon_realm_as_url_(observed_signon_realm) {
22 DCHECK(client_);
23 DCHECK(consumer_);
24 DCHECK(observed_signon_realm_as_url_.SchemeIs(url::kHttpScheme));
25 client_->GetPasswordStore()->GetLoginsForSameOrganizationName(
26 observed_signon_realm, this);
27 }
28
29 SuppressedHTTPSFormFetcher::~SuppressedHTTPSFormFetcher() = default;
30
31 void SuppressedHTTPSFormFetcher::OnGetPasswordStoreResults(
32 std::vector<std::unique_ptr<autofill::PasswordForm>> results) {
33 base::EraseIf(
34 results, [this](const std::unique_ptr<autofill::PasswordForm>& form) {
35 GURL candidate_signon_realm_as_url(form->signon_realm);
36 return !candidate_signon_realm_as_url.SchemeIs(url::kHttpsScheme) ||
37 candidate_signon_realm_as_url.host() !=
38 observed_signon_realm_as_url_.host();
39 });
40
41 consumer_->ProcessSuppressedHTTPSForms(std::move(results));
42 }
43
44 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698