LEFT | RIGHT |
1 /* | 1 /* |
2 * Copyright (C) 2010-2016 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010-2016 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 | 619 |
620 - (IBAction)printWebView:(id)sender | 620 - (IBAction)printWebView:(id)sender |
621 { | 621 { |
622 [[_webView _printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]] runOp
erationModalForWindow:self.window delegate:nil didRunSelector:nil contextInfo:ni
l]; | 622 [[_webView _printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]] runOp
erationModalForWindow:self.window delegate:nil didRunSelector:nil contextInfo:ni
l]; |
623 } | 623 } |
624 | 624 |
625 #pragma mark WKNavigationDelegate | 625 #pragma mark WKNavigationDelegate |
626 | 626 |
627 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
onAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))
decisionHandler | 627 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
onAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))
decisionHandler |
628 { | 628 { |
629 fprintf(stderr, "decidePolicyForNavigationAction %s\n", navigationAction.req
uest.URL.absoluteString.UTF8String); | |
630 LOG(@"decidePolicyForNavigationAction"); | 629 LOG(@"decidePolicyForNavigationAction"); |
631 | 630 |
632 if (navigationAction._canHandleRequest) { | 631 if (navigationAction._canHandleRequest) { |
633 decisionHandler(WKNavigationActionPolicyAllow); | 632 decisionHandler(WKNavigationActionPolicyAllow); |
634 return; | 633 return; |
635 } | 634 } |
636 | 635 |
637 if (navigationAction._userInitiatedAction && !navigationAction._userInitiate
dAction.isConsumed) { | 636 if (navigationAction._userInitiatedAction && !navigationAction._userInitiate
dAction.isConsumed) { |
638 [navigationAction._userInitiatedAction consume]; | 637 [navigationAction._userInitiatedAction consume]; |
639 [[NSWorkspace sharedWorkspace] openURL:navigationAction.request.URL]; | 638 [[NSWorkspace sharedWorkspace] openURL:navigationAction.request.URL]; |
640 } | 639 } |
641 | 640 |
642 decisionHandler(WKNavigationActionPolicyCancel); | 641 decisionHandler(WKNavigationActionPolicyCancel); |
643 } | 642 } |
644 | 643 |
645 - (void)webView:(WKWebView *)webView decidePolicyForSafeBrowsingResultForNavigat
ionAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKSaf
eBrowsingResultPolicy))decisionHandler | 644 - (void)webView:(WKWebView *)webView decidePolicyForSafeBrowsingResultForNavigat
ionAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKSaf
eBrowsingResultPolicy))decisionHandler |
646 { | 645 { |
647 fprintf(stderr, "Delegate found out about a SafeBrowsing failure! For %s\n",
navigationAction.request.URL.absoluteString.UTF8String); | |
648 decisionHandler(WKSafeBrowsingResultPolicyCancelAndShowWarning); | 646 decisionHandler(WKSafeBrowsingResultPolicyCancelAndShowWarning); |
649 } | 647 } |
650 | 648 |
651 - (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNaviga
tionResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponse
Policy))decisionHandler | 649 - (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNaviga
tionResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponse
Policy))decisionHandler |
652 { | 650 { |
653 fprintf(stderr, "decidePolicyForNavigationResposne %s\n", navigationResponse
.response.URL.absoluteString.UTF8String); | |
654 LOG(@"decidePolicyForNavigationResponse"); | 651 LOG(@"decidePolicyForNavigationResponse"); |
655 decisionHandler(WKNavigationResponsePolicyAllow); | 652 decisionHandler(WKNavigationResponsePolicyAllow); |
656 } | 653 } |
657 | 654 |
658 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation
*)navigation | 655 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation
*)navigation |
659 { | 656 { |
660 fprintf(stderr, "didStartProvisionalNavigation %p %s\n", navigation, webView
.URL.absoluteString.UTF8String); | |
661 LOG(@"didStartProvisionalNavigation: %@", navigation); | 657 LOG(@"didStartProvisionalNavigation: %@", navigation); |
662 } | 658 } |
663 | 659 |
664 - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavig
ation:(WKNavigation *)navigation | 660 - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavig
ation:(WKNavigation *)navigation |
665 { | 661 { |
666 LOG(@"didReceiveServerRedirectForProvisionalNavigation: %@", navigation); | 662 LOG(@"didReceiveServerRedirectForProvisionalNavigation: %@", navigation); |
667 } | 663 } |
668 | 664 |
669 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation
*)navigation withError:(NSError *)error | 665 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation
*)navigation withError:(NSError *)error |
670 { | 666 { |
671 fprintf(stderr, "didFailProvisionalNavigation %p %s\n", navigation, webView.
URL.absoluteString.UTF8String); | |
672 LOG(@"didFailProvisionalNavigation: %@navigation, error: %@", navigation, er
ror); | 667 LOG(@"didFailProvisionalNavigation: %@navigation, error: %@", navigation, er
ror); |
673 } | 668 } |
674 | 669 |
675 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigat
ion | 670 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigat
ion |
676 { | 671 { |
677 fprintf(stderr, "didCommitNavigation %p %s\n", navigation, webView.URL.absol
uteString.UTF8String); | |
678 LOG(@"didCommitNavigation: %@", navigation); | 672 LOG(@"didCommitNavigation: %@", navigation); |
679 [self updateTitle:nil]; | 673 [self updateTitle:nil]; |
680 } | 674 } |
681 | 675 |
682 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigat
ion | 676 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigat
ion |
683 { | 677 { |
684 fprintf(stderr, "didFinishNavigation %p %s\n", navigation, webView.URL.absol
uteString.UTF8String); | |
685 LOG(@"didFinishNavigation: %@", navigation); | 678 LOG(@"didFinishNavigation: %@", navigation); |
686 ···· | 679 ···· |
687 // Banner heights don't persist across page loads (oddly, since Page stores
them), so reset on every page load. | 680 // Banner heights don't persist across page loads (oddly, since Page stores
them), so reset on every page load. |
688 if ([[SettingsController shared] isSpaceReservedForBanners]) { | 681 if ([[SettingsController shared] isSpaceReservedForBanners]) { |
689 [_webView _setHeaderBannerHeight:testHeaderBannerHeight]; | 682 [_webView _setHeaderBannerHeight:testHeaderBannerHeight]; |
690 [_webView _setFooterBannerHeight:testFooterBannerHeight]; | 683 [_webView _setFooterBannerHeight:testFooterBannerHeight]; |
691 } | 684 } |
692 } | 685 } |
693 | 686 |
694 - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAut
henticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthCha
llengeDisposition disposition, NSURLCredential *__nullable credential))completio
nHandler | 687 - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAut
henticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthCha
llengeDisposition disposition, NSURLCredential *__nullable credential))completio
nHandler |
(...skipping 22 matching lines...) Expand all Loading... |
717 completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace
, nil); | 710 completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace
, nil); |
718 [alert release]; | 711 [alert release]; |
719 }]; | 712 }]; |
720 return; | 713 return; |
721 } | 714 } |
722 completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil); | 715 completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil); |
723 } | 716 } |
724 | 717 |
725 - (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigatio
n withError:(NSError *)error | 718 - (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigatio
n withError:(NSError *)error |
726 { | 719 { |
727 fprintf(stderr, "didFinishNavigation %p %s\n", navigation, webView.URL.absol
uteString.UTF8String); | |
728 LOG(@"didFailNavigation: %@, error %@", navigation, error); | 720 LOG(@"didFailNavigation: %@, error %@", navigation, error); |
729 } | 721 } |
730 | 722 |
731 - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView | 723 - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView |
732 { | 724 { |
733 NSLog(@"WebContent process crashed; reloading"); | 725 NSLog(@"WebContent process crashed; reloading"); |
734 [self reload:nil]; | 726 [self reload:nil]; |
735 } | 727 } |
736 | 728 |
737 - (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingPr
ogressEvents)progressEvents | 729 - (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingPr
ogressEvents)progressEvents |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 return _webView; | 792 return _webView; |
801 } | 793 } |
802 | 794 |
803 - (void)findBarViewDidChangeHeight | 795 - (void)findBarViewDidChangeHeight |
804 { | 796 { |
805 } | 797 } |
806 | 798 |
807 @end | 799 @end |
808 | 800 |
809 #endif // WK_API_ENABLED | 801 #endif // WK_API_ENABLED |
LEFT | RIGHT |