CanvasRenderer: Add Set/GetViewBox() API
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / web-engine-cookie-manager.h
1 #ifndef DALI_WEB_ENGINE_COOKIE_MANAGER_H
2 #define DALI_WEB_ENGINE_COOKIE_MANAGER_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <functional>
23 #include <string>
24
25 namespace Dali
26 {
27 /**
28  * @brief A class WebEngineCookieManager for cookie manager of web engine.
29  */
30 class WebEngineCookieManager
31 {
32 public:
33   /**
34    * @brief Enumeration for the cookies accept policies.
35    */
36   enum class CookieAcceptPolicy
37   {
38     ALWAYS,         ///< Accepts every cookie sent from any page.
39     NEVER,          ///< Rejects all the cookies.
40     NO_THIRD_PARTY, ///< Accepts only cookies set by the main document that is loaded.
41   };
42
43   /**
44    * @brief Enumeration for the cookie persistent storage type.
45    */
46   enum class CookiePersistentStorage
47   {
48     TEXT,   ///< Cookies are stored in a text file in the Mozilla "cookies.txt" format.
49     SQLITE, ///< Cookies are stored in a SQLite file in the current Mozilla format.
50   };
51
52   /**
53    * @brief Callback for changing watch.
54    */
55   using WebEngineCookieManagerChangesWatchCallback = std::function<void()>;
56
57   /**
58    * @brief Constructor.
59    */
60   WebEngineCookieManager() = default;
61
62   /**
63    * @brief Destructor.
64    */
65   virtual ~WebEngineCookieManager() = default;
66
67   /**
68    * @brief Sets @a policy as the cookie acceptance policy for @a manager.
69    * @details By default, only cookies set by the main document loaded are
70    *          accepted.
71    *
72    * @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy
73    */
74   virtual void SetCookieAcceptPolicy(CookieAcceptPolicy policy) = 0;
75
76   /**
77    * @brief Gets the cookie acceptance policy.
78    * The default is Toolkit::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY.
79    * @see Toolkit::WebEngineCookieManager::CookieAcceptPolicy::Type
80    */
81   virtual CookieAcceptPolicy GetCookieAcceptPolicy() const = 0;
82
83   /**
84    * @brief Deletes all the cookies of @a manager.
85    */
86   virtual void ClearCookies() = 0;
87
88   /**
89    * @brief Sets the @a path where non-session cookies are stored persistently using
90    *        @a storage as the format to read/write the cookies.
91    * @details Cookies are initially read from @a path/Cookies to create an initial
92    *          set of cookies. Then, non-session cookies will be written to @a path/Cookies.
93    *          By default, @a manager doesn't store the cookies persistently, so you need to
94    *          call this method to keep cookies saved across sessions.
95    *          If @a path does not exist it will be created.
96    * @param[in] path The path where to read/write Cookies
97    * @param[in] storage The type of storage
98    */
99   virtual void SetPersistentStorage(const std::string& path, CookiePersistentStorage storage) = 0;
100
101   /**
102    * @brief Watch for cookies' changes in @a manager.
103    *
104    * @param[in] callback function that will be called every time cookies are added, removed or modified.
105    */
106   virtual void ChangesWatch(WebEngineCookieManagerChangesWatchCallback callback) = 0;
107 };
108
109 } // namespace Dali
110
111 #endif // DALI_WEB_ENGINE_COOKIE_MANAGER_H