| OLD | NEW |
| 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 #include "chrome/renderer/security_filter_peer.h" | 5 #include "chrome/renderer/security_filter_peer.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/http/http_response_headers.h" | 11 #include "net/http/http_response_headers.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 13 | 13 |
| 14 SecurityFilterPeer::SecurityFilterPeer(content::RequestPeer* peer) | 14 SecurityFilterPeer::SecurityFilterPeer(content::RequestPeer* peer) |
| 15 : original_peer_(peer) { | 15 : original_peer_(peer) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 SecurityFilterPeer::~SecurityFilterPeer() { | 18 SecurityFilterPeer::~SecurityFilterPeer() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 SecurityFilterPeer* | 22 SecurityFilterPeer* |
| 23 SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( | 23 SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest( |
| 24 ResourceType::Type resource_type, | 24 content::ResourceType::Type resource_type, |
| 25 content::RequestPeer* peer, | 25 content::RequestPeer* peer, |
| 26 int os_error) { | 26 int os_error) { |
| 27 // Create a filter for SSL and CERT errors. | 27 // Create a filter for SSL and CERT errors. |
| 28 switch (os_error) { | 28 switch (os_error) { |
| 29 case net::ERR_SSL_PROTOCOL_ERROR: | 29 case net::ERR_SSL_PROTOCOL_ERROR: |
| 30 case net::ERR_CERT_COMMON_NAME_INVALID: | 30 case net::ERR_CERT_COMMON_NAME_INVALID: |
| 31 case net::ERR_CERT_DATE_INVALID: | 31 case net::ERR_CERT_DATE_INVALID: |
| 32 case net::ERR_CERT_AUTHORITY_INVALID: | 32 case net::ERR_CERT_AUTHORITY_INVALID: |
| 33 case net::ERR_CERT_CONTAINS_ERRORS: | 33 case net::ERR_CERT_CONTAINS_ERRORS: |
| 34 case net::ERR_CERT_NO_REVOCATION_MECHANISM: | 34 case net::ERR_CERT_NO_REVOCATION_MECHANISM: |
| 35 case net::ERR_CERT_UNABLE_TO_CHECK_REVOCATION: | 35 case net::ERR_CERT_UNABLE_TO_CHECK_REVOCATION: |
| 36 case net::ERR_CERT_REVOKED: | 36 case net::ERR_CERT_REVOKED: |
| 37 case net::ERR_CERT_INVALID: | 37 case net::ERR_CERT_INVALID: |
| 38 case net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM: | 38 case net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM: |
| 39 case net::ERR_CERT_WEAK_KEY: | 39 case net::ERR_CERT_WEAK_KEY: |
| 40 case net::ERR_CERT_NAME_CONSTRAINT_VIOLATION: | 40 case net::ERR_CERT_NAME_CONSTRAINT_VIOLATION: |
| 41 case net::ERR_INSECURE_RESPONSE: | 41 case net::ERR_INSECURE_RESPONSE: |
| 42 case net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN: | 42 case net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN: |
| 43 if (ResourceType::IsFrame(resource_type)) | 43 if (content::ResourceType::IsFrame(resource_type)) |
| 44 return CreateSecurityFilterPeerForFrame(peer, os_error); | 44 return CreateSecurityFilterPeerForFrame(peer, os_error); |
| 45 // Any other content is entirely filtered-out. | 45 // Any other content is entirely filtered-out. |
| 46 return new ReplaceContentPeer(peer, std::string(), std::string()); | 46 return new ReplaceContentPeer(peer, std::string(), std::string()); |
| 47 default: | 47 default: |
| 48 // For other errors, we use our normal error handling. | 48 // For other errors, we use our normal error handling. |
| 49 return NULL; | 49 return NULL; |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 // static | 53 // static |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 original_peer_->OnCompletedRequest(net::OK, | 219 original_peer_->OnCompletedRequest(net::OK, |
| 220 false, | 220 false, |
| 221 stale_copy_in_cache, | 221 stale_copy_in_cache, |
| 222 security_info, | 222 security_info, |
| 223 completion_time, | 223 completion_time, |
| 224 total_transfer_size); | 224 total_transfer_size); |
| 225 | 225 |
| 226 // The request processing is complete, we must delete ourselves. | 226 // The request processing is complete, we must delete ourselves. |
| 227 delete this; | 227 delete this; |
| 228 } | 228 } |
| OLD | NEW |