236854b4c331798a478eeb94dc7fc09ae3336067
[platform/framework/native/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
63         WEB_EVENT_WEBDOWNLOADLISTENER = 0x300,
64         WEB_EVENT_WEBDOWNLOADLISTENER_DATA_RECEIVED,
65         WEB_EVENT_WEBDOWNLOADLISTENER_COMPLETED,
66         WEB_EVENT_WEBDOWNLOADLISTENER_FAILED,
67
68         WEB_EVENT_WEBUIEVENTLISTENER = 0x400,
69         WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED,
70         WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED,
71         WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED,
72         WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED,
73
74         WEB_EVENT_WEBUIEVENTLISTENER_FLOAT = 0x500,
75         WEB_EVENT_WEBUIEVENTLISTENER_PAGE_BLOCK_SELECTED_FLOAT,
76         WEB_EVENT_WEBUIEVENTLISTENER_PAGE_SHOW_REQUESTED_FLOAT,
77         WEB_EVENT_WEBUIEVENTLISTENER_WINDOW_CLOSE_REQUSTED_FLOAT,
78         WEB_EVENT_WEBUIEVENTLISTENER_PREVENT_DEFAULT_TRIGGERED_FLOAT,
79
80         WEB_EVENT_TEXTSEARCHLISTENER = 0x600,
81         WEB_EVENT_TEXTSEARCHLISTENER_TEXT_FOUND
82 };
83
84 class _WebEventArg
85         : public Tizen::Base::Object
86         , public Tizen::Base::Runtime::IEventArg
87 {
88 public:
89         _WebEventArg(int eventType, const Tizen::Base::String& message);
90         virtual ~_WebEventArg(void);
91
92         int GetEventType(void) const;
93         int GetEventGroup(void) const;
94         Tizen::Base::String GetEventMessage(void) const;
95
96 private:
97         int __eventType;
98         Tizen::Base::String __message;
99 }; // _WebEventArg
100
101 class _JsBridgeArg
102         : public _WebEventArg
103 {
104 public:
105         _JsBridgeArg(void);
106         virtual ~_JsBridgeArg(void);
107
108         result Construct(const char* pJsonText);
109
110         const Tizen::Base::ByteBuffer* GetJsonData(void) const;
111
112 private:
113         // Copy constructor
114         _JsBridgeArg(const _JsBridgeArg& bridge);
115
116         // Assignment operator
117         _JsBridgeArg& operator =(const _JsBridgeArg& bridge);
118
119 private:
120         std::unique_ptr<Tizen::Base::ByteBuffer> __pJsonText;
121 }; // _JsBridgeArg
122
123 class _LoadingEventArg
124         : public _WebEventArg
125 {
126 public:
127         _LoadingEventArg(int loadingEvent);
128         virtual ~_LoadingEventArg(void);
129
130         enum EventInfoKey
131         {
132                 ESTIMATED_PROGRESS,
133                 PAGE_TITLE,
134                 ERROR_TYPE,
135                 ERROR_MESSAGE,
136                 AUTHENTICATION_HOST,
137                 AUTHENTICATION_REALM,
138                 AUTHENTICATION_CHALLENGE
139         };
140
141         result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
142         const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
143
144 private:
145         // Copy constructor
146         _LoadingEventArg(const _LoadingEventArg& rhs);
147
148         // Assignment operator
149         _LoadingEventArg& operator =(const _LoadingEventArg& rhs);
150
151 private:
152         std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
153
154 }; // _LoadingEventArg
155
156 class _WebDownloadEventArg
157         : public _WebEventArg
158 {
159 public:
160         _WebDownloadEventArg(int webDownloadEvent);
161         virtual ~_WebDownloadEventArg(void);
162
163         enum EventInfoKey
164         {
165                 CHUNKED_DATA,
166                 ERROR_TYPE
167         };
168
169         result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
170         const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
171
172 private:
173         // Copy constructor
174         _WebDownloadEventArg(const _WebDownloadEventArg& rhs);
175
176         // Assignment operator
177         _WebDownloadEventArg& operator =(const _WebDownloadEventArg& rhs);
178
179 private:
180         std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
181
182 }; // _WebDownloadEventArg
183
184 class _WebUiEventArg
185         : public _WebEventArg
186 {
187 public:
188         _WebUiEventArg(int webUiEvent);
189         virtual ~_WebUiEventArg(void);
190
191         enum EventInfoKey
192         {
193                 BLOCK_START,
194                 BLOCK_END,
195                 PREVENT_DEFAULT
196         };
197
198         result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
199         const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
200
201 private:
202         // Copy constructor
203         _WebUiEventArg(const _WebUiEventArg& rhs);
204
205         // Assignment operator
206         _WebUiEventArg& operator =(const _WebUiEventArg& rhs);
207
208 private:
209         std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
210
211 }; // _WebUiEventArg
212
213 class _TextSearchEventArg
214         : public _WebEventArg
215 {
216 public:
217         _TextSearchEventArg(int textFoundEvent);
218         virtual ~_TextSearchEventArg(void);
219
220         enum EventInfoKey
221         {
222                 TOTAL_COUNT,
223                 CURRENT_ORDINAL
224         };
225
226         result SetEventInfo(EventInfoKey key, const Tizen::Base::Object& value);
227         const Tizen::Base::Object* GetEventInfo(EventInfoKey key) const;
228
229 private:
230         // Copy constructor
231         _TextSearchEventArg(const _TextSearchEventArg& rhs);
232
233         // Assignment operator
234         _TextSearchEventArg& operator =(const _TextSearchEventArg& rhs);
235
236 private:
237         std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pEventInfo;
238
239 }; // _TextSearchEventArg
240
241 }}} // Tizen::Web::Controls
242 #endif // _FWEB_CTRL_INTERNAL_WEB_EVENT_ARG_H_