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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 #import "ios/web/web_state/ui/wk_back_forward_list_item_holder.h" | 92 #import "ios/web/web_state/ui/wk_back_forward_list_item_holder.h" |
93 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" | 93 #import "ios/web/web_state/ui/wk_web_view_configuration_provider.h" |
94 #import "ios/web/web_state/web_controller_observer_bridge.h" | 94 #import "ios/web/web_state/web_controller_observer_bridge.h" |
95 #import "ios/web/web_state/web_state_impl.h" | 95 #import "ios/web/web_state/web_state_impl.h" |
96 #import "ios/web/web_state/web_view_internal_creation_util.h" | 96 #import "ios/web/web_state/web_view_internal_creation_util.h" |
97 #import "ios/web/web_state/wk_web_view_security_util.h" | 97 #import "ios/web/web_state/wk_web_view_security_util.h" |
98 #import "ios/web/webui/crw_web_ui_manager.h" | 98 #import "ios/web/webui/crw_web_ui_manager.h" |
99 #import "ios/web/webui/mojo_facade.h" | 99 #import "ios/web/webui/mojo_facade.h" |
100 #import "net/base/mac/url_conversions.h" | 100 #import "net/base/mac/url_conversions.h" |
101 #include "net/base/net_errors.h" | 101 #include "net/base/net_errors.h" |
| 102 #include "net/cert/x509_util_ios.h" |
102 #include "net/ssl/ssl_info.h" | 103 #include "net/ssl/ssl_info.h" |
103 #include "ui/base/page_transition_types.h" | 104 #include "ui/base/page_transition_types.h" |
104 #include "url/gurl.h" | 105 #include "url/gurl.h" |
105 #include "url/url_constants.h" | 106 #include "url/url_constants.h" |
106 | 107 |
107 using base::UserMetricsAction; | 108 using base::UserMetricsAction; |
108 using web::NavigationManager; | 109 using web::NavigationManager; |
109 using web::NavigationManagerImpl; | 110 using web::NavigationManagerImpl; |
110 using web::WebState; | 111 using web::WebState; |
111 using web::WebStateImpl; | 112 using web::WebStateImpl; |
(...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3156 | 3157 |
3157 if (policy != web::CERT_ACCEPT_POLICY_ALLOW && | 3158 if (policy != web::CERT_ACCEPT_POLICY_ALLOW && |
3158 SecTrustGetCertificateCount(trust)) { | 3159 SecTrustGetCertificateCount(trust)) { |
3159 // The cert is invalid and the user has not agreed to proceed. Cache the | 3160 // The cert is invalid and the user has not agreed to proceed. Cache the |
3160 // cert verification result in |_certVerificationErrors|, so that it can | 3161 // cert verification result in |_certVerificationErrors|, so that it can |
3161 // later be reused inside |didFailProvisionalNavigation:|. | 3162 // later be reused inside |didFailProvisionalNavigation:|. |
3162 // The leaf cert is used as the key, because the chain provided by | 3163 // The leaf cert is used as the key, because the chain provided by |
3163 // |didFailProvisionalNavigation:| will differ (it is the server-supplied | 3164 // |didFailProvisionalNavigation:| will differ (it is the server-supplied |
3164 // chain), thus if intermediates were considered, the keys would mismatch. | 3165 // chain), thus if intermediates were considered, the keys would mismatch. |
3165 scoped_refptr<net::X509Certificate> leafCert = | 3166 scoped_refptr<net::X509Certificate> leafCert = |
3166 net::X509Certificate::CreateFromHandle( | 3167 net::x509_util::CreateX509CertificateFromSecCertificate( |
3167 SecTrustGetCertificateAtIndex(trust, 0), | 3168 SecTrustGetCertificateAtIndex(trust, 0), |
3168 net::X509Certificate::OSCertHandles()); | 3169 std::vector<SecCertificateRef>()); |
3169 if (leafCert) { | 3170 if (leafCert) { |
3170 BOOL is_recoverable = | 3171 BOOL is_recoverable = |
3171 policy == web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; | 3172 policy == web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; |
3172 std::string host = | 3173 std::string host = |
3173 base::SysNSStringToUTF8(challenge.protectionSpace.host); | 3174 base::SysNSStringToUTF8(challenge.protectionSpace.host); |
3174 _certVerificationErrors->Put( | 3175 _certVerificationErrors->Put( |
3175 web::CertHostPair(leafCert, host), | 3176 web::CertHostPair(leafCert, host), |
3176 CertVerificationError(is_recoverable, certStatus)); | 3177 CertVerificationError(is_recoverable, certStatus)); |
3177 } | 3178 } |
3178 } | 3179 } |
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5066 - (NSUInteger)observerCount { | 5067 - (NSUInteger)observerCount { |
5067 DCHECK_EQ(_observerBridges.size(), [_observers count]); | 5068 DCHECK_EQ(_observerBridges.size(), [_observers count]); |
5068 return [_observers count]; | 5069 return [_observers count]; |
5069 } | 5070 } |
5070 | 5071 |
5071 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5072 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
5072 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5073 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
5073 } | 5074 } |
5074 | 5075 |
5075 @end | 5076 @end |
OLD | NEW |