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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 preferences._compositingRepaintCountersVisible = settings.layerBordersVisibl
e; | 401 preferences._compositingRepaintCountersVisible = settings.layerBordersVisibl
e; |
402 preferences._simpleLineLayoutEnabled = settings.simpleLineLayoutEnabled; | 402 preferences._simpleLineLayoutEnabled = settings.simpleLineLayoutEnabled; |
403 preferences._simpleLineLayoutDebugBordersEnabled = settings.simpleLineLayout
DebugBordersEnabled; | 403 preferences._simpleLineLayoutDebugBordersEnabled = settings.simpleLineLayout
DebugBordersEnabled; |
404 preferences._acceleratedDrawingEnabled = settings.acceleratedDrawingEnabled; | 404 preferences._acceleratedDrawingEnabled = settings.acceleratedDrawingEnabled; |
405 preferences._resourceUsageOverlayVisible = settings.resourceUsageOverlayVisi
ble; | 405 preferences._resourceUsageOverlayVisible = settings.resourceUsageOverlayVisi
ble; |
406 preferences._displayListDrawingEnabled = settings.displayListDrawingEnabled; | 406 preferences._displayListDrawingEnabled = settings.displayListDrawingEnabled; |
407 preferences._subpixelAntialiasedLayerTextEnabled = settings.subpixelAntialia
sedLayerTextEnabled; | 407 preferences._subpixelAntialiasedLayerTextEnabled = settings.subpixelAntialia
sedLayerTextEnabled; |
408 preferences._visualViewportEnabled = settings.visualViewportEnabled; | 408 preferences._visualViewportEnabled = settings.visualViewportEnabled; |
409 preferences._largeImageAsyncDecodingEnabled = settings.largeImageAsyncDecodi
ngEnabled; | 409 preferences._largeImageAsyncDecodingEnabled = settings.largeImageAsyncDecodi
ngEnabled; |
410 preferences._animatedImageAsyncDecodingEnabled = settings.animatedImageAsync
DecodingEnabled; | 410 preferences._animatedImageAsyncDecodingEnabled = settings.animatedImageAsync
DecodingEnabled; |
| 411 preferences.safeBrowsingEnabled = settings.safeBrowsingEnabled; |
411 | 412 |
412 _webView.configuration.websiteDataStore._resourceLoadStatisticsEnabled = set
tings.resourceLoadStatisticsEnabled; | 413 _webView.configuration.websiteDataStore._resourceLoadStatisticsEnabled = set
tings.resourceLoadStatisticsEnabled; |
413 | 414 |
414 BOOL useTransparentWindows = settings.useTransparentWindows; | 415 BOOL useTransparentWindows = settings.useTransparentWindows; |
415 if (useTransparentWindows != !_webView._drawsBackground) { | 416 if (useTransparentWindows != !_webView._drawsBackground) { |
416 [self.window setOpaque:!useTransparentWindows]; | 417 [self.window setOpaque:!useTransparentWindows]; |
417 [self.window setBackgroundColor:[NSColor clearColor]]; | 418 [self.window setBackgroundColor:[NSColor clearColor]]; |
418 [self.window setHasShadow:!useTransparentWindows]; | 419 [self.window setHasShadow:!useTransparentWindows]; |
419 | 420 |
420 _webView._drawsBackground = !useTransparentWindows; | 421 _webView._drawsBackground = !useTransparentWindows; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 | 620 |
620 - (IBAction)printWebView:(id)sender | 621 - (IBAction)printWebView:(id)sender |
621 { | 622 { |
622 [[_webView _printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]] runOp
erationModalForWindow:self.window delegate:nil didRunSelector:nil contextInfo:ni
l]; | 623 [[_webView _printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]] runOp
erationModalForWindow:self.window delegate:nil didRunSelector:nil contextInfo:ni
l]; |
623 } | 624 } |
624 | 625 |
625 #pragma mark WKNavigationDelegate | 626 #pragma mark WKNavigationDelegate |
626 | 627 |
627 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
onAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))
decisionHandler | 628 - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
onAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))
decisionHandler |
628 { | 629 { |
629 fprintf(stderr, "decidePolicyForNavigationAction %s\n", navigationAction.req
uest.URL.absoluteString.UTF8String); | |
630 LOG(@"decidePolicyForNavigationAction"); | 630 LOG(@"decidePolicyForNavigationAction"); |
631 | 631 |
632 if (navigationAction._canHandleRequest) { | 632 if (navigationAction._canHandleRequest) { |
633 decisionHandler(WKNavigationActionPolicyAllow); | 633 decisionHandler(WKNavigationActionPolicyAllow); |
634 return; | 634 return; |
635 } | 635 } |
636 | 636 |
637 if (navigationAction._userInitiatedAction && !navigationAction._userInitiate
dAction.isConsumed) { | 637 if (navigationAction._userInitiatedAction && !navigationAction._userInitiate
dAction.isConsumed) { |
638 [navigationAction._userInitiatedAction consume]; | 638 [navigationAction._userInitiatedAction consume]; |
639 [[NSWorkspace sharedWorkspace] openURL:navigationAction.request.URL]; | 639 [[NSWorkspace sharedWorkspace] openURL:navigationAction.request.URL]; |
640 } | 640 } |
641 | 641 |
642 decisionHandler(WKNavigationActionPolicyCancel); | 642 decisionHandler(WKNavigationActionPolicyCancel); |
643 } | 643 } |
644 | 644 |
645 - (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNaviga
tionResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponse
Policy))decisionHandler | 645 - (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNaviga
tionResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponse
Policy))decisionHandler |
646 { | 646 { |
647 fprintf(stderr, "decidePolicyForNavigationResposne %s\n", navigationResponse
.response.URL.absoluteString.UTF8String); | |
648 LOG(@"decidePolicyForNavigationResponse"); | 647 LOG(@"decidePolicyForNavigationResponse"); |
649 decisionHandler(WKNavigationResponsePolicyAllow); | 648 decisionHandler(WKNavigationResponsePolicyAllow); |
650 } | 649 } |
651 | 650 |
652 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation
*)navigation | 651 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation
*)navigation |
653 { | 652 { |
654 fprintf(stderr, "didStartProvisionalNavigation %p %s\n", navigation, webView
.URL.absoluteString.UTF8String); | |
655 LOG(@"didStartProvisionalNavigation: %@", navigation); | 653 LOG(@"didStartProvisionalNavigation: %@", navigation); |
656 } | 654 } |
657 | 655 |
658 - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavig
ation:(WKNavigation *)navigation | 656 - (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavig
ation:(WKNavigation *)navigation |
659 { | 657 { |
660 LOG(@"didReceiveServerRedirectForProvisionalNavigation: %@", navigation); | 658 LOG(@"didReceiveServerRedirectForProvisionalNavigation: %@", navigation); |
661 } | 659 } |
662 | 660 |
663 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation
*)navigation withError:(NSError *)error | 661 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation
*)navigation withError:(NSError *)error |
664 { | 662 { |
665 fprintf(stderr, "didFailProvisionalNavigation %p %s\n", navigation, webView.
URL.absoluteString.UTF8String); | |
666 LOG(@"didFailProvisionalNavigation: %@navigation, error: %@", navigation, er
ror); | 663 LOG(@"didFailProvisionalNavigation: %@navigation, error: %@", navigation, er
ror); |
667 } | 664 } |
668 | 665 |
669 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigat
ion | 666 - (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigat
ion |
670 { | 667 { |
671 fprintf(stderr, "didCommitNavigation %p %s\n", navigation, webView.URL.absol
uteString.UTF8String); | |
672 LOG(@"didCommitNavigation: %@", navigation); | 668 LOG(@"didCommitNavigation: %@", navigation); |
673 [self updateTitle:nil]; | 669 [self updateTitle:nil]; |
674 } | 670 } |
675 | 671 |
676 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigat
ion | 672 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigat
ion |
677 { | 673 { |
678 fprintf(stderr, "didFinishNavigation %p %s\n", navigation, webView.URL.absol
uteString.UTF8String); | |
679 LOG(@"didFinishNavigation: %@", navigation); | 674 LOG(@"didFinishNavigation: %@", navigation); |
680 ···· | 675 ···· |
681 // Banner heights don't persist across page loads (oddly, since Page stores
them), so reset on every page load. | 676 // Banner heights don't persist across page loads (oddly, since Page stores
them), so reset on every page load. |
682 if ([[SettingsController shared] isSpaceReservedForBanners]) { | 677 if ([[SettingsController shared] isSpaceReservedForBanners]) { |
683 [_webView _setHeaderBannerHeight:testHeaderBannerHeight]; | 678 [_webView _setHeaderBannerHeight:testHeaderBannerHeight]; |
684 [_webView _setFooterBannerHeight:testFooterBannerHeight]; | 679 [_webView _setFooterBannerHeight:testFooterBannerHeight]; |
685 } | 680 } |
686 } | 681 } |
687 | 682 |
688 - (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAut
henticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthCha
llengeDisposition disposition, NSURLCredential *__nullable credential))completio
nHandler | 683 - (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... |
711 completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace
, nil); | 706 completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace
, nil); |
712 [alert release]; | 707 [alert release]; |
713 }]; | 708 }]; |
714 return; | 709 return; |
715 } | 710 } |
716 completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil); | 711 completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil); |
717 } | 712 } |
718 | 713 |
719 - (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigatio
n withError:(NSError *)error | 714 - (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigatio
n withError:(NSError *)error |
720 { | 715 { |
721 fprintf(stderr, "didFinishNavigation %p %s\n", navigation, webView.URL.absol
uteString.UTF8String); | |
722 LOG(@"didFailNavigation: %@, error %@", navigation, error); | 716 LOG(@"didFailNavigation: %@, error %@", navigation, error); |
723 } | 717 } |
724 | 718 |
725 - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView | 719 - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView |
726 { | 720 { |
727 NSLog(@"WebContent process crashed; reloading"); | 721 NSLog(@"WebContent process crashed; reloading"); |
728 [self reload:nil]; | 722 [self reload:nil]; |
729 } | 723 } |
730 | 724 |
731 - (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingPr
ogressEvents)progressEvents | 725 - (void)_webView:(WKWebView *)webView renderingProgressDidChange:(_WKRenderingPr
ogressEvents)progressEvents |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 return _webView; | 788 return _webView; |
795 } | 789 } |
796 | 790 |
797 - (void)findBarViewDidChangeHeight | 791 - (void)findBarViewDidChangeHeight |
798 { | 792 { |
799 } | 793 } |
800 | 794 |
801 @end | 795 @end |
802 | 796 |
803 #endif // WK_API_ENABLED | 797 #endif // WK_API_ENABLED |
LEFT | RIGHT |