2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file webkit_csp_support_mock.h
18 * @author Andrzej Surdej (a.surdej@samsung.com)
19 * @brief Mock file for webkit csp api. File will be removed.
22 #ifndef WRT_SRC_API_NEW_WEBKIT_CSP_SUPPORT_H
23 #define WRT_SRC_API_NEW_WEBKIT_CSP_SUPPORT_H
26 #include <dpl/log/log.h>
27 #include <WebKit2/WKString.h>
30 INTERSECTION = 0, // only entries existing in both directives are used
31 SUM, // a sum of both directives is used
32 OVERWRITE, // applied directive overwrites existing one
33 IGNORE // ignore provided policy
36 typedef struct _CSP_Rules{
37 Algorithm default_src; //algorithm used to combine default-src
38 Algorithm other_src; //algorithm used to merge rest of policy
39 Algorithm sandbox; //algorithm used to merge sandbox policy
40 bool allow_unsafe; //are unsafe directives alloved
44 * The function is used to parse and merge given policy with existing one. The lifetime * of such policy is equal to the lifetime of the context. For report-uri the latest
45 * existing directive is used. It also used to set http/meta csp combining algorithm.
46 * @param context – the context for which the policy is applied
47 * @param policy – applied policy in form of a string
48 * @param CSP_Rules *local – defines CSP apply rules to combine default or manifest
50 * @param CSP_Rules *http_meta– defines CSP apply rules to combine http header csp
51 * poicy. If NULL provided use default algorithm - INTERSECTION.
52 * @return – error code returned if policy is malformed or some other argument is
56 int apply_csp(Ewk_Context* context, WKStringRef policy, CSP_Rules *local, CSP_Rules *http_meta)
58 LogDebug("Setting csp policy");
62 #endif /* WRT_SRC_API_NEW_WEBKIT_CSP_SUPPORT_H */