Clean unused libraries and includes
[platform/framework/web/wrt.git] / src / wrt-client / wrt-client.h
1 /*
2  * Copyright (c) 2011 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 #ifndef WRT_CLIENT_H
17 #define WRT_CLIENT_H
18
19 #include <dpl/application.h>
20 #include <dpl/generic_event.h>
21 #include <dpl/event/controller.h>
22 #include <dpl/type_list.h>
23 #include <dpl/task.h>
24 #include <bundle.h>
25 #include <i_runnable_widget_object.h>
26 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
27 #include <dpl/wrt-dao-ro/common_dao_types.h>
28 #include "widget_state.h"
29 #include <launch_user_data.h>
30 #include "window_data.h"
31 #include "splash_screen_support.h"
32
33 DECLARE_GENERIC_EVENT_0(NextStepEvent)
34
35 class WrtClient :
36         public DPL::Application,
37         private DPL::Event::Controller<DPL::TypeListDecl<NextStepEvent>::Type>,
38         public DPL::TaskDecl<WrtClient>
39 {
40   public:
41     WrtClient(int argc,
42               char **argv);
43     virtual ~WrtClient();
44
45     class ReturnStatus
46     {
47       public:
48         enum Type
49         {
50             Failed = -1,
51             Succeeded = 0
52         };
53     };
54
55     ReturnStatus::Type   getReturnStatus() const;
56
57   protected:
58     virtual void OnStop();
59     virtual void OnCreate();
60     virtual void OnResume();
61     virtual void OnPause();
62     virtual void OnReset(bundle *b);
63     virtual void OnTerminate();
64
65     void setStep();
66
67   private:
68     void showHelpAndQuit();
69     bool checkArgument();
70     void setSdkLauncherDebugData();
71     bool checkDebugMode(SDKDebugData* debugData);
72     bool checkWACTestCertififedWidget();
73     void connectElmCallback();
74     void initializeWindowModes();
75
76     // Events
77     virtual void OnEventReceived(const NextStepEvent& event);
78
79     // UI callback
80     static void backButtonCallback(void* data,
81                                    Evas_Object* obj,
82                                    void* event_info);
83     static void backwardCallback(void* data,
84             Evas_Object* obj,
85             void* event_info);
86     static void reloadCallback(void* data,
87             Evas_Object* obj,
88             void* event_info);
89     static void forwardCallback(void* data,
90             Evas_Object* obj,
91             void* event_info);
92
93     // launching steps
94     void initStep();
95     void launchStep();
96     void shutdownStep();
97     static int languageChangedCallback(void *data);
98     void loadFinishCallback(bool success);
99     void progressFinishCallback();
100     void windowCloseCallback();
101     void webCrashCallback();
102     void setLayout(Evas_Object* newBuffer);
103     void unsetLayout(Evas_Object* currentBuffer);
104
105     // Private data
106     std::string m_tizenId;
107     bool m_launched;
108     bool m_initializing;
109     bool m_initialized;
110     int m_sdkLauncherPid;
111     bool m_debugMode;
112     bundle *m_bundle;
113     unsigned short m_debuggerPort;
114     ReturnStatus::Type m_returnStatus;
115     WRT::RunnableWidgetObjectPtr m_widget;
116     WrtDB::WidgetDAOReadOnlyPtr m_dao;
117     WidgetState m_widgetState;
118     std::unique_ptr<WindowData> m_windowData;
119     std::unique_ptr<SplashScreenSupport> m_splashScreen;
120 };
121
122 #endif // WRT_CLIENT_H