OLD | NEW |
---|---|
1 // Copyright (c) 2011 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 CHROME_BROWSER_SSL_SSL_ERROR_INFO_H_ | 5 #ifndef COMPONENTS_SSL_ERRORS_SSL_ERROR_INFO_H_ |
6 #define CHROME_BROWSER_SSL_SSL_ERROR_INFO_H_ | 6 #define COMPONENTS_SSL_ERRORS_SSL_ERROR_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "net/cert/cert_status_flags.h" | 12 #include "net/cert/cert_status_flags.h" |
13 #include "net/cert/x509_certificate.h" | 13 #include "net/cert/x509_certificate.h" |
14 | 14 |
15 class GURL; | 15 class GURL; |
16 | 16 |
17 namespace ssl_errors { | |
18 | |
17 // This class describes an error that happened while showing a page over SSL. | 19 // This class describes an error that happened while showing a page over SSL. |
18 // An SSLErrorInfo object only exists on the UI thread and only contains | 20 // An SSLErrorInfo object only exists on the UI thread and only contains |
19 // information about an error (type of error and text details). | 21 // information about an error (type of error and text details). |
20 // Note no DISALLOW_COPY_AND_ASSIGN as we want the copy constructor. | 22 // Note no DISALLOW_COPY_AND_ASSIGN as we want the copy constructor. |
21 class SSLErrorInfo { | 23 class SSLErrorInfo { |
estark
2015/09/15 22:37:28
Similar to what we did with cert reporting, did yo
felt
2015/09/16 14:41:53
When we had that last discussion, Colin advocated
estark
2015/09/16 15:01:07
Seems reasonable. I would personally find ssl_erro
felt
2015/09/16 20:28:07
since blundell doesn't mind, I've updated it to be
| |
22 public: | 24 public: |
23 // This enum is being histogrammed; please only add new values at the end. | 25 // This enum is being histogrammed; please only add new values at the end. |
24 enum ErrorType { | 26 enum ErrorType { |
25 CERT_COMMON_NAME_INVALID = 0, | 27 CERT_COMMON_NAME_INVALID = 0, |
26 CERT_DATE_INVALID, | 28 CERT_DATE_INVALID, |
27 CERT_AUTHORITY_INVALID, | 29 CERT_AUTHORITY_INVALID, |
28 CERT_CONTAINS_ERRORS, | 30 CERT_CONTAINS_ERRORS, |
29 CERT_NO_REVOCATION_MECHANISM, | 31 CERT_NO_REVOCATION_MECHANISM, |
30 CERT_UNABLE_TO_CHECK_REVOCATION, | 32 CERT_UNABLE_TO_CHECK_REVOCATION, |
31 CERT_REVOKED, | 33 CERT_REVOKED, |
(...skipping 14 matching lines...) Expand all Loading... | |
46 static ErrorType NetErrorToErrorType(int net_error); | 48 static ErrorType NetErrorToErrorType(int net_error); |
47 | 49 |
48 static SSLErrorInfo CreateError(ErrorType error_type, | 50 static SSLErrorInfo CreateError(ErrorType error_type, |
49 net::X509Certificate* cert, | 51 net::X509Certificate* cert, |
50 const GURL& request_url); | 52 const GURL& request_url); |
51 | 53 |
52 // Populates the specified |errors| vector with the errors contained in | 54 // Populates the specified |errors| vector with the errors contained in |
53 // |cert_status|. Returns the number of errors found. | 55 // |cert_status|. Returns the number of errors found. |
54 // Callers only interested in the error count can pass NULL for |errors|. | 56 // Callers only interested in the error count can pass NULL for |errors|. |
55 // TODO(wtc): Document |cert_id| and |url| arguments. | 57 // TODO(wtc): Document |cert_id| and |url| arguments. |
56 static void GetErrorsForCertStatus(int cert_id, | 58 static void GetErrorsForCertStatus( |
estark
2015/09/15 22:37:28
While you're here, you could document the |cert| p
felt
2015/09/16 14:41:53
Done.
| |
57 net::CertStatus cert_status, | 59 const scoped_refptr<net::X509Certificate> cert, |
Ryan Sleevi
2015/09/16 00:21:08
This should either be const-ref (ideal if you don'
felt
2015/09/16 14:41:53
Done.
| |
58 const GURL& url, | 60 net::CertStatus cert_status, |
59 std::vector<SSLErrorInfo>* errors); | 61 const GURL& url, |
62 std::vector<SSLErrorInfo>* errors); | |
60 | 63 |
61 // A description of the error. | 64 // A description of the error. |
62 const base::string16& details() const { return details_; } | 65 const base::string16& details() const { return details_; } |
63 | 66 |
64 // A short message describing the error (1 line). | 67 // A short message describing the error (1 line). |
65 const base::string16& short_description() const { return short_description_; } | 68 const base::string16& short_description() const { return short_description_; } |
66 | 69 |
67 private: | 70 private: |
68 SSLErrorInfo(const base::string16& details, | 71 SSLErrorInfo(const base::string16& details, |
69 const base::string16& short_description); | 72 const base::string16& short_description); |
70 | 73 |
71 base::string16 details_; | 74 base::string16 details_; |
72 base::string16 short_description_; | 75 base::string16 short_description_; |
73 }; | 76 }; |
74 | 77 |
75 #endif // CHROME_BROWSER_SSL_SSL_ERROR_INFO_H_ | 78 } // namespace ssl_errors |
79 | |
80 #endif // COMPONENTS_SSL_ERRORS_SSL_ERROR_INFO_H_ | |
OLD | NEW |