Add pop-up policy support in website policies.
[WebKit-https.git] / Source / WebKit / UIProcess / API / Cocoa / _WKWebsitePolicies.mm
index ac960b4..29b7380 100644 (file)
     }
 }
 
+- (void)setPopUpPolicy:(_WKWebsitePopUpPolicy)policy
+{
+    switch (policy) {
+    case _WKWebsitePopUpPolicyDefault:
+        _websitePolicies->setPopUpPolicy(WebKit::WebsitePopUpPolicy::Default);
+        break;
+    case _WKWebsitePopUpPolicyAllow:
+        _websitePolicies->setPopUpPolicy(WebKit::WebsitePopUpPolicy::Allow);
+        break;
+    case _WKWebsitePopUpPolicyBlock:
+        _websitePolicies->setPopUpPolicy(WebKit::WebsitePopUpPolicy::Block);
+        break;
+    }
+}
+
+- (_WKWebsitePopUpPolicy)popUpPolicy
+{
+    switch (_websitePolicies->popUpPolicy()) {
+    case WebKit::WebsitePopUpPolicy::Default:
+        return _WKWebsitePopUpPolicyDefault;
+    case WebKit::WebsitePopUpPolicy::Allow:
+        return _WKWebsitePopUpPolicyAllow;
+    case WebKit::WebsitePopUpPolicy::Block:
+        return _WKWebsitePopUpPolicyBlock;
+    }
+}
+
 - (NSDictionary<NSString *, NSString *> *)customHeaderFields
 {
     const auto& fields = _websitePolicies->customHeaderFields();