Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2327433002: Stop using CertStore which is not compatible with PlzNavigate. (Closed)
Patch Set: remove cert_store on ios Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/public/web_state/web_state.h ('k') | ios/web/web_state/web_state_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #import "ios/web/navigation/crw_session_certificate_policy_manager.h" 45 #import "ios/web/navigation/crw_session_certificate_policy_manager.h"
46 #import "ios/web/navigation/crw_session_controller.h" 46 #import "ios/web/navigation/crw_session_controller.h"
47 #import "ios/web/navigation/crw_session_entry.h" 47 #import "ios/web/navigation/crw_session_entry.h"
48 #import "ios/web/navigation/navigation_item_impl.h" 48 #import "ios/web/navigation/navigation_item_impl.h"
49 #import "ios/web/navigation/navigation_manager_impl.h" 49 #import "ios/web/navigation/navigation_manager_impl.h"
50 #include "ios/web/net/cert_host_pair.h" 50 #include "ios/web/net/cert_host_pair.h"
51 #import "ios/web/net/crw_cert_verification_controller.h" 51 #import "ios/web/net/crw_cert_verification_controller.h"
52 #import "ios/web/net/crw_ssl_status_updater.h" 52 #import "ios/web/net/crw_ssl_status_updater.h"
53 #include "ios/web/net/request_group_util.h" 53 #include "ios/web/net/request_group_util.h"
54 #include "ios/web/public/browser_state.h" 54 #include "ios/web/public/browser_state.h"
55 #include "ios/web/public/cert_store.h"
56 #include "ios/web/public/favicon_url.h" 55 #include "ios/web/public/favicon_url.h"
57 #import "ios/web/public/java_script_dialog_presenter.h" 56 #import "ios/web/public/java_script_dialog_presenter.h"
58 #include "ios/web/public/navigation_item.h" 57 #include "ios/web/public/navigation_item.h"
59 #import "ios/web/public/navigation_manager.h" 58 #import "ios/web/public/navigation_manager.h"
60 #import "ios/web/public/origin_util.h" 59 #import "ios/web/public/origin_util.h"
61 #include "ios/web/public/referrer.h" 60 #include "ios/web/public/referrer.h"
62 #include "ios/web/public/referrer_util.h" 61 #include "ios/web/public/referrer_util.h"
63 #include "ios/web/public/ssl_status.h" 62 #include "ios/web/public/ssl_status.h"
64 #import "ios/web/public/url_scheme_util.h" 63 #import "ios/web/public/url_scheme_util.h"
65 #include "ios/web/public/url_util.h" 64 #include "ios/web/public/url_util.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 @property(nonatomic, readonly) UIScrollView* webScrollView; 484 @property(nonatomic, readonly) UIScrollView* webScrollView;
486 // The current page state of the web view. Writing to this property 485 // The current page state of the web view. Writing to this property
487 // asynchronously applies the passed value to the current web view. 486 // asynchronously applies the passed value to the current web view.
488 @property(nonatomic, readwrite) web::PageDisplayState pageDisplayState; 487 @property(nonatomic, readwrite) web::PageDisplayState pageDisplayState;
489 // The currently displayed native controller, if any. 488 // The currently displayed native controller, if any.
490 @property(nonatomic, readwrite) id<CRWNativeContent> nativeController; 489 @property(nonatomic, readwrite) id<CRWNativeContent> nativeController;
491 // Returns NavigationManager's session controller. 490 // Returns NavigationManager's session controller.
492 @property(nonatomic, readonly) CRWSessionController* sessionController; 491 @property(nonatomic, readonly) CRWSessionController* sessionController;
493 // Activity indicator group ID for this web controller. 492 // Activity indicator group ID for this web controller.
494 @property(nonatomic, readonly) NSString* activityIndicatorGroupID; 493 @property(nonatomic, readonly) NSString* activityIndicatorGroupID;
495 // Identifier used for storing and retrieving certificates.
496 @property(nonatomic, readonly) int certGroupID;
497 // Dictionary where keys are the names of WKWebView properties and values are 494 // Dictionary where keys are the names of WKWebView properties and values are
498 // selector names which should be called when a corresponding property has 495 // selector names which should be called when a corresponding property has
499 // changed. e.g. @{ @"URL" : @"webViewURLDidChange" } means that 496 // changed. e.g. @{ @"URL" : @"webViewURLDidChange" } means that
500 // -[self webViewURLDidChange] must be called every time when WKWebView.URL is 497 // -[self webViewURLDidChange] must be called every time when WKWebView.URL is
501 // changed. 498 // changed.
502 @property(nonatomic, readonly) NSDictionary* WKWebViewObservers; 499 @property(nonatomic, readonly) NSDictionary* WKWebViewObservers;
503 // Downloader for PassKit files. Lazy initialized. 500 // Downloader for PassKit files. Lazy initialized.
504 @property(nonatomic, readonly) CRWPassKitDownloader* passKitDownloader; 501 @property(nonatomic, readonly) CRWPassKitDownloader* passKitDownloader;
505 502
506 // The web view's view of the current URL. During page transitions 503 // The web view's view of the current URL. During page transitions
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 [_containerView displayNativeContent:nativeController]; 1144 [_containerView displayNativeContent:nativeController];
1148 [self setNativeControllerWebUsageEnabled:_webUsageEnabled]; 1145 [self setNativeControllerWebUsageEnabled:_webUsageEnabled];
1149 } 1146 }
1150 1147
1151 - (NSString*)activityIndicatorGroupID { 1148 - (NSString*)activityIndicatorGroupID {
1152 return [NSString 1149 return [NSString
1153 stringWithFormat:@"WebController.NetworkActivityIndicatorKey.%@", 1150 stringWithFormat:@"WebController.NetworkActivityIndicatorKey.%@",
1154 self.webStateImpl->GetRequestGroupID()]; 1151 self.webStateImpl->GetRequestGroupID()];
1155 } 1152 }
1156 1153
1157 - (int)certGroupID {
1158 return self.webState->GetCertGroupId();
1159 }
1160
1161 - (NSDictionary*)WKWebViewObservers { 1154 - (NSDictionary*)WKWebViewObservers {
1162 return @{ 1155 return @{
1163 @"certificateChain" : @"webViewSecurityFeaturesDidChange", 1156 @"certificateChain" : @"webViewSecurityFeaturesDidChange",
1164 @"estimatedProgress" : @"webViewEstimatedProgressDidChange", 1157 @"estimatedProgress" : @"webViewEstimatedProgressDidChange",
1165 @"hasOnlySecureContent" : @"webViewSecurityFeaturesDidChange", 1158 @"hasOnlySecureContent" : @"webViewSecurityFeaturesDidChange",
1166 @"loading" : @"webViewLoadingStateDidChange", 1159 @"loading" : @"webViewLoadingStateDidChange",
1167 @"title" : @"webViewTitleDidChange", 1160 @"title" : @"webViewTitleDidChange",
1168 @"URL" : @"webViewURLDidChange", 1161 @"URL" : @"webViewURLDidChange",
1169 }; 1162 };
1170 } 1163 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 - (BOOL)isViewAlive { 1236 - (BOOL)isViewAlive {
1244 return !_webProcessIsDead && [_containerView isViewAlive]; 1237 return !_webProcessIsDead && [_containerView isViewAlive];
1245 } 1238 }
1246 1239
1247 - (BOOL)contentIsHTML { 1240 - (BOOL)contentIsHTML {
1248 return [self webViewDocumentType] == web::WEB_VIEW_DOCUMENT_TYPE_HTML; 1241 return [self webViewDocumentType] == web::WEB_VIEW_DOCUMENT_TYPE_HTML;
1249 } 1242 }
1250 1243
1251 // Stop doing stuff, especially network stuff. Close the request tracker. 1244 // Stop doing stuff, especially network stuff. Close the request tracker.
1252 - (void)terminateNetworkActivity { 1245 - (void)terminateNetworkActivity {
1253 web::CertStore::GetInstance()->RemoveCertsForGroup(self.certGroupID);
1254
1255 DCHECK(!_isHalted); 1246 DCHECK(!_isHalted);
1256 _isHalted = YES; 1247 _isHalted = YES;
1257 1248
1258 // Cancel all outstanding perform requests, and clear anything already queued 1249 // Cancel all outstanding perform requests, and clear anything already queued
1259 // (since this may be called from within the handling loop) to prevent any 1250 // (since this may be called from within the handling loop) to prevent any
1260 // asynchronous JavaScript invocation handling from continuing. 1251 // asynchronous JavaScript invocation handling from continuing.
1261 [NSObject cancelPreviousPerformRequestsWithTarget:self]; 1252 [NSObject cancelPreviousPerformRequestsWithTarget:self];
1262 _webStateImpl->CloseRequestTracker(); 1253 _webStateImpl->CloseRequestTracker();
1263 } 1254 }
1264 1255
(...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 4445
4455 web::NavigationManager* navManager = self.webState->GetNavigationManager(); 4446 web::NavigationManager* navManager = self.webState->GetNavigationManager();
4456 web::NavigationItem* currentNavItem = navManager->GetLastCommittedItem(); 4447 web::NavigationItem* currentNavItem = navManager->GetLastCommittedItem();
4457 if (!currentNavItem) { 4448 if (!currentNavItem) {
4458 return; 4449 return;
4459 } 4450 }
4460 4451
4461 if (!_SSLStatusUpdater) { 4452 if (!_SSLStatusUpdater) {
4462 _SSLStatusUpdater.reset([[CRWSSLStatusUpdater alloc] 4453 _SSLStatusUpdater.reset([[CRWSSLStatusUpdater alloc]
4463 initWithDataSource:self 4454 initWithDataSource:self
4464 navigationManager:navManager 4455 navigationManager:navManager]);
4465 certGroupID:self.certGroupID]);
4466 [_SSLStatusUpdater setDelegate:self]; 4456 [_SSLStatusUpdater setDelegate:self];
4467 } 4457 }
4468 NSString* host = base::SysUTF8ToNSString(_documentURL.host()); 4458 NSString* host = base::SysUTF8ToNSString(_documentURL.host());
4469 BOOL hasOnlySecureContent = [_webView hasOnlySecureContent]; 4459 BOOL hasOnlySecureContent = [_webView hasOnlySecureContent];
4470 base::ScopedCFTypeRef<SecTrustRef> trust; 4460 base::ScopedCFTypeRef<SecTrustRef> trust;
4471 // TODO(crbug.com/628696): Remove these guards after moving to iOS10 SDK. 4461 // TODO(crbug.com/628696): Remove these guards after moving to iOS10 SDK.
4472 #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 4462 #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
4473 if (base::ios::IsRunningOnIOS10OrLater()) { 4463 if (base::ios::IsRunningOnIOS10OrLater()) {
4474 trust.reset([_webView serverTrust], base::scoped_policy::RETAIN); 4464 trust.reset([_webView serverTrust], base::scoped_policy::RETAIN);
4475 } else { 4465 } else {
(...skipping 24 matching lines...) Expand all
4500 web::GetSSLInfoFromWKWebViewSSLCertError(error, &info); 4490 web::GetSSLInfoFromWKWebViewSSLCertError(error, &info);
4501 4491
4502 if (!info.cert) { 4492 if (!info.cert) {
4503 // |info.cert| can be null if certChain in NSError is empty or can not be 4493 // |info.cert| can be null if certChain in NSError is empty or can not be
4504 // parsed, in this case do not ask delegate if error should be allowed, it 4494 // parsed, in this case do not ask delegate if error should be allowed, it
4505 // should not be. 4495 // should not be.
4506 [self handleLoadError:error inMainFrame:YES]; 4496 [self handleLoadError:error inMainFrame:YES];
4507 return; 4497 return;
4508 } 4498 }
4509 4499
4510 web::CertStore::GetInstance()->StoreCert(info.cert.get(), self.certGroupID);
4511
4512 // Retrieve verification results from _certVerificationErrors cache to avoid 4500 // Retrieve verification results from _certVerificationErrors cache to avoid
4513 // unnecessary recalculations. Verification results are cached for the leaf 4501 // unnecessary recalculations. Verification results are cached for the leaf
4514 // cert, because the cert chain in |didReceiveAuthenticationChallenge:| is 4502 // cert, because the cert chain in |didReceiveAuthenticationChallenge:| is
4515 // the OS constructed chain, while |chain| is the chain from the server. 4503 // the OS constructed chain, while |chain| is the chain from the server.
4516 NSArray* chain = error.userInfo[web::kNSErrorPeerCertificateChainKey]; 4504 NSArray* chain = error.userInfo[web::kNSErrorPeerCertificateChainKey];
4517 NSURL* requestURL = error.userInfo[web::kNSErrorFailingURLKey]; 4505 NSURL* requestURL = error.userInfo[web::kNSErrorFailingURLKey];
4518 NSString* host = [requestURL host]; 4506 NSString* host = [requestURL host];
4519 scoped_refptr<net::X509Certificate> leafCert; 4507 scoped_refptr<net::X509Certificate> leafCert;
4520 BOOL recoverable = NO; 4508 BOOL recoverable = NO;
4521 if (chain.count && host.length) { 4509 if (chain.count && host.length) {
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
5629 } 5617 }
5630 5618
5631 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5619 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5632 } 5620 }
5633 5621
5634 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5622 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5635 return [action.request valueForHTTPHeaderField:@"Referer"]; 5623 return [action.request valueForHTTPHeaderField:@"Referer"];
5636 } 5624 }
5637 5625
5638 @end 5626 @end
OLDNEW
« no previous file with comments | « ios/web/public/web_state/web_state.h ('k') | ios/web/web_state/web_state_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698