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

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

Issue 2648763002: CRWWebController no longer implements CRWRequestTrackerDelegate. (Closed)
Patch Set: Created 3 years, 11 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/web_state/ui/crw_web_controller.h ('k') | no next file » | 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 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after
3480 _webUIManager.reset( 3480 _webUIManager.reset(
3481 [[CRWWebUIManager alloc] initWithWebState:self.webStateImpl]); 3481 [[CRWWebUIManager alloc] initWithWebState:self.webStateImpl]);
3482 } 3482 }
3483 3483
3484 - (void)clearWebUI { 3484 - (void)clearWebUI {
3485 _webStateImpl->ClearWebUI(); 3485 _webStateImpl->ClearWebUI();
3486 _webUIManager.reset(); 3486 _webUIManager.reset();
3487 } 3487 }
3488 3488
3489 #pragma mark - 3489 #pragma mark -
3490 #pragma mark CRWRequestTrackerDelegate
3491
3492 - (void)updatedSSLStatus:(const web::SSLStatus&)sslStatus
3493 forPageUrl:(const GURL&)url
3494 userInfo:(id)userInfo {
3495 // |userInfo| is a CRWSessionEntry.
3496 web::NavigationItem* item =
3497 [static_cast<CRWSessionEntry*>(userInfo) navigationItem];
3498 if (!item)
3499 return; // This is a request update for an entry that no longer exists.
3500
3501 // This condition happens infrequently when a page load is misinterpreted as
3502 // a resource load from a previous page. This can happen when moving quickly
3503 // back and forth through history, the notifications from the web view on the
3504 // UI thread and the one from the requests at the net layer may get out of
3505 // sync. This catches this case and prevent updating an entry with the wrong
3506 // SSL data.
3507 if (item->GetURL().GetOrigin() != url.GetOrigin())
3508 return;
3509
3510 if (item->GetSSL().Equals(sslStatus))
3511 return; // No need to update with the same data.
3512
3513 item->GetSSL() = sslStatus;
3514
3515 // Notify the UI it needs to refresh if the updated entry is the current
3516 // entry.
3517 if (userInfo == self.currentSessionEntry) {
3518 [self didUpdateSSLStatusForCurrentNavigationItem];
3519 }
3520 }
3521
3522 - (void)handleResponseHeaders:(net::HttpResponseHeaders*)headers
3523 requestUrl:(const GURL&)requestUrl {
3524 _webStateImpl->OnHttpResponseHeadersReceived(headers, requestUrl);
3525 }
3526
3527 - (void)updatedProgress:(float)progress {
3528 // This is a UIWebView callback, which is no longer called.
3529 NOTREACHED();
3530 }
3531
3532 - (void)certificateUsed:(net::X509Certificate*)certificate
3533 forHost:(const std::string&)host
3534 status:(net::CertStatus)status {
3535 [[[self sessionController] sessionCertificatePolicyManager]
3536 registerAllowedCertificate:certificate
3537 forHost:host
3538 status:status];
3539 }
3540
3541 - (void)clearCertificates {
3542 [[[self sessionController] sessionCertificatePolicyManager]
3543 clearCertificates];
3544 }
3545
3546 #pragma mark -
3547 #pragma mark Popup handling 3490 #pragma mark Popup handling
3548 3491
3549 - (BOOL)shouldBlockPopupWithURL:(const GURL&)popupURL 3492 - (BOOL)shouldBlockPopupWithURL:(const GURL&)popupURL
3550 sourceURL:(const GURL&)sourceURL { 3493 sourceURL:(const GURL&)sourceURL {
3551 if (![_delegate respondsToSelector:@selector(webController: 3494 if (![_delegate respondsToSelector:@selector(webController:
3552 shouldBlockPopupWithURL: 3495 shouldBlockPopupWithURL:
3553 sourceURL:)]) { 3496 sourceURL:)]) {
3554 return NO; 3497 return NO;
3555 } 3498 }
3556 return [_delegate webController:self 3499 return [_delegate webController:self
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after
5488 } 5431 }
5489 5432
5490 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5433 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5491 } 5434 }
5492 5435
5493 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5436 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5494 return [action.request valueForHTTPHeaderField:@"Referer"]; 5437 return [action.request valueForHTTPHeaderField:@"Referer"];
5495 } 5438 }
5496 5439
5497 @end 5440 @end
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698