Implement some new ewk apis in web view.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-cookie-manager.h
1 #ifndef DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
2 #define DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
3
4 /*
5  * Copyright (c) 2020 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 <string>
23 #include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/dali-toolkit-common.h>
27
28 namespace Dali
29 {
30 class WebEngineCookieManager;
31
32 namespace Toolkit
33 {
34
35 /**
36  * @addtogroup dali_toolkit_controls_web_view
37  * @{
38  */
39
40 /**
41  * @brief WebCookieManager is a control for settings of WebView.
42  *
43  *
44  * For working WebCookieManager, a WebView should be provided.
45  *
46  */
47 class DALI_TOOLKIT_API WebCookieManager
48 {
49 public:
50
51   /**
52    * @brief Creates a WebCookieManager.
53    * @param[in] manager A #Dali::WebEngineCookieManager
54    */
55   WebCookieManager( Dali::WebEngineCookieManager& manager );
56
57   /**
58    * @brief Destructor.
59    */
60   virtual ~WebCookieManager() final;
61
62   /**
63    * @brief Sets @a policy as the cookie acceptance policy for @a manager.
64    *
65    * @details By default, only cookies set by the main document loaded are
66    *          accepted.
67    *
68    * @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy
69    */
70   void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy );
71
72   /**
73    * @brief Gets the cookie acceptance policy. The default is Toolkit::WebCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY.
74    * @see Dali::WebEngineCookieManager::CookieAcceptPolicy
75    */
76   Dali::WebEngineCookieManager::CookieAcceptPolicy GetCookieAcceptPolicy() const;
77
78   /**
79    * @brief Deletes all the cookies of @a manager.
80    */
81   void ClearCookies();
82
83   /**
84    * @brief Sets the @a path where non-session cookies are stored persistently using
85    *        @a storage as the format to read/write the cookies.
86    *
87    * @details Cookies are initially read from @a path/Cookies to create an initial
88    *          set of cookies. Then, non-session cookies will be written to @a path/Cookies.
89    *          By default, @a manager doesn't store the cookies persistently, so you need to
90    *          call this method to keep cookies saved across sessions.
91    *          If @a path does not exist it will be created.
92    *
93    * @param[in] path The path where to read/write Cookies
94    * @param[in] storage The type of storage
95    */
96   void SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage );
97
98 private:
99
100   Dali::WebEngineCookieManager&  mWebEngineCookieManager;
101 };
102
103 /**
104  * @}
105  */
106
107 } // namespace Toolkit
108
109 } // namespace Dali
110
111 #endif // DALI_TOOLKIT_WEB_COOKIE_MANAGER_H