Support policy decision in web engine.
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / web-engine-policy-decision.h
1 #ifndef DALI_WEB_ENGINE_POLICY_DECISION_H
2 #define DALI_WEB_ENGINE_POLICY_DECISION_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 <string>
23
24 namespace Dali
25 {
26 class WebEngineFrame;
27
28 /**
29  * @brief A class WebBackForwardList for back forward list of web engine.
30  */
31 class WebEnginePolicyDecision
32 {
33 public:
34   /**
35    * @brief Enumeration that provides an option to policy decision types.
36    */
37   enum class DecisionType
38   {
39     USE,      ///< Use.
40     DOWNLOAD, ///< Download.
41     IGNORE,   ///< Ignore.
42   };
43
44   /**
45    * @brief Enumeration that provides an option to policy navigation types.
46    */
47   enum class NavigationType
48   {
49     LINK_CLICKED,     ///< Link clicked.
50     FORM_SUBMITTED,   ///< Form submitted.
51     BACK_FORWARD,     ///< Back forward.
52     RELOAD,           ///< Reload.
53     FORM_RESUBMITTED, ///< Form resubmitted.
54     OTHER,            ///< Other.
55   };
56
57   /**
58    * @brief Constructor.
59    */
60   WebEnginePolicyDecision() = default;
61
62   /**
63    * @brief Destructor.
64    */
65   virtual ~WebEnginePolicyDecision() = default;
66
67   /**
68    * @brief Returns the url that request policy decision.
69    * @return The url that request policy decision
70    */
71   virtual std::string GetUrl() const = 0;
72
73   /**
74    * @brief Returns a cookie that web page has.
75    * @return The cookie string if successfully
76    */
77   virtual std::string GetCookie() const = 0;
78
79   /**
80    * @brief Returns a decision type.
81    * @return The decision type
82    */
83   virtual DecisionType GetDecisionType() const = 0;
84
85   /**
86    * @brief Returns a MIME type for response data.
87    * @return The MIME type string
88    */
89   virtual std::string GetResponseMime() const = 0;
90
91   /**
92    * @brief Returns an HTTP status code.
93    * @return The HTTP status code number
94    */
95   virtual int32_t GetResponseStatusCode() const = 0;
96
97   /**
98    * @brief Returns a navigation type.
99    * @return The navigation type
100    */
101   virtual NavigationType GetNavigationType() const = 0;
102
103   /**
104    * @brief Gets frame.
105    * @return The frame of policy decision
106    */
107   virtual WebEngineFrame& GetFrame() const = 0;
108
109   /**
110    * @brief Gets a scheme from the Policy Decision.
111    * @return The scheme if succeeded, empty otherwise
112    */
113   virtual std::string GetScheme() const = 0;
114
115   /**
116    * @brief Accepts the action which triggers this decision.
117    * @return True if successfully, false otherwise
118    */
119   virtual bool Use() = 0;
120
121   /**
122    * @brief Ignores the action which triggers this decision.
123    * @return True if successfully, false otherwise
124    */
125   virtual bool Ignore() = 0;
126
127   /**
128    * @brief Suspend the operation for policy decision.
129    * @return True if successfully, false otherwise
130    */
131   virtual bool Suspend() = 0;
132 };
133
134 } // namespace Dali
135
136 #endif // DALI_WEB_ENGINE_POLICY_DECISION_H