OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ | 5 #ifndef COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
6 #define COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ | 6 #define COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 // absence of the single-label prefix "www". E.g.: (The first domain | 56 // absence of the single-label prefix "www". E.g.: (The first domain |
57 // is hostname and the second domain is a DNS name in the certificate) | 57 // is hostname and the second domain is a DNS name in the certificate) |
58 // www.example.com ~ example.com -> true | 58 // www.example.com ~ example.com -> true |
59 // example.com ~ www.example.com -> true | 59 // example.com ~ www.example.com -> true |
60 // www.food.example.com ~ example.com -> false | 60 // www.food.example.com ~ example.com -> false |
61 // mail.example.com ~ example.com -> false | 61 // mail.example.com ~ example.com -> false |
62 bool GetWWWSubDomainMatch(const GURL& request_url, | 62 bool GetWWWSubDomainMatch(const GURL& request_url, |
63 const std::vector<std::string>& dns_names, | 63 const std::vector<std::string>& dns_names, |
64 std::string* www_match_host_name); | 64 std::string* www_match_host_name); |
65 | 65 |
66 // Exposed for testing. | |
67 size_t GetLevenshteinDistance(const std::string& str1, const std::string& str2); | |
felt
2016/02/11 00:10:42
Could you move this into the "helper methods" sect
| |
68 | |
66 // Method for recording results. ----------------------------------------------- | 69 // Method for recording results. ----------------------------------------------- |
67 | 70 |
68 void RecordUMAStatistics(bool overridable, | 71 void RecordUMAStatistics(bool overridable, |
69 const base::Time& current_time, | 72 const base::Time& current_time, |
70 const GURL& request_url, | 73 const GURL& request_url, |
71 int cert_error, | 74 int cert_error, |
72 const net::X509Certificate& cert); | 75 const net::X509Certificate& cert); |
73 | 76 |
74 // Helper methods for classification. ------------------------------------------ | 77 // Helper methods for classification. ------------------------------------------ |
75 | 78 |
(...skipping 20 matching lines...) Expand all Loading... | |
96 // Returns true if any of the |potential_children| is a subdomain of the | 99 // Returns true if any of the |potential_children| is a subdomain of the |
97 // |parent|. The inverse case should be treated carefully as this is most | 100 // |parent|. The inverse case should be treated carefully as this is most |
98 // likely a MITM attack. We don't want foo.appspot.com to be able to MITM for | 101 // likely a MITM attack. We don't want foo.appspot.com to be able to MITM for |
99 // appspot.com. | 102 // appspot.com. |
100 bool AnyNamesUnderName(const std::vector<HostnameTokens>& potential_children, | 103 bool AnyNamesUnderName(const std::vector<HostnameTokens>& potential_children, |
101 const HostnameTokens& parent); | 104 const HostnameTokens& parent); |
102 | 105 |
103 } // namespace ssl_errors | 106 } // namespace ssl_errors |
104 | 107 |
105 #endif // COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ | 108 #endif // COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
OLD | NEW |