tizen 2.3.1 release
[framework/web/mobile/wrt.git] / src / wrt-launchpad-daemon / include / web_app_core.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
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  * @file    web_app_core.h
18  * @author  Jihoon Chung (jihoon.chung@samsung.com)
19  */
20 #ifndef WEB_APP_CORE_H_
21 #define WEB_APP_CORE_H_
22
23 #include <memory>
24 #include <string>
25 #include <Ecore_X.h>
26
27 #include <bundle.h>
28 #include <Ecore.h>
29
30 #include <app_sock.h>
31 #include <web_app_core_data.h>
32 #include <web_app_manager.h>
33
34 class WebAppCore {
35   public:
36     WebAppCore();
37     virtual ~WebAppCore();
38
39     bool initialize();
40     bool launchRequest(int argc, char* argv[]);
41     void setPidToAppID(const char* appId, unsigned int pid);
42     void aulSocketHandler(app_pkt_t* pkt, int clifd, ucred cr);
43
44   private:
45
46     bool addEcoreXWindowHandlers();
47     static Eina_Bool ecoreXWindowShowCallback(void* data, int type, void* event);
48     static Eina_Bool ecoreXWindowHideCallback(void* data, int type, void* event);
49     static Eina_Bool ecoreXWindowVisibilityChangeCallback(void* data, int type, void* event);
50     static Eina_Bool ecoreXWindowEventClientCallback(void *data, int type, void *event);
51     static Eina_Bool terminateEventCallback(void *data, int type, void *event);
52     static Eina_Bool popupReplyWaitEventAulHandler(void* data, Ecore_Fd_Handler* handler);
53     static Eina_Bool popupReplyWaitStartEventCallback(void *data, int type, void *event);
54     static Eina_Bool popupReplyWaitFinishEventCallback(void *data, int type, void *event);
55
56     bool m_initialized;
57     std::unique_ptr<WebAppManager> m_manager;
58     std::unique_ptr<WebAppCoreDataManager> m_webAppCoreDataManager;
59
60     Ecore_X_Atom m_atomParent;
61     Ecore_Event_Handler* m_ecoreEventWindowShowHandler;
62     Ecore_Event_Handler* m_ecoreEventHideWindowShowHandler;
63     Ecore_Event_Handler* m_ecoreEventVisibilityChangeHandler;
64     Ecore_Event_Handler* m_ecoreEventTaskMgrImageCreationHandler;
65 };
66
67 #endif // WEB_APP_CORE_H_