Merge remote-tracking branch 'webview/tizen'
[platform/core/csapi/tizenfx.git] / src / Tizen.WebView / Tizen.WebView / SmartCallbackLoadErrorArgs.cs
1 /*\r
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the License);\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  * http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an AS IS BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 using System;\r
18 using System.Runtime.InteropServices;\r
19 \r
20 namespace Tizen.WebView\r
21 {\r
22     /// <summary>\r
23     /// Enumeration that provides an option to error codes.\r
24     /// </summary>\r
25     public enum LoadErrorCode\r
26     {\r
27         /// <summary>\r
28         /// Unknown\r
29         /// </summary>\r
30         Unknown = 0,\r
31         /// <summary>\r
32         /// User canceled\r
33         /// </summary>\r
34         Canceled,\r
35         /// <summary>\r
36         /// Can't show page for this MIME Type\r
37         /// </summary>\r
38         CantSupportMimetype,\r
39         /// <summary>\r
40         /// File IO error\r
41         /// </summary>\r
42         FailedFileIo,\r
43         /// <summary>\r
44         /// Cannot connect to network\r
45         /// </summary>\r
46         CantConnect,\r
47         /// <summary>\r
48         /// Fail to look up host from DNS\r
49         /// </summary>\r
50         CantLookupHost,\r
51         /// <summary>\r
52         /// Fail to SSL/TLS handshake\r
53         /// </summary>\r
54         FailedTlsHandshake,\r
55         /// <summary>\r
56         /// Received certificate is invalid\r
57         /// </summary>\r
58         InvalidCertificate,\r
59         /// <summary>\r
60         /// Connection timeout\r
61         /// </summary>\r
62         RequestTimeout,\r
63         /// <summary>\r
64         /// Too many redirects\r
65         /// </summary>\r
66         TooManyRedirects,\r
67         /// <summary>\r
68         /// Too many requests during this load\r
69         /// </summary>\r
70         TooManyRequests,\r
71         /// <summary>\r
72         /// Malformed url\r
73         /// </summary>\r
74         BadUrl,\r
75         /// <summary>\r
76         /// Unsupported scheme\r
77         /// </summary>\r
78         UnsupportedScheme,\r
79         /// <summary>\r
80         /// User authentication failed on server\r
81         /// </summary>\r
82         Authentication,\r
83         /// <summary>\r
84         /// Web server has internal server error\r
85         /// </summary>\r
86         InternalServer,\r
87     }\r
88 \r
89     /// <summary>\r
90     /// Argument from the LoadError SmartCallback.\r
91     /// </summary>\r
92     public class SmartCallbackLoadErrorArgs : EventArgs\r
93     {\r
94         IntPtr _handle;\r
95 \r
96         internal SmartCallbackLoadErrorArgs(IntPtr handle)\r
97         {\r
98             _handle = handle;\r
99         }\r
100 \r
101         /// <summary>\r
102         /// Failing URL for the error.\r
103         /// </summary>\r
104         public string Url\r
105         {\r
106             get\r
107             {\r
108                 return Interop.ChromiumEwk.ewk_error_url_get(_handle);\r
109             }\r
110         }\r
111 \r
112         /// <summary>\r
113         /// The error code.\r
114         /// </summary>\r
115         public LoadErrorCode Code\r
116         {\r
117             get\r
118             {\r
119                 return (LoadErrorCode)Interop.ChromiumEwk.ewk_error_code_get(_handle);\r
120             }\r
121         }\r
122 \r
123         /// <summary>\r
124         /// The description for the error.\r
125         /// </summary>\r
126         public string Description\r
127         {\r
128             get\r
129             {\r
130                 return Interop.ChromiumEwk.ewk_error_description_get(_handle);\r
131             }\r
132         }\r
133 \r
134         /// <summary>\r
135         /// Whether the error should be treated as a cancellation.\r
136         /// </summary>\r
137         public bool Cancellation\r
138         {\r
139             get\r
140             {\r
141                 return Interop.ChromiumEwk.ewk_error_cancellation_get(_handle);\r
142             }\r
143         }\r
144 \r
145         internal static SmartCallbackLoadErrorArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info)\r
146         {\r
147             return new SmartCallbackLoadErrorArgs(info);\r
148         }\r
149     }\r
150 }\r