[Tizen] Implement some new ewk apis in web engine plugin.
[platform/core/uifw/dali-extension.git] / dali-extension / web-engine-chromium / tizen-web-engine-cookie-manager.h
1 #ifndef DALI_PLUGIN_WEB_ENGINE_COOKIE_MANAGER_H
2 #define DALI_PLUGIN_WEB_ENGINE_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 struct Ewk_Cookie_Manager;
26
27 namespace Dali
28 {
29 namespace Plugin
30 {
31
32 /**
33  * @brief A class TizenWebEngineCookieManager for cookie manager of chromium.
34  */
35 class TizenWebEngineCookieManager : public Dali::WebEngineCookieManager
36 {
37
38 public:
39
40   /**
41    * @brief Constructor.
42    */
43   TizenWebEngineCookieManager( Ewk_Cookie_Manager* );
44
45   /**
46    * @brief Destructor.
47    */
48   ~TizenWebEngineCookieManager();
49
50   /**
51    * @brief Sets @a policy as the cookie acceptance policy for @a manager.
52    *
53    * @details By default, only cookies set by the main document loaded are
54    *          accepted.
55    *
56    * @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy
57    */
58   void SetCookieAcceptPolicy( CookieAcceptPolicy policy ) override;
59
60   /**
61    * @brief Gets the cookie acceptance policy.
62    * The default is Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY.
63    * @see Dali::WebEngineCookieManager::CookieAcceptPolicy::Type
64    */
65   CookieAcceptPolicy GetCookieAcceptPolicy() const override;
66
67   /**
68    * @brief Sets the @a path where non-session cookies are stored persistently using
69    *        @a storage as the format to read/write the cookies.
70    *
71    * @details Cookies are initially read from @a path/Cookies to create an initial
72    *          set of cookies. Then, non-session cookies will be written to @a path/Cookies.
73    *          By default, @a manager doesn't store the cookies persistently, so you need to
74    *          call this method to keep cookies saved across sessions.
75    *          If @a path does not exist it will be created.
76    *
77    * @param[in] path The path where to read/write Cookies
78    * @param[in] storage The type of storage
79    */
80   void SetPersistentStorage( const std::string& path, CookiePersistentStorage storage ) override;
81
82   /**
83    * @brief Deletes all the cookies of @a manager.
84    */
85   void ClearCookies() override;
86
87 private:
88
89   Ewk_Cookie_Manager* ewkCookieManager;
90
91 };
92 } // namespace Plugin
93 } // namespace Dali
94
95 #endif // DALI_PLUGIN_WEB_ENGINE_COOKIE_MANAGER_H