Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / ssl / ssl_cert_error_handler.h
blob6946f42921f36ae7d302cb432cc5b7da06006f55
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_
6 #define CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_
8 #include <string>
10 #include "base/memory/weak_ptr.h"
11 #include "content/browser/ssl/ssl_error_handler.h"
12 #include "net/ssl/ssl_info.h"
14 namespace content {
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
18 // thread and allows us to cancel/continue a request it is associated with.
19 class SSLCertErrorHandler : public SSLErrorHandler {
20 public:
21 // Construct on the IO thread.
22 SSLCertErrorHandler(const base::WeakPtr<Delegate>& delegate,
23 const GlobalRequestID& id,
24 ResourceType::Type resource_type,
25 const GURL& url,
26 int render_process_id,
27 int render_frame_id,
28 const net::SSLInfo& ssl_info,
29 bool fatal);
31 virtual SSLCertErrorHandler* AsSSLCertErrorHandler() OVERRIDE;
33 // These accessors are available on either thread
34 const net::SSLInfo& ssl_info() const { return ssl_info_; }
35 int cert_error() const { return cert_error_; }
36 bool fatal() const { return fatal_; }
38 protected:
39 // SSLErrorHandler methods
40 virtual void OnDispatchFailed() OVERRIDE;
41 virtual void OnDispatched() OVERRIDE;
43 private:
44 virtual ~SSLCertErrorHandler();
46 // These read-only members may be accessed on any thread.
47 const net::SSLInfo ssl_info_;
48 const int cert_error_; // The error we represent.
49 const bool fatal_; // True if the error is from a host requiring
50 // certificate errors to be fatal.
52 DISALLOW_COPY_AND_ASSIGN(SSLCertErrorHandler);
55 } // namespace content
57 #endif // CONTENT_BROWSER_SSL_SSL_CERT_ERROR_HANDLER_H_