Disable shadow effect on webview scrolling
[platform/framework/web/web-provider.git] / src / Plugin / AppBoxPlugin / AppBoxRenderView.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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    AppBoxRenderView.h
18  * @author  Yunchan Cho (yunchan.cho@samsung.com)
19  */
20 #ifndef APP_BOX_RENDER_VIEW_H
21 #define APP_BOX_RENDER_VIEW_H
22
23 #include <string>
24 #include <memory>
25 #include <Eina.h>
26 #include <Ecore.h>
27 #include <Evas.h>
28 #include <ewk_context.h>
29 #include <i_runnable_widget_object.h>
30 #include <Core/View/IRenderView.h>
31 #include <Core/View/IPdHelper.h>
32
33 class AppBoxRenderBuffer;
34
35 class AppBoxRenderView: public IRenderView {
36     public:
37         typedef std::shared_ptr<Ewk_Context> EwkContextPtr;
38
39         static IRenderViewPtr create(
40                 std::string boxId, std::string instanceId, 
41                 Evas_Object* boxWin, EwkContextPtr ewkContext)
42         {
43             return IRenderViewPtr(
44                     new AppBoxRenderView(
45                         boxId, instanceId, boxWin, ewkContext));
46         };
47         virtual void showBox(RenderInfoPtr renderInfo);
48         virtual void hideBox();
49         virtual void pauseBox();
50         virtual void resumeBox();
51         virtual void showPd(Evas_Object* pdWin, RenderInfoPtr renderInfo);
52         virtual void hidePd();
53         Evas_Object* getBoxWebView();
54         Evas_Object* getPdWebView();
55         virtual ~AppBoxRenderView();
56
57     private:
58         // type definition
59         typedef std::shared_ptr<WRT::IRunnableWidgetObject> WrtCorePtr;
60         enum UrlType {
61             URL_TYPE_BOX,
62             URL_TYPE_PD
63         };
64
65         WrtCorePtr createWrtCore(
66                 std::string& startUrl, Evas_Object* win, EwkContextPtr ewkContext);
67         void setWebViewBasicSetting(Evas_Object* webview);
68         void destroyWrtCore(WrtCorePtr wrt);
69         void destroyBoxWrtCore();
70         void destroyPdWrtCore();
71         std::string getAppId(std::string& boxId);
72         std::string getStartUrl(UrlType type, std::string& defaultParams);
73         Evas_Object* getCurrentSnapShot();
74         void clearSnapShot();
75         void addRenderTimer();
76         void deleteRenderTimer();
77         void stopRenderBox();
78
79         // timer and idler callback
80         static Eina_Bool fireRenderTimerCallback(void* data);
81         static Eina_Bool openPdIdlerCallback(void* data);
82
83         // ewk view callback
84         static void executeScriptCallback(
85                 Evas_Object* webview, const char* result, void* data);
86         static void loadNonEmptyLayoutFinishedCallback(
87                 void* data, Evas_Object* webview, void* eventInfo);
88
89         // user Callbacks of RunnableWidgetObject
90         void startLoadCallback(Evas_Object* webview);
91         void finishLoadCallback(Evas_Object* webview);
92         void createWindowBeforeCallback(Evas** canvas, Evas_Object* parent);
93         void createWindowAfterCallback(Evas_Object* parent, Evas_Object* child);
94         void setBufferCallback(Evas_Object* webview);
95         void unsetBufferCallback(Evas_Object* webview);
96         void decideNavigationCallback(Evas_Object* webview, std::string& uri);
97         void crashWebProcessCallback();
98
99         // constructor
100         explicit AppBoxRenderView(
101                 std::string boxId, std::string instanceId,
102                 Evas_Object* boxWin, EwkContextPtr ewkContext);
103
104         // members
105         std::string m_appId;
106         std::string m_boxId;
107         std::string m_instanceId;
108         Evas_Object* m_boxWin;
109         Evas_Object* m_snapshot;
110         RenderInfoPtr m_renderInfo;
111         WrtCorePtr m_boxWrt;
112         bool m_boxWrt_isSuspended;
113         WrtCorePtr m_pdWrt;
114         Ecore_Timer* m_fireRenderTimer;
115         IPdHelperPtr m_pdHelper;
116         bool m_pdFastOpen;
117         EwkContextPtr m_ewkContext;
118         AppBoxRenderBuffer* m_renderBuffer;
119
120         friend class AppBoxRenderBuffer;
121 };
122
123 #endif // APP_BOX_RENDER_VIEW_H