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

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

Issue 2225943002: [ios] Purge web view if external app URL is current in navigation stack. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 4 years, 4 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 | « no previous file | 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 3325 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 // application? For example, only allow it for TYPED and LINK transitions. 3336 // application? For example, only allow it for TYPED and LINK transitions.
3337 if (![CRWWebController webControllerCanShow:requestURL]) { 3337 if (![CRWWebController webControllerCanShow:requestURL]) {
3338 if (![self shouldOpenExternalURLForNavigationAction:action]) { 3338 if (![self shouldOpenExternalURLForNavigationAction:action]) {
3339 return NO; 3339 return NO;
3340 } 3340 }
3341 3341
3342 // Stop load if navigation is believed to be happening on the main frame. 3342 // Stop load if navigation is believed to be happening on the main frame.
3343 if ([self isMainFrameNavigationAction:action]) 3343 if ([self isMainFrameNavigationAction:action])
3344 [self stopLoading]; 3344 [self stopLoading];
3345 3345
3346 // Purge web view if last committed URL is different from the document URL.
3347 // This can happen if external URL was added to the navigation stack and was
3348 // loaded using Go Back or Go Forward navigation (in which case document URL
3349 // will point to the previous page).
3350 GURL lastCommittedURL =
3351 self.webState->GetNavigationManager()->GetLastCommittedItem()->GetURL();
3352 if (lastCommittedURL != _documentURL) {
3353 [self requirePageReconstruction];
3354 [self setDocumentURL:lastCommittedURL];
3355 }
3356
3346 if ([_delegate openExternalURL:requestURL 3357 if ([_delegate openExternalURL:requestURL
3347 linkClicked:isNavigationTypeLinkActivated]) { 3358 linkClicked:isNavigationTypeLinkActivated]) {
3348 // Record the URL so that errors reported following the 'NO' reply can be 3359 // Record the URL so that errors reported following the 'NO' reply can be
3349 // safely ignored. 3360 // safely ignored.
3350 [_openedApplicationURL addObject:request.URL]; 3361 [_openedApplicationURL addObject:request.URL];
3351 if ([self shouldClosePageOnNativeApplicationLoad]) 3362 if ([self shouldClosePageOnNativeApplicationLoad])
3352 [_delegate webPageOrderedClose]; 3363 [_delegate webPageOrderedClose];
3353 } 3364 }
3354 return NO; 3365 return NO;
3355 } 3366 }
(...skipping 2278 matching lines...) Expand 10 before | Expand all | Expand 10 after
5634 } 5645 }
5635 5646
5636 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; 5647 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC;
5637 } 5648 }
5638 5649
5639 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { 5650 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action {
5640 return [action.request valueForHTTPHeaderField:@"Referer"]; 5651 return [action.request valueForHTTPHeaderField:@"Referer"];
5641 } 5652 }
5642 5653
5643 @end 5654 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698