Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / ssl / ssl_cert_error_handler.cc
bloba3e6a2663db1746a23a33e87518a9ac8fc9e7ca6
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 #include "content/browser/ssl/ssl_cert_error_handler.h"
7 #include "content/browser/ssl/ssl_manager.h"
8 #include "content/browser/ssl/ssl_policy.h"
9 #include "net/cert/cert_status_flags.h"
10 #include "net/cert/x509_certificate.h"
12 namespace content {
14 SSLCertErrorHandler::SSLCertErrorHandler(
15 const base::WeakPtr<Delegate>& delegate,
16 const GlobalRequestID& id,
17 ResourceType resource_type,
18 const GURL& url,
19 int render_process_id,
20 int render_frame_id,
21 const net::SSLInfo& ssl_info,
22 bool fatal)
23 : SSLErrorHandler(delegate,
24 id,
25 resource_type,
26 url,
27 render_process_id,
28 render_frame_id),
29 ssl_info_(ssl_info),
30 cert_error_(net::MapCertStatusToNetError(ssl_info.cert_status)),
31 fatal_(fatal) {
34 SSLCertErrorHandler* SSLCertErrorHandler::AsSSLCertErrorHandler() {
35 return this;
38 void SSLCertErrorHandler::OnDispatchFailed() {
39 // Requests can fail to dispatch because they don't have a WebContents. See
40 // <http://crbug.com/86537>. In this case we have to make a decision in this
41 // function, so we ignore revocation check failures.
42 if (net::IsCertStatusMinorError(ssl_info().cert_status)) {
43 ContinueRequest();
44 } else {
45 CancelRequest();
49 void SSLCertErrorHandler::OnDispatched() {
50 manager_->policy()->OnCertError(this);
53 SSLCertErrorHandler::~SSLCertErrorHandler() {}
55 } // namespace content