b0dc5bc0a4f427a3565c3bcab8ade0bd56a98ecd
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / WebView / WebPolicyDecisionMaker.cs
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     /// It is a class for policy decision maker of web view.
25     /// </summary>
26     [EditorBrowsable(EditorBrowsableState.Never)]
27     public class WebPolicyDecisionMaker : Disposable
28     {
29         internal WebPolicyDecisionMaker(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
30         {
31         }
32
33         /// This will not be public opened.
34         /// <param name="swigCPtr"></param>
35         [EditorBrowsable(EditorBrowsableState.Never)]
36         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
37         {
38             Interop.WebPolicyDecisionMaker.DeleteWebPolicyDecision(swigCPtr);
39         }
40
41         /// <summary>
42         /// Decision type
43         /// </summary>
44         [EditorBrowsable(EditorBrowsableState.Never)]
45         public enum DecisionType
46         {
47             /// <summary>
48             /// Accepts the decision.
49             /// </summary>
50             [EditorBrowsable(EditorBrowsableState.Never)]
51             Use,
52
53             /// <summary>
54             /// Decides to download something.
55             /// </summary>
56             [EditorBrowsable(EditorBrowsableState.Never)]
57             Download,
58
59             /// <summary>
60             /// Ignores the decision.
61             /// </summary>
62             [EditorBrowsable(EditorBrowsableState.Never)]
63             Ignore,
64         }
65
66         /// <summary>
67         /// Policy navigation type
68         /// </summary>
69         [EditorBrowsable(EditorBrowsableState.Never)]
70         public enum NavigationType
71         {
72             /// <summary>
73             /// Link clicked
74             /// </summary>
75             [EditorBrowsable(EditorBrowsableState.Never)]
76             LinkClicked,
77
78             /// <summary>
79             /// Form submitted
80             /// </summary>
81             [EditorBrowsable(EditorBrowsableState.Never)]
82             FormSubmitted,
83
84             /// <summary>
85             /// Back forward
86             /// </summary>
87             [EditorBrowsable(EditorBrowsableState.Never)]
88             BackForward,
89
90             /// <summary>
91             /// Reload
92             /// </summary>
93             [EditorBrowsable(EditorBrowsableState.Never)]
94             Reload,
95
96             /// <summary>
97             /// Form resubmitted
98             /// </summary>
99             [EditorBrowsable(EditorBrowsableState.Never)]
100             FormResubmitted,
101
102             /// <summary>
103             /// Other
104             /// </summary>
105             [EditorBrowsable(EditorBrowsableState.Never)]
106             Other,
107         }
108
109         /// <summary>
110         /// Gets the url that request policy decision.
111         /// </summary>
112         [EditorBrowsable(EditorBrowsableState.Never)]
113         public string Url
114         {
115             get
116             {
117                 return Interop.WebPolicyDecisionMaker.GetUrl(SwigCPtr);
118             }
119         }
120
121         /// <summary>
122         /// Gets a cookie that web page has.
123         /// </summary>
124         [EditorBrowsable(EditorBrowsableState.Never)]
125         public string Cookie
126         {
127             get
128             {
129                 return Interop.WebPolicyDecisionMaker.GetCookie(SwigCPtr);
130             }
131         }
132
133         /// <summary>
134         /// Gets a decision type.
135         /// </summary>
136         [EditorBrowsable(EditorBrowsableState.Never)]
137         public DecisionType PolicyDecisionType
138         {
139             get
140             {
141                 return (DecisionType)Interop.WebPolicyDecisionMaker.GetDecisionType(SwigCPtr);
142             }
143         }
144
145         /// <summary>
146         /// Gets a MIME type for response data.
147         /// </summary>
148         [EditorBrowsable(EditorBrowsableState.Never)]
149         public string ResponseMime
150         {
151             get
152             {
153                 return Interop.WebPolicyDecisionMaker.GetResponseMime(SwigCPtr);
154             }
155         }
156
157         /// <summary>
158         /// Gets a HTTP status code.
159         /// </summary>
160         [EditorBrowsable(EditorBrowsableState.Never)]
161         public int ResponseStatusCode
162         {
163             get
164             {
165                 return Interop.WebPolicyDecisionMaker.GetResponseStatusCode(SwigCPtr);
166             }
167         }
168
169         /// <summary>
170         /// Gets a navigation type.
171         /// </summary>
172         [EditorBrowsable(EditorBrowsableState.Never)]
173         public NavigationType DecisionNavigationType
174         {
175             get
176             {
177                 return (NavigationType)Interop.WebPolicyDecisionMaker.GetNavigationType(SwigCPtr);
178             }
179         }
180
181         /// <summary>
182         /// Gets frame of web view.
183         /// </summary>
184         [EditorBrowsable(EditorBrowsableState.Never)]
185         public WebFrame Frame
186         {
187             get
188             {
189                 IntPtr result = Interop.WebPolicyDecisionMaker.GetFrame(SwigCPtr);
190                 return new WebFrame(result, false);
191             }
192         }
193
194         /// <summary>
195         /// Gets a scheme.
196         /// </summary>
197         [EditorBrowsable(EditorBrowsableState.Never)]
198         public string Scheme
199         {
200             get
201             {
202                 return Interop.WebPolicyDecisionMaker.GetScheme(SwigCPtr);
203             }
204         }
205
206         /// <summary>
207         /// Accepts the action which triggers this decision.
208         /// </summary>
209         [EditorBrowsable(EditorBrowsableState.Never)]
210         public bool Use()
211         {
212             bool result = Interop.WebPolicyDecisionMaker.Use(SwigCPtr);
213             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
214             return result;
215         }
216
217         /// <summary>
218         /// Ignores the action which triggers this decision.
219         /// </summary>
220         [EditorBrowsable(EditorBrowsableState.Never)]
221         public bool Ignore()
222         {
223             bool result = Interop.WebPolicyDecisionMaker.Ignore(SwigCPtr);
224             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225             return result;
226         }
227
228         /// <summary>
229         /// Suspends the operation for policy decision.
230         /// </summary>
231         [EditorBrowsable(EditorBrowsableState.Never)]
232         public bool Suspend()
233         {
234             bool result = Interop.WebPolicyDecisionMaker.Suspend(SwigCPtr);
235             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
236             return result;
237         }
238     }
239 }