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 3382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3393 return NO; | 3393 return NO; |
3394 } | 3394 } |
3395 | 3395 |
3396 // Check if the link navigation leads to a launch of an external app. | 3396 // Check if the link navigation leads to a launch of an external app. |
3397 // TODO(crbug.com/607780): Revise the logic of allowing external app launch | 3397 // TODO(crbug.com/607780): Revise the logic of allowing external app launch |
3398 // and move it to externalAppLauncher. | 3398 // and move it to externalAppLauncher. |
3399 BOOL isOpenInNewTabNavigation = | 3399 BOOL isOpenInNewTabNavigation = |
3400 !_webStateImpl->GetNavigationManager()->GetItemCount(); | 3400 !_webStateImpl->GetNavigationManager()->GetItemCount(); |
3401 BOOL isPossibleLinkClick = [self isLinkNavigation:action.navigationType]; | 3401 BOOL isPossibleLinkClick = [self isLinkNavigation:action.navigationType]; |
3402 if (isPossibleLinkClick || isOpenInNewTabNavigation || | 3402 if (isPossibleLinkClick || isOpenInNewTabNavigation || |
3403 [self currentTransition] == ui::PAGE_TRANSITION_AUTO_BOOKMARK) { | 3403 PageTransitionCoreTypeIs([self currentTransition], |
| 3404 ui::PAGE_TRANSITION_AUTO_BOOKMARK)) { |
3404 // Check If the URL is handled by a native app. | 3405 // Check If the URL is handled by a native app. |
3405 if ([self urlTriggersNativeAppLaunch:requestURL | 3406 if ([self urlTriggersNativeAppLaunch:requestURL |
3406 sourceURL:[self currentNavigationURL] | 3407 sourceURL:[self currentNavigationURL] |
3407 linkActivatedNavigation:isNavigationTypeLinkActivated]) { | 3408 linkActivatedNavigation:isNavigationTypeLinkActivated]) { |
3408 // External app has been launched successfully. Stop the current page | 3409 // External app has been launched successfully. Stop the current page |
3409 // load operation (e.g. notifying all observers) and record the URL so | 3410 // load operation (e.g. notifying all observers) and record the URL so |
3410 // that errors reported following the 'NO' reply can be safely ignored. | 3411 // that errors reported following the 'NO' reply can be safely ignored. |
3411 if ([self shouldClosePageOnNativeApplicationLoad]) | 3412 if ([self shouldClosePageOnNativeApplicationLoad]) |
3412 [_delegate webPageOrderedClose]; | 3413 [_delegate webPageOrderedClose]; |
3413 [self stopLoading]; | 3414 [self stopLoading]; |
(...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5792 } | 5793 } |
5793 | 5794 |
5794 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5795 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
5795 } | 5796 } |
5796 | 5797 |
5797 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5798 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
5798 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5799 return [action.request valueForHTTPHeaderField:@"Referer"]; |
5799 } | 5800 } |
5800 | 5801 |
5801 @end | 5802 @end |
OLD | NEW |