Chromium Code Reviews| 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/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2030 | 2030 |
| 2031 void ChromeContentBrowserClient::AllowCertificateError( | 2031 void ChromeContentBrowserClient::AllowCertificateError( |
| 2032 content::WebContents* web_contents, | 2032 content::WebContents* web_contents, |
| 2033 int cert_error, | 2033 int cert_error, |
| 2034 const net::SSLInfo& ssl_info, | 2034 const net::SSLInfo& ssl_info, |
| 2035 const GURL& request_url, | 2035 const GURL& request_url, |
| 2036 ResourceType resource_type, | 2036 ResourceType resource_type, |
| 2037 bool overridable, | 2037 bool overridable, |
| 2038 bool strict_enforcement, | 2038 bool strict_enforcement, |
| 2039 bool expired_previous_decision, | 2039 bool expired_previous_decision, |
| 2040 const base::Callback<void(bool)>& callback, | 2040 const base::Callback<void(content::CertificateRequestResultType)>& |
| 2041 content::CertificateRequestResultType* result) { | 2041 callback) { |
| 2042 DCHECK(web_contents); | 2042 DCHECK(web_contents); |
| 2043 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) { | 2043 if (resource_type != content::RESOURCE_TYPE_MAIN_FRAME) { |
| 2044 // A sub-resource has a certificate error. The user doesn't really | 2044 // A sub-resource has a certificate error. The user doesn't really |
| 2045 // have a context for making the right decision, so block the | 2045 // have a context for making the right decision, so block the |
| 2046 // request hard, without an info bar to allow showing the insecure | 2046 // request hard, without an info bar to allow showing the insecure |
| 2047 // content. | 2047 // content. |
| 2048 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY; | 2048 if (!callback.is_null()) { |
|
nasko
2016/08/08 18:32:03
nit: No need for {} in one-line if statements.
estark
2016/08/08 20:00:13
Done.
| |
| 2049 callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY); | |
| 2050 } | |
| 2049 return; | 2051 return; |
| 2050 } | 2052 } |
| 2051 | 2053 |
| 2052 // If the tab is being prerendered, cancel the prerender and the request. | 2054 // If the tab is being prerendered, cancel the prerender and the request. |
| 2053 prerender::PrerenderContents* prerender_contents = | 2055 prerender::PrerenderContents* prerender_contents = |
| 2054 prerender::PrerenderContents::FromWebContents(web_contents); | 2056 prerender::PrerenderContents::FromWebContents(web_contents); |
| 2055 if (prerender_contents) { | 2057 if (prerender_contents) { |
| 2056 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR); | 2058 prerender_contents->Destroy(prerender::FINAL_STATUS_SSL_ERROR); |
| 2057 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL; | 2059 if (!callback.is_null()) { |
| 2060 callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL); | |
| 2061 } | |
| 2058 return; | 2062 return; |
| 2059 } | 2063 } |
| 2060 | 2064 |
| 2061 // Otherwise, display an SSL blocking page. The interstitial page takes | 2065 // Otherwise, display an SSL blocking page. The interstitial page takes |
| 2062 // ownership of ssl_blocking_page. | 2066 // ownership of ssl_blocking_page. |
| 2063 int options_mask = 0; | 2067 int options_mask = 0; |
| 2064 if (overridable) | 2068 if (overridable) |
| 2065 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 2069 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 2066 if (strict_enforcement) | 2070 if (strict_enforcement) |
| 2067 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; | 2071 options_mask |= SSLErrorUI::STRICT_ENFORCEMENT; |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3058 if (channel <= kMaxDisableEncryptionChannel) { | 3062 if (channel <= kMaxDisableEncryptionChannel) { |
| 3059 static const char* const kWebRtcDevSwitchNames[] = { | 3063 static const char* const kWebRtcDevSwitchNames[] = { |
| 3060 switches::kDisableWebRtcEncryption, | 3064 switches::kDisableWebRtcEncryption, |
| 3061 }; | 3065 }; |
| 3062 to_command_line->CopySwitchesFrom(from_command_line, | 3066 to_command_line->CopySwitchesFrom(from_command_line, |
| 3063 kWebRtcDevSwitchNames, | 3067 kWebRtcDevSwitchNames, |
| 3064 arraysize(kWebRtcDevSwitchNames)); | 3068 arraysize(kWebRtcDevSwitchNames)); |
| 3065 } | 3069 } |
| 3066 } | 3070 } |
| 3067 #endif // defined(ENABLE_WEBRTC) | 3071 #endif // defined(ENABLE_WEBRTC) |
| OLD | NEW |