/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
namespace Tizen.WebView
{
///
/// Enumeration for the cookies accept policies.
///
/// 4
public enum CookieAcceptPolicy
{
///
/// Accepts every cookie sent from any page.
///
Always,
///
/// Rejects all the cookies.
///
Never,
///
/// Accepts only cookies set by the main document that is loaded.
///
NoThirdParty
}
///
/// Enumeration for creating a type name for the storage of persistent cookies.
///
/// 4
public enum CookiePersistentStorage
{
///
/// Cookies are stored in a text file in the Mozilla "cookies.txt" format.
///
[Obsolete("Deprecated since API level 8.")]
Text,
///
/// Cookies are stored in a SQLite file in the current Mozilla format.
///
SqlLite
}
///
/// This class provides methods for the cookie manager.
///
/// 4
public class CookieManager
{
private IntPtr _handle;
internal CookieManager(IntPtr handle)
{
_handle = handle;
}
///
/// Sets the cookie acceptance policy.
///
///
/// By default, only cookies set by the main document that is loaded, are accepted.
///
/// The cookie acceptance policy.
/// 4
public void SetCookieAcceptPolicy(CookieAcceptPolicy policy)
{
Interop.ChromiumEwk.ewk_cookie_manager_accept_policy_set(_handle, (Interop.ChromiumEwk.CookieAcceptPolicy)policy);
}
///
/// Deletes all the cookies.
///
/// 4
public void ClearCookies()
{
Interop.ChromiumEwk.ewk_cookie_manager_cookies_clear(_handle);
}
///
/// Sets the storage where the non-session cookies are stored persistently, to read/write the cookies.
///
/// http://tizen.org/privilege/mediastorage
/// http://tizen.org/privilege/externalstorage
/// The path where to read/write cookies.
/// The type of storage.
/// 4
public void SetPersistentStorage(string path, CookiePersistentStorage storage)
{
Interop.ChromiumEwk.ewk_cookie_manager_persistent_storage_set(_handle, path, (Interop.ChromiumEwk.CookiePersistentStorage)storage);
}
}
}