2 * Copyright (c) 2017 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.
18 namespace Tizen.WebView
21 /// Enumeration that contains accept policies for the cookies.
23 public enum CookieAcceptPolicy
25 Always, /* Accepts every cookie sent from any page */
26 Never, /* Rejects all cookies */
27 NoThirdParty /* Accepts only cookies set by the main document loaded */
31 /// Enumeration that creates a type name for the storage of persistent cookies.
33 public enum CookiePersistentStorage
35 Text, /* Cookies are stored in a text file in the Mozilla "cookies.txt" format */
36 SqlLite /* Cookies are stored in a SQLite file in the current Mozilla format. */
39 public class CookieManager
41 private IntPtr _handle;
43 internal CookieManager(IntPtr handle)
49 /// Sets the cookie acceptance policy.
52 /// By default, only cookies set by the main document loaded are accepted.
54 /// <param name="policy">The cookie acceptance policy</param>
55 public void SetCookieAcceptPolicy(CookieAcceptPolicy policy)
57 Interop.ChromiumEwk.ewk_cookie_manager_accept_policy_set(_handle, (Interop.ChromiumEwk.CookieAcceptPolicy)policy);
61 /// Deletes all the cookies.
63 public void ClearCookies()
65 Interop.ChromiumEwk.ewk_cookie_manager_cookies_clear(_handle);
69 /// Sets the storage where non-session cookies are stored persistently to read/write the cookies.
72 /// http://tizen.org/privilege/mediastorage
73 /// http://tizen.org/privilege/externalstorage
75 /// <param name="path">The path where to read/write Cookies</param>
76 /// <param name="storage">The type of storage</param>
77 public void SetPersistentStorage(string path, CookiePersistentStorage storage)
79 Interop.ChromiumEwk.ewk_cookie_manager_persistent_storage_set(_handle, path, (Interop.ChromiumEwk.CookiePersistentStorage)storage);