1 // Copyright 2013 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.
5 #include "components/password_manager/core/browser/psl_matching_helper.h"
7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "components/autofill/core/common/password_form.h"
11 #include "components/password_manager/core/common/password_manager_switches.h"
12 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
15 using autofill::PasswordForm;
17 namespace password_manager {
19 bool ShouldPSLDomainMatchingApply(
20 const std::string& registry_controlled_domain) {
21 return registry_controlled_domain != "google.com";
24 bool IsPublicSuffixDomainMatch(const std::string& url1,
25 const std::string& url2) {
29 if (!gurl1.is_valid() || !gurl2.is_valid())
32 return gurl1.scheme() == gurl2.scheme() &&
33 GetRegistryControlledDomain(gurl1) ==
34 GetRegistryControlledDomain(gurl2) &&
35 gurl1.port() == gurl2.port();
38 std::string GetRegistryControlledDomain(const GURL& signon_realm) {
39 return net::registry_controlled_domains::GetDomainAndRegistry(
41 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
44 } // namespace password_manager