Chromium Code Reviews

Side by Side Diff: content/browser/ssl/ssl_cert_error_handler.h

Issue 1459473003: Add a WebContents getter callback in ResourceRequestInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_
6 #define CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ 6 #define CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "content/browser/ssl/ssl_error_handler.h" 11 #include "content/browser/ssl/ssl_error_handler.h"
12 #include "net/ssl/ssl_info.h" 12 #include "net/ssl/ssl_info.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 // A CertError represents an error that occurred with the certificate in an 16 // A CertError represents an error that occurred with the certificate in an
17 // SSL session. A CertError object exists both on the IO thread and on the UI 17 // SSL session. A CertError object exists both on the IO thread and on the UI
18 // thread and allows us to cancel/continue a request it is associated with. 18 // thread and allows us to cancel/continue a request it is associated with.
19 class SSLCertErrorHandler : public SSLErrorHandler { 19 class SSLCertErrorHandler : public SSLErrorHandler {
20 public: 20 public:
21 // Construct on the IO thread. 21 // Construct on the IO thread.
22 SSLCertErrorHandler(const base::WeakPtr<Delegate>& delegate, 22 SSLCertErrorHandler(
23 ResourceType resource_type, 23 const base::WeakPtr<Delegate>& delegate,
24 const GURL& url, 24 ResourceType resource_type,
25 int render_process_id, 25 const GURL& url,
26 int render_frame_id, 26 const ResourceRequestInfo::WebContentsGetterOnUI& web_contents_getter,
27 const net::SSLInfo& ssl_info, 27 const net::SSLInfo& ssl_info,
28 bool fatal); 28 bool fatal);
29 29
30 SSLCertErrorHandler* AsSSLCertErrorHandler() override; 30 SSLCertErrorHandler* AsSSLCertErrorHandler() override;
31 31
32 // These accessors are available on either thread 32 // These accessors are available on either thread
33 const net::SSLInfo& ssl_info() const { return ssl_info_; } 33 const net::SSLInfo& ssl_info() const { return ssl_info_; }
34 int cert_error() const { return cert_error_; } 34 int cert_error() const { return cert_error_; }
35 bool fatal() const { return fatal_; } 35 bool fatal() const { return fatal_; }
36 36
37 protected: 37 protected:
38 // SSLErrorHandler methods 38 // SSLErrorHandler methods
39 void OnDispatchFailed() override; 39 void OnDispatchFailed() override;
40 void OnDispatched() override; 40 void OnDispatched() override;
41 41
42 private: 42 private:
43 ~SSLCertErrorHandler() override; 43 ~SSLCertErrorHandler() override;
44 44
45 // These read-only members may be accessed on any thread. 45 // These read-only members may be accessed on any thread.
46 const net::SSLInfo ssl_info_; 46 const net::SSLInfo ssl_info_;
47 const int cert_error_; // The error we represent. 47 const int cert_error_; // The error we represent.
48 const bool fatal_; // True if the error is from a host requiring 48 const bool fatal_; // True if the error is from a host requiring
49 // certificate errors to be fatal. 49 // certificate errors to be fatal.
50 50
51 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler); 51 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler);
52 }; 52 };
53 53
54 } // namespace content 54 } // namespace content
55 55
56 #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_ 56 #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_
OLDNEW

Powered by Google App Engine