Apply to remove download listener before deleting _WebImpl
[framework/osp/web.git] / src / controls / FWebCtrl_WebEventArg.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FWebCtrl_WebEventArg.h
20  * @brief               The file contains the declaration of _WebEventArg class.
21  *
22  * The file contains the declaration of _WebEvent class.
23  */
24 #ifndef _FWEB_CTRL_INTERNAL_WEB_EVENT_ARG_H_
25 #define _FWEB_CTRL_INTERNAL_WEB_EVENT_ARG_H_
26
27 #include <unique_ptr.h>
28 #include <FBaseColAllElementsDeleter.h>
29 #include <FBaseColHashMap.h>
30 #include <FBaseObject.h>
31 #include <FBaseByteBuffer.h>
32 #include <FBaseString.h>
33 #include <FBaseRtIEventArg.h>
34
35
36
37
38 namespace Tizen { namespace Web { namespace Controls
39 {
40
41 enum _WebEventType
42 {
43         WEB_EVENT_REQUEST_SERVICE = 0x000,
44         WEB_EVENT_REQUEST_RTSP,
45         WEB_EVENT_REQUEST_EMAIL,
46         WEB_EVENT_REQUEST_TEL,
47         WEB_EVENT_REQUEST_SMS,
48         WEB_EVENT_REQUEST_MMS,
49         WEB_EVENT_REQUEST_UNKNOWN,
50
51         WEB_EVENT_DELIVER_JSBRIDGE_REQUEST = 0x100,
52
53         WEB_EVENT_LOADINGLISTENER = 0x200,
54         WEB_EVENT_LOADINGLISTENER_STARTED,
55         WEB_EVENT_LOADINGLISTENER_PROGRESS,
56         WEB_EVENT_LOADINGLISTENER_PAGETITLE_RECEIVED,
57         WEB_EVENT_LOADINGLISTENER_CANCELED,
58         WEB_EVENT_LOADINGLISTENER_ERROR_OCCURRED,
59         WEB_EVENT_LOADINGLISTENER_COMPLETED,
60         WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_REQUESTED,
61         WEB_EVENT_LOADINGLISTENER_AUTHENTICATION_CANCELED,
62         WEB_EVENT_LOADINGLISTENER_FAVICON_RECEIVED,
63
64         WEB_EVENT_WEBDOWNLOADLISTENER = 0x300,
65         WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED,
66         WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED,
67         WEB_EVENT_WEBDOWNLOADLISTENER_FAILED,
68
69         WEB_EVENT_WEBUIEVENTLISTENER = 0x400,
70         WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED,
71         WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED,
72         WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED,
73         WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED,
74
75         WEB_EVENT_WEBUIEVENTLISTENER_FLOAT = 0x500,
76         WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT,
77         WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT,
78         WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT,
79         WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT,
80
81         WEB_EVENT_TEXTSEARCHLISTENER = 0x600,
82         WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND
83 };
84
85 class _WebEventArg
86         : public Tizen::Base::Object
87         , public Tizen::Base::Runtime::IEventArg
88 {
89 public:
90         _WebEventArg(int eventType, const Tizen::Base::String& message);
91         virtual ~_WebEventArg(void);
92
93         int GetEventType(void) const;
94         int GetEventGroup(void) const;
95         Tizen::Base::String GetEventMessage(void) const;
96
97 private:
98         int __eventType;
99         Tizen::Base::String __message;
100 }; // _WebEventArg
101
102 class _JsBridgeArg
103         : public _WebEventArg
104 {
105 public:
106         _JsBridgeArg(void);
107         virtual ~_JsBridgeArg(void);
108
109         result Construct(const char* pJsonText);
110
111         const Tizen::Base::ByteBuffer* GetJsonData(void) const;
112
113 private:
114         // Copy constructor
115         _JsBridgeArg(const _JsBridgeArg& bridge);
116
117         // Assignment operator
118         _JsBridgeArg& operator =(const _JsBridgeArg& bridge);
119
120 private:
121         std::unique_ptr<Tizen::Base::ByteBuffer> __pJsonText;
122 }; // _JsBridgeArg
123
124 class _LoadingEventArg
125         : public _WebEventArg
126 {
127 public:
128         _LoadingEventArg(int loadingEvent);
129         virtual ~_LoadingEventArg(void);
130
131         enum EventInfoKey
132         {
133                 ESTIMATED_PROGRESS,
134                 PAGE_TITLE,
135                 ERROR_TYPE,
136                 ERROR_MESSAGE,
137                 AUTHENTICATION_HOST,
138                 AUTHENTICATION_REALM,
139                 AUTHENTICATION_CHALLENGE
140         };
141
142         result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
143         const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
144
145 private:
146         // Copy constructor
147         _LoadingEventArg(const _LoadingEventArg& rhs);
148
149         // Assignment operator
150         _LoadingEventArg& operator =(const _LoadingEventArg& rhs);
151
152 private:
153         std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
154
155 }; // _LoadingEventArg
156
157 class _WebDownloadEventArg
158         : public _WebEventArg
159 {
160 public:
161         _WebDownloadEventArg(int webDownloadEvent);
162         virtual ~_WebDownloadEventArg(void);
163
164         enum EventInfoKey
165         {
166                 CHUNKED_DATA,
167                 ERROR_TYPE
168         };
169
170         result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
171         const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
172
173 private:
174         // Copy constructor
175         _WebDownloadEventArg(const _WebDownloadEventArg& rhs);
176
177         // Assignment operator
178         _WebDownloadEventArg& operator =(const _WebDownloadEventArg& rhs);
179
180 private:
181         std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
182
183 }; // _WebDownloadEventArg
184
185 class _WebUiEventArg
186         : public _WebEventArg
187 {
188 public:
189         _WebUiEventArg(int webUiEvent);
190         virtual ~_WebUiEventArg(void);
191
192         enum EventInfoKey
193         {
194                 BLOCK_START,
195                 BLOCK_END,
196                 PREVENT_DEFAULT
197         };
198
199         result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
200         const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
201
202 private:
203         // Copy constructor
204         _WebUiEventArg(const _WebUiEventArg& rhs);
205
206         // Assignment operator
207         _WebUiEventArg& operator =(const _WebUiEventArg& rhs);
208
209 private:
210         std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
211
212 }; // _WebUiEventArg
213
214 class _TextSearchEventArg
215         : public _WebEventArg
216 {
217 public:
218         _TextSearchEventArg(int textFoundEvent);
219         virtual ~_TextSearchEventArg(void);
220
221         enum EventInfoKey
222         {
223                 TOTAL_COUNT,
224                 CURRENT_ORDINAL
225         };
226
227         result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
228         const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
229
230 private:
231         // Copy constructor
232         _TextSearchEventArg(const _TextSearchEventArg& rhs);
233
234         // Assignment operator
235         _TextSearchEventArg& operator =(const _TextSearchEventArg& rhs);
236
237 private:
238         std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
239
240 }; // _TextSearchEventArg
241
242 }}} // Tizen::Web::Controls
243 #endif // _FWEB_CTRL_INTERNAL_WEB_EVENT_ARG_H_