OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ios/web/web_state/ui/crw_wk_web_view_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_wk_web_view_web_controller.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #include "base/containers/mru_cache.h" | 9 #include "base/containers/mru_cache.h" |
10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 scoped_refptr<net::X509Certificate> leafCert; | 955 scoped_refptr<net::X509Certificate> leafCert; |
956 BOOL recoverable = NO; | 956 BOOL recoverable = NO; |
957 if (chain.count && host.length) { | 957 if (chain.count && host.length) { |
958 // The complete cert chain may not be available, so the leaf cert is used | 958 // The complete cert chain may not be available, so the leaf cert is used |
959 // as a key to retrieve _certVerificationErrors, as well as for storing the | 959 // as a key to retrieve _certVerificationErrors, as well as for storing the |
960 // cert decision. | 960 // cert decision. |
961 leafCert = web::CreateCertFromChain(@[ chain.firstObject ]); | 961 leafCert = web::CreateCertFromChain(@[ chain.firstObject ]); |
962 if (leafCert) { | 962 if (leafCert) { |
963 auto error = _certVerificationErrors->Get( | 963 auto error = _certVerificationErrors->Get( |
964 {leafCert, base::SysNSStringToUTF8(host)}); | 964 {leafCert, base::SysNSStringToUTF8(host)}); |
965 if (error != _certVerificationErrors->end()) { | 965 bool cacheHit = error != _certVerificationErrors->end(); |
| 966 if (cacheHit) { |
966 status.cert_status = error->second.status; | 967 status.cert_status = error->second.status; |
967 recoverable = error->second.is_recoverable; | 968 recoverable = error->second.is_recoverable; |
968 } else { | |
969 // TODO(eugenebut): Report UMA with cache size (crbug.com/541736). | |
970 } | 969 } |
| 970 UMA_HISTOGRAM_BOOLEAN("WebController.CertVerificationErrorsCacheHit", |
| 971 cacheHit); |
971 } | 972 } |
972 } | 973 } |
973 | 974 |
974 // Present SSL interstitial and inform everyone that the load is cancelled. | 975 // Present SSL interstitial and inform everyone that the load is cancelled. |
975 [self.delegate presentSSLError:info | 976 [self.delegate presentSSLError:info |
976 forSSLStatus:status | 977 forSSLStatus:status |
977 recoverable:recoverable | 978 recoverable:recoverable |
978 callback:^(BOOL proceed) { | 979 callback:^(BOOL proceed) { |
979 if (proceed) { | 980 if (proceed) { |
980 // The interstitial will be removed during reload. | 981 // The interstitial will be removed during reload. |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 runJavaScriptTextInputPanelWithPrompt:prompt | 1819 runJavaScriptTextInputPanelWithPrompt:prompt |
1819 defaultText:defaultText | 1820 defaultText:defaultText |
1820 requestURL:requestURL | 1821 requestURL:requestURL |
1821 completionHandler:completionHandler]; | 1822 completionHandler:completionHandler]; |
1822 } else if (completionHandler) { | 1823 } else if (completionHandler) { |
1823 completionHandler(nil); | 1824 completionHandler(nil); |
1824 } | 1825 } |
1825 } | 1826 } |
1826 | 1827 |
1827 @end | 1828 @end |
OLD | NEW |