| 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_SSL_ERROR_INFO_H_ | 5 #ifndef COMPONENTS_SSL_ERRORS_SSL_ERROR_INFO_H_ |
| 6 #define COMPONENTS_SSL_ERRORS_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/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "net/cert/cert_status_flags.h" | 13 #include "net/cert/cert_status_flags.h" |
| 14 #include "net/cert/x509_certificate.h" | 14 #include "net/cert/x509_certificate.h" |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 | 17 |
| 18 namespace ssl_errors { | 18 namespace ssl_errors { |
| 19 | 19 |
| 20 // This class describes an error that happened while showing a page over SSL. | 20 // This class describes an error that happened while showing a page over SSL. |
| 21 // An ErrorInfo object only exists on the UI thread and only contains | 21 // An ErrorInfo object only exists on the UI thread and only contains |
| 22 // information about an error (type of error and text details). | 22 // information about an error (type of error and text details). |
| 23 // Note no DISALLOW_COPY_AND_ASSIGN as we want the copy constructor. | 23 // Note no DISALLOW_COPY_AND_ASSIGN as we want the copy constructor. |
| 24 class ErrorInfo { | 24 class ErrorInfo { |
| 25 public: | 25 public: |
| 26 // This enum is being histogrammed; please only add new values at the end. | 26 // This enum is being histogrammed; please only add new values at the end. |
| 27 enum ErrorType { | 27 enum ErrorType { |
| 28 CERT_COMMON_NAME_INVALID = 0, | 28 CERT_COMMON_NAME_INVALID = 0, |
| 29 CERT_DATE_INVALID, | 29 CERT_DATE_INVALID = 1, |
| 30 CERT_AUTHORITY_INVALID, | 30 CERT_AUTHORITY_INVALID = 2, |
| 31 CERT_CONTAINS_ERRORS, | 31 CERT_CONTAINS_ERRORS = 3, |
| 32 CERT_NO_REVOCATION_MECHANISM, | 32 CERT_NO_REVOCATION_MECHANISM = 4, |
| 33 CERT_UNABLE_TO_CHECK_REVOCATION, | 33 CERT_UNABLE_TO_CHECK_REVOCATION = 5, |
| 34 CERT_REVOKED, | 34 CERT_REVOKED = 6, |
| 35 CERT_INVALID, | 35 CERT_INVALID = 7, |
| 36 CERT_WEAK_SIGNATURE_ALGORITHM, | 36 CERT_WEAK_SIGNATURE_ALGORITHM = 8, |
| 37 CERT_WEAK_KEY, | 37 CERT_WEAK_KEY = 9, |
| 38 CERT_NAME_CONSTRAINT_VIOLATION, | 38 CERT_NAME_CONSTRAINT_VIOLATION = 10, |
| 39 UNKNOWN, | 39 UNKNOWN = 11, |
| 40 CERT_WEAK_KEY_DH, | 40 // CERT_WEAK_KEY_DH = 12, |
| 41 CERT_PINNED_KEY_MISSING, | 41 CERT_PINNED_KEY_MISSING = 13, |
| 42 CERT_VALIDITY_TOO_LONG, | 42 CERT_VALIDITY_TOO_LONG = 14, |
| 43 END_OF_ENUM | 43 END_OF_ENUM |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 virtual ~ErrorInfo(); | 46 virtual ~ErrorInfo(); |
| 47 | 47 |
| 48 // Converts a network error code to an ErrorType. | 48 // Converts a network error code to an ErrorType. |
| 49 static ErrorType NetErrorToErrorType(int net_error); | 49 static ErrorType NetErrorToErrorType(int net_error); |
| 50 | 50 |
| 51 static ErrorInfo CreateError(ErrorType error_type, | 51 static ErrorInfo CreateError(ErrorType error_type, |
| 52 net::X509Certificate* cert, | 52 net::X509Certificate* cert, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 71 ErrorInfo(const base::string16& details, | 71 ErrorInfo(const base::string16& details, |
| 72 const base::string16& short_description); | 72 const base::string16& short_description); |
| 73 | 73 |
| 74 base::string16 details_; | 74 base::string16 details_; |
| 75 base::string16 short_description_; | 75 base::string16 short_description_; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 } // namespace ssl_errors | 78 } // namespace ssl_errors |
| 79 | 79 |
| 80 #endif // COMPONENTS_SSL_ERRORS_SSL_ERROR_INFO_H_ | 80 #endif // COMPONENTS_SSL_ERRORS_SSL_ERROR_INFO_H_ |
| OLD | NEW |