[Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebView...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Apr 2019 04:58:04 +0000 (04:58 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Apr 2019 04:58:04 +0000 (04:58 +0000)
commitb83c94e98b11f5dd0739bc4bd74395b1111405a6
treeaa9e4e98126f217abf967715df133dbf274edcc5
parent9b199a33e6aa7e4497703f6dc858e9b6df2532a8
[Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebViewConfiguration
https://bugs.webkit.org/show_bug.cgi?id=196284
<rdar://problem/47228232>

Reviewed by Tim Horton.

Tests for both of these APIs will be added in a subsequent patch.

* Shared/API/Cocoa/WebKit.h:
* UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::defaultWebsitePolicies const):
(API::PageConfiguration::setDefaultWebsitePolicies):
* UIProcess/API/APIPageConfiguration.h:
* UIProcess/API/Cocoa/WKNavigationDelegate.h:

Add a new navigation delegate hook to allow clients to return a WKWebpagePreference targeting the given
navigation action.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:

Add new API on WKWebViewConfiguration to specify a default WKWebpagePreference to use when navigating.

(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration defaultWebpagePreferences]):
(-[WKWebViewConfiguration setDefaultWebpagePreferences:]):
* UIProcess/API/Cocoa/WKWebpagePreferences.h:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):

Invoke the new WKWebpagePreferences-based navigation delegate method.

* WebKit.xcodeproj/project.pbxproj:
* mac/postprocess-framework-headers.sh:
* mac/replace-webkit-additions-in-framework-headers.sh: Added.

Move logic in the "Postprocess Framework Headers" step responsible for stripping away included files from
WebKitAdditions out into a separate build phase, called "Replace WebKitAdditions in Framework Headers". This
ensures headers attempting to include from WebKitAdditions have these additional statements removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebKit/ChangeLog
Source/WebKit/Shared/API/Cocoa/WebKit.h
Source/WebKit/UIProcess/API/APIPageConfiguration.cpp
Source/WebKit/UIProcess/API/APIPageConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.h
Source/WebKit/UIProcess/Cocoa/NavigationState.h
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/mac/postprocess-framework-headers.sh