Unreviewed, rolling out r245401.
[WebKit-https.git] / Source / WebKit / UIProcess / API / Cocoa / _WKWebsitePolicies.mm
1 /*
2  * Copyright (C) 2016 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #import "config.h"
27
28 #import "WKWebpagePreferencesInternal.h"
29 #import "WKWebsiteDataStoreInternal.h"
30 #import "_WKWebsitePoliciesInternal.h"
31
32 @implementation _WKWebsitePolicies
33
34 - (instancetype)init
35 {
36     if (!(self = [super init]))
37         return nil;
38
39     _webpagePreferences = adoptNS([[WKWebpagePreferences alloc] init]);
40     return self;
41 }
42
43 - (WKWebpagePreferences *)webpagePreferences
44 {
45     return _webpagePreferences.get();
46 }
47
48 - (void)setContentBlockersEnabled:(BOOL)contentBlockersEnabled
49 {
50     [_webpagePreferences _setContentBlockersEnabled:contentBlockersEnabled];
51 }
52
53 - (BOOL)contentBlockersEnabled
54 {
55     return [_webpagePreferences _contentBlockersEnabled];
56 }
57
58 - (void)setAllowedAutoplayQuirks:(_WKWebsiteAutoplayQuirk)allowedQuirks
59 {
60     [_webpagePreferences _setAllowedAutoplayQuirks:allowedQuirks];
61 }
62
63 - (_WKWebsiteAutoplayQuirk)allowedAutoplayQuirks
64 {
65     return [_webpagePreferences _allowedAutoplayQuirks];
66 }
67
68 - (void)setAutoplayPolicy:(_WKWebsiteAutoplayPolicy)policy
69 {
70     [_webpagePreferences _setAutoplayPolicy:policy];
71 }
72
73 - (_WKWebsiteAutoplayPolicy)autoplayPolicy
74 {
75     return [_webpagePreferences _autoplayPolicy];
76 }
77
78 - (void)setDeviceOrientationAndMotionAccessPolicy:(_WKWebsiteDeviceOrientationAndMotionAccessPolicy)policy
79 {
80     [_webpagePreferences _setDeviceOrientationAndMotionAccessPolicy:policy];
81 }
82
83 - (_WKWebsiteDeviceOrientationAndMotionAccessPolicy)deviceOrientationAndMotionAccessPolicy
84 {
85     return [_webpagePreferences _deviceOrientationAndMotionAccessPolicy];
86 }
87
88 - (void)setPopUpPolicy:(_WKWebsitePopUpPolicy)policy
89 {
90     [_webpagePreferences _setPopUpPolicy:policy];
91 }
92
93 - (_WKWebsitePopUpPolicy)popUpPolicy
94 {
95     return [_webpagePreferences _popUpPolicy];
96 }
97
98 - (NSDictionary<NSString *, NSString *> *)customHeaderFields
99 {
100     return [_webpagePreferences _customHeaderFields];
101 }
102
103 - (void)setCustomHeaderFields:(NSDictionary<NSString *, NSString *> *)fields
104 {
105     [_webpagePreferences _setCustomHeaderFields:fields];
106 }
107
108 - (WKWebsiteDataStore *)websiteDataStore
109 {
110     return [_webpagePreferences _websiteDataStore];
111 }
112
113 - (void)setWebsiteDataStore:(WKWebsiteDataStore *)websiteDataStore
114 {
115     [_webpagePreferences _setWebsiteDataStore:websiteDataStore];
116 }
117
118 - (void)setCustomUserAgent:(NSString *)customUserAgent
119 {
120     [_webpagePreferences _setCustomUserAgent:customUserAgent];
121 }
122
123 - (NSString *)customUserAgent
124 {
125     return [_webpagePreferences _customUserAgent];
126 }
127
128 - (void)setCustomJavaScriptUserAgentAsSiteSpecificQuirks:(NSString *)customUserAgent
129 {
130     [_webpagePreferences _setCustomJavaScriptUserAgentAsSiteSpecificQuirks:customUserAgent];
131 }
132
133 - (NSString *)customJavaScriptUserAgentAsSiteSpecificQuirks
134 {
135     return [_webpagePreferences _customJavaScriptUserAgentAsSiteSpecificQuirks];
136 }
137
138 - (void)setCustomNavigatorPlatform:(NSString *)customNavigatorPlatform
139 {
140     [_webpagePreferences _setCustomNavigatorPlatform:customNavigatorPlatform];
141 }
142
143 - (NSString *)customNavigatorPlatform
144 {
145     return [_webpagePreferences _customNavigatorPlatform];
146 }
147
148 - (NSString *)description
149 {
150     return [NSString stringWithFormat:@"<%@ %@>", self.class, [_webpagePreferences description]];
151 }
152
153 - (API::Object&)_apiObject
154 {
155     return [_webpagePreferences _apiObject];
156 }
157
158 @end