2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://floralicense.org/license/
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.
17 * @file AppBoxRenderView.h
18 * @author Yunchan Cho (yunchan.cho@samsung.com)
20 #ifndef APP_BOX_RENDER_VIEW_H
21 #define APP_BOX_RENDER_VIEW_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>
33 class AppBoxRenderBuffer;
35 class AppBoxRenderView: public IRenderView {
37 typedef std::shared_ptr<Ewk_Context> EwkContextPtr;
39 static IRenderViewPtr create(
40 std::string boxId, std::string instanceId,
41 Evas_Object* boxWin, EwkContextPtr ewkContext)
43 return IRenderViewPtr(
45 boxId, instanceId, boxWin, ewkContext));
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();
59 typedef std::shared_ptr<WRT::IRunnableWidgetObject> WrtCorePtr;
65 WrtCorePtr createWrtCore(
66 std::string& startUrl, Evas_Object* win, EwkContextPtr ewkContext);
67 void destroyWrtCore(WrtCorePtr wrt);
68 void destroyBoxWrtCore();
69 void destroyPdWrtCore();
70 std::string getAppId(std::string& boxId);
71 std::string getStartUrl(UrlType type, std::string& defaultParams);
72 Evas_Object* getCurrentSnapShot();
74 void addRenderTimer();
75 void deleteRenderTimer();
77 // timer and idler callback
78 static Eina_Bool fireRenderTimerCallback(void* data);
79 static Eina_Bool openPdIdlerCallback(void* data);
82 static void executeScriptCallback(
83 Evas_Object* webview, const char* result, void* data);
85 // user Callbacks of RunnableWidgetObject
86 void startLoadCallback(Evas_Object* webview);
87 void finishLoadCallback(Evas_Object* webview);
88 void createWindowBeforeCallback(Evas** canvas, Evas_Object* parent);
89 void createWindowAfterCallback(Evas_Object* parent, Evas_Object* child);
90 void setBufferCallback(Evas_Object* webview);
91 void unsetBufferCallback(Evas_Object* webview);
92 void decideNavigationCallback(Evas_Object* webview, std::string& uri);
93 void crashWebProcessCallback();
96 explicit AppBoxRenderView(
97 std::string boxId, std::string instanceId,
98 Evas_Object* boxWin, EwkContextPtr ewkContext);
103 std::string m_instanceId;
104 Evas_Object* m_boxWin;
105 Evas_Object* m_snapshot;
106 RenderInfoPtr m_renderInfo;
109 Ecore_Timer* m_fireRenderTimer;
110 IPdHelperPtr m_pdHelper;
112 EwkContextPtr m_ewkContext;
113 AppBoxRenderBuffer* m_renderBuffer;
115 friend class AppBoxRenderBuffer;
118 #endif // APP_BOX_RENDER_VIEW_H