OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #import <objc/runtime.h> | 9 #import <objc/runtime.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 #import "ios/web/web_state/ui/wk_back_forward_list_item_holder.h" | 93 #import "ios/web/web_state/ui/wk_back_forward_list_item_holder.h" |
94 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" | 94 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" |
95 #import "ios/web/web_state/web_controller_observer_bridge.h" | 95 #import "ios/web/web_state/web_controller_observer_bridge.h" |
96 #import "ios/web/web_state/web_state_impl.h" | 96 #import "ios/web/web_state/web_state_impl.h" |
97 #import "ios/web/web_state/web_view_internal_creation_util.h" | 97 #import "ios/web/web_state/web_view_internal_creation_util.h" |
98 #import "ios/web/web_state/wk_web_view_security_util.h" | 98 #import "ios/web/web_state/wk_web_view_security_util.h" |
99 #import "ios/web/webui/crw_web_ui_manager.h" | 99 #import "ios/web/webui/crw_web_ui_manager.h" |
100 #import "ios/web/webui/mojo_facade.h" | 100 #import "ios/web/webui/mojo_facade.h" |
101 #import "net/base/mac/url_conversions.h" | 101 #import "net/base/mac/url_conversions.h" |
102 #include "net/base/net_errors.h" | 102 #include "net/base/net_errors.h" |
| 103 #include "net/cert/x509_util_ios.h" |
103 #include "net/ssl/ssl_info.h" | 104 #include "net/ssl/ssl_info.h" |
104 #include "ui/base/page_transition_types.h" | 105 #include "ui/base/page_transition_types.h" |
105 #include "url/gurl.h" | 106 #include "url/gurl.h" |
106 #include "url/url_constants.h" | 107 #include "url/url_constants.h" |
107 | 108 |
108 using base::UserMetricsAction; | 109 using base::UserMetricsAction; |
109 using web::NavigationManager; | 110 using web::NavigationManager; |
110 using web::NavigationManagerImpl; | 111 using web::NavigationManagerImpl; |
111 using web::WebState; | 112 using web::WebState; |
112 using web::WebStateImpl; | 113 using web::WebStateImpl; |
(...skipping 3077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3190 | 3191 |
3191 if (policy != web::CERT_ACCEPT_POLICY_ALLOW && | 3192 if (policy != web::CERT_ACCEPT_POLICY_ALLOW && |
3192 SecTrustGetCertificateCount(trust)) { | 3193 SecTrustGetCertificateCount(trust)) { |
3193 // The cert is invalid and the user has not agreed to proceed. Cache the | 3194 // The cert is invalid and the user has not agreed to proceed. Cache the |
3194 // cert verification result in |_certVerificationErrors|, so that it can | 3195 // cert verification result in |_certVerificationErrors|, so that it can |
3195 // later be reused inside |didFailProvisionalNavigation:|. | 3196 // later be reused inside |didFailProvisionalNavigation:|. |
3196 // The leaf cert is used as the key, because the chain provided by | 3197 // The leaf cert is used as the key, because the chain provided by |
3197 // |didFailProvisionalNavigation:| will differ (it is the server-supplied | 3198 // |didFailProvisionalNavigation:| will differ (it is the server-supplied |
3198 // chain), thus if intermediates were considered, the keys would mismatch. | 3199 // chain), thus if intermediates were considered, the keys would mismatch. |
3199 scoped_refptr<net::X509Certificate> leafCert = | 3200 scoped_refptr<net::X509Certificate> leafCert = |
3200 net::X509Certificate::CreateFromHandle( | 3201 net::x509_util::CreateX509CertificateFromSecCertificate( |
3201 SecTrustGetCertificateAtIndex(trust, 0), | 3202 SecTrustGetCertificateAtIndex(trust, 0), |
3202 net::X509Certificate::OSCertHandles()); | 3203 std::vector<SecCertificateRef>()); |
3203 if (leafCert) { | 3204 if (leafCert) { |
3204 BOOL is_recoverable = | 3205 BOOL is_recoverable = |
3205 policy == web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; | 3206 policy == web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; |
3206 std::string host = | 3207 std::string host = |
3207 base::SysNSStringToUTF8(challenge.protectionSpace.host); | 3208 base::SysNSStringToUTF8(challenge.protectionSpace.host); |
3208 _certVerificationErrors->Put( | 3209 _certVerificationErrors->Put( |
3209 web::CertHostPair(leafCert, host), | 3210 web::CertHostPair(leafCert, host), |
3210 CertVerificationError(is_recoverable, certStatus)); | 3211 CertVerificationError(is_recoverable, certStatus)); |
3211 } | 3212 } |
3212 } | 3213 } |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5159 - (NSUInteger)observerCount { | 5160 - (NSUInteger)observerCount { |
5160 DCHECK_EQ(_observerBridges.size(), [_observers count]); | 5161 DCHECK_EQ(_observerBridges.size(), [_observers count]); |
5161 return [_observers count]; | 5162 return [_observers count]; |
5162 } | 5163 } |
5163 | 5164 |
5164 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5165 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
5165 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5166 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
5166 } | 5167 } |
5167 | 5168 |
5168 @end | 5169 @end |
OLD | NEW |