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