OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_SSL_SSL_ERROR_INFO_H_ |
6 #define CHROME_BROWSER_SSL_SSL_ERROR_INFO_H_ | 6 #define CHROME_BROWSER_SSL_SSL_ERROR_INFO_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "net/base/cert_status_flags.h" | |
14 #include "net/base/x509_certificate.h" | 13 #include "net/base/x509_certificate.h" |
15 | 14 |
16 class GURL; | 15 class GURL; |
17 | 16 |
18 // This class describes an error that happened while showing a page over SSL. | 17 // This class describes an error that happened while showing a page over SSL. |
19 // An SSLErrorInfo object only exists on the UI thread and only contains | 18 // An SSLErrorInfo object only exists on the UI thread and only contains |
20 // information about an error (type of error and text details). | 19 // information about an error (type of error and text details). |
21 // Note no DISALLOW_COPY_AND_ASSIGN as we want the copy constructor. | 20 // Note no DISALLOW_COPY_AND_ASSIGN as we want the copy constructor. |
22 class SSLErrorInfo { | 21 class SSLErrorInfo { |
23 public: | 22 public: |
(...skipping 16 matching lines...) Expand all Loading... |
40 // Converts a network error code to an ErrorType. | 39 // Converts a network error code to an ErrorType. |
41 static ErrorType NetErrorToErrorType(int net_error); | 40 static ErrorType NetErrorToErrorType(int net_error); |
42 | 41 |
43 static SSLErrorInfo CreateError(ErrorType error_type, | 42 static SSLErrorInfo CreateError(ErrorType error_type, |
44 net::X509Certificate* cert, | 43 net::X509Certificate* cert, |
45 const GURL& request_url); | 44 const GURL& request_url); |
46 | 45 |
47 // Populates the specified |errors| vector with the errors contained in | 46 // Populates the specified |errors| vector with the errors contained in |
48 // |cert_status|. Returns the number of errors found. | 47 // |cert_status|. Returns the number of errors found. |
49 // Callers only interested in the error count can pass NULL for |errors|. | 48 // Callers only interested in the error count can pass NULL for |errors|. |
50 // TODO(wtc): Document |cert_id| and |url| arguments. | 49 static int GetErrorsForCertStatus(int cert_status, |
51 static int GetErrorsForCertStatus(int cert_id, | 50 int cert_id, |
52 net::CertStatus cert_status, | 51 const GURL& request_url, |
53 const GURL& url, | |
54 std::vector<SSLErrorInfo>* errors); | 52 std::vector<SSLErrorInfo>* errors); |
55 | 53 |
56 // A title describing the error, usually to be used with the details below. | 54 // A title describing the error, usually to be used with the details below. |
57 const string16& title() const { return title_; } | 55 const string16& title() const { return title_; } |
58 | 56 |
59 // A description of the error. | 57 // A description of the error. |
60 const string16& details() const { return details_; } | 58 const string16& details() const { return details_; } |
61 | 59 |
62 // A short message describing the error (1 line). | 60 // A short message describing the error (1 line). |
63 const string16& short_description() const { return short_description_; } | 61 const string16& short_description() const { return short_description_; } |
(...skipping 12 matching lines...) Expand all Loading... |
76 | 74 |
77 string16 title_; | 75 string16 title_; |
78 string16 details_; | 76 string16 details_; |
79 string16 short_description_; | 77 string16 short_description_; |
80 // Extra-informations contains paragraphs of text explaining in details what | 78 // Extra-informations contains paragraphs of text explaining in details what |
81 // the error is and what the risks are. | 79 // the error is and what the risks are. |
82 std::vector<string16> extra_information_; | 80 std::vector<string16> extra_information_; |
83 }; | 81 }; |
84 | 82 |
85 #endif // CHROME_BROWSER_SSL_SSL_ERROR_INFO_H_ | 83 #endif // CHROME_BROWSER_SSL_SSL_ERROR_INFO_H_ |
OLD | NEW |