| 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 4506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4517 | 4517 |
| 4518 if (!_SSLStatusUpdater) { | 4518 if (!_SSLStatusUpdater) { |
| 4519 _SSLStatusUpdater.reset([[CRWSSLStatusUpdater alloc] | 4519 _SSLStatusUpdater.reset([[CRWSSLStatusUpdater alloc] |
| 4520 initWithDataSource:self | 4520 initWithDataSource:self |
| 4521 navigationManager:navManager]); | 4521 navigationManager:navManager]); |
| 4522 [_SSLStatusUpdater setDelegate:self]; | 4522 [_SSLStatusUpdater setDelegate:self]; |
| 4523 } | 4523 } |
| 4524 NSString* host = base::SysUTF8ToNSString(_documentURL.host()); | 4524 NSString* host = base::SysUTF8ToNSString(_documentURL.host()); |
| 4525 BOOL hasOnlySecureContent = [_webView hasOnlySecureContent]; | 4525 BOOL hasOnlySecureContent = [_webView hasOnlySecureContent]; |
| 4526 base::ScopedCFTypeRef<SecTrustRef> trust; | 4526 base::ScopedCFTypeRef<SecTrustRef> trust; |
| 4527 // TODO(crbug.com/628696): Remove these guards after moving to iOS10 SDK. | |
| 4528 #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 | |
| 4529 if (base::ios::IsRunningOnIOS10OrLater()) { | 4527 if (base::ios::IsRunningOnIOS10OrLater()) { |
| 4530 trust.reset([_webView serverTrust], base::scoped_policy::RETAIN); | 4528 trust.reset([_webView serverTrust], base::scoped_policy::RETAIN); |
| 4531 } else { | 4529 } else { |
| 4532 trust = web::CreateServerTrustFromChain([_webView certificateChain], host); | 4530 trust = web::CreateServerTrustFromChain([_webView certificateChain], host); |
| 4533 } | 4531 } |
| 4534 #else | |
| 4535 trust = web::CreateServerTrustFromChain([_webView certificateChain], host); | |
| 4536 #endif | |
| 4537 | 4532 |
| 4538 [_SSLStatusUpdater updateSSLStatusForNavigationItem:currentNavItem | 4533 [_SSLStatusUpdater updateSSLStatusForNavigationItem:currentNavItem |
| 4539 withCertHost:host | 4534 withCertHost:host |
| 4540 trust:std::move(trust) | 4535 trust:std::move(trust) |
| 4541 hasOnlySecureContent:hasOnlySecureContent]; | 4536 hasOnlySecureContent:hasOnlySecureContent]; |
| 4542 } | 4537 } |
| 4543 | 4538 |
| 4544 - (void)didUpdateSSLStatusForCurrentNavigationItem { | 4539 - (void)didUpdateSSLStatusForCurrentNavigationItem { |
| 4545 if ([_delegate respondsToSelector: | 4540 if ([_delegate respondsToSelector: |
| 4546 @selector( | 4541 @selector( |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5727 } | 5722 } |
| 5728 | 5723 |
| 5729 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5724 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
| 5730 } | 5725 } |
| 5731 | 5726 |
| 5732 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5727 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
| 5733 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5728 return [action.request valueForHTTPHeaderField:@"Referer"]; |
| 5734 } | 5729 } |
| 5735 | 5730 |
| 5736 @end | 5731 @end |
| OLD | NEW |