namespace WRT {
typedef DPL::FastDelegate0<void> ProgressFinishCB;
-typedef DPL::FastDelegate1<bool, void> LoadFinishCB;
+typedef DPL::FastDelegate1<Evas_Object*, void> LoadStartCB;
+typedef DPL::FastDelegate1<Evas_Object*, void> LoadFinishCB;
typedef DPL::FastDelegate0<void> WebCrashCB;
-typedef DPL::FastDelegate0<void> WindowCloseCB;
+typedef DPL::FastDelegate2<Evas**, Evas_Object*, void> WindowCreateBeforeCB;
+typedef DPL::FastDelegate2<Evas_Object*, Evas_Object*, void> WindowCreateAfterCB;
+typedef DPL::FastDelegate1<Evas_Object*, void> WindowCloseCB;
+typedef DPL::FastDelegate0<void> WebkitExitCB;
typedef DPL::FastDelegate1<bool, void> ResumeCB;
typedef DPL::FastDelegate1<bool, void> SuspendCB;
typedef DPL::FastDelegate1<bool, void> ResetCB;
typedef struct UserDelegates {
ProgressFinishCB progressFinish;
+ LoadStartCB loadStart;
LoadFinishCB loadFinish;
WebCrashCB webCrash;
+ WindowCreateBeforeCB windowCreateBefore;
+ WindowCreateAfterCB windowCreateAfter;
WindowCloseCB windowClose;
+ WebkitExitCB webkitExit;
ResumeCB resume;
SuspendCB suspend;
ResetCB reset;
Assert(NULL != m_ewkContext);
Assert(window);
m_window = window;
- createEwkView();
+ createEwkView(evas_object_evas_get(m_window));
}
void ViewLogic::destroyWebView()
// check if already created webview exists
if (!m_ewkViewList.size()) {
// create new webview
- createEwkView();
+ createEwkView(evas_object_evas_get(m_window));
setStartPage();
ewkClientInit(m_currentEwkView);
prepareEwkView(m_currentEwkView);
if (m_ewkViewList.size() == 0) {
// create new webview
- createEwkView();
+ createEwkView(evas_object_evas_get(m_window));
ewkClientInit(m_currentEwkView);
} else {
// close opened windows
imeCloseCallback);
}
-void ViewLogic::createEwkView()
+void ViewLogic::createEwkView(Evas* canvas)
{
LogDebug("createEwkVeiw");
+ Assert(canvas);
ADD_PROFILING_POINT("ewk_view_add_with_context", "start");
Evas_Object* newEwkView = ewk_view_add_with_context(
- evas_object_evas_get(m_window),
+ canvas,
m_ewkContext);
ADD_PROFILING_POINT("ewk_view_add_with_context", "stop");
void ViewLogic::loadStartedCallback(
void* data,
- Evas_Object* /*obj*/,
+ Evas_Object* obj,
void* /*eventInfo*/)
{
LogDebug("loadStartedCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
evas_object_focus_set(This->m_currentEwkView, EINA_TRUE);
+
+ // call loadFinish callback to wrt-client
+ if (!This->m_cbs->loadStart.empty()) {
+ This->m_cbs->loadStart(obj);
+ }
+
}
void ViewLogic::loadFinishedCallback(
void* data,
- Evas_Object* /*obj*/,
+ Evas_Object* obj,
void* /*eventInfo*/)
{
LogDebug("loadFinishedCallback called");
// call loadFinish callback to wrt-client
if (!This->m_cbs->loadFinish.empty()) {
- This->m_cbs->loadFinish(true);
+ This->m_cbs->loadFinish(obj);
}
// set only encoded bundle
void ViewLogic::createWindowCallback(
void* data,
- Evas_Object* ,
+ Evas_Object* obj,
void* eventInfo)
{
LogDebug("createWindowCallback");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- Evas_Object* currentEwkView = This->m_currentEwkView;
-
- // suspend current ewkview
- /* In case we support many pages in parallel
- then view should not be suspended*/
- //This->suspendEwkView(currentEwkView);
-
+ // First, current webview should be handled by user callback
if (!This->m_cbs->bufferUnset.empty()) {
- This->m_cbs->bufferUnset(currentEwkView);
+ This->m_cbs->bufferUnset(obj);
}
- // create new ewkview
- This->createEwkView();
+ // this can be set by executable for specific purpose
+ Evas* canvas = NULL;
+ if (!This->m_cbs->windowCreateBefore.empty()) {
+ // 'obj' is parent webview object
+ This->m_cbs->windowCreateBefore(&canvas, obj);
+ }
+ if (!canvas) {
+ canvas = evas_object_evas_get(This->m_window);
+ }
+ // create new ewkview
+ This->createEwkView(canvas);
Evas_Object* newEwkView = This->m_currentEwkView;
// initialize new ewkview
This->ewkClientInit(newEwkView);
This->prepareEwkView(newEwkView);
- // show new ewkview
- if (!This->m_cbs->bufferUnset.empty()) {
+ // Specific jobs of child, parent webview are handled by each executable
+ if (!This->m_cbs->windowCreateAfter.empty()) {
+ // 'obj' is parent webview, 'newEwkView' is child webview
+ This->m_cbs->windowCreateAfter(obj, newEwkView);
+ }
+
+ // Lastly, new webview should be handled by user callback
+ if (!This->m_cbs->bufferSet.empty()) {
This->m_cbs->bufferSet(newEwkView);
}
*(static_cast<Evas_Object **>(eventInfo)) = newEwkView;
void ViewLogic::closeWindowCallback(
void* data,
- Evas_Object* /*obj*/,
+ Evas_Object* obj,
void* /*eventInfo*/)
{
LogDebug("closeWindowCallback");
- ecore_idler_add(windowCloseIdlerCallback, data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ This->m_closedEwkView = obj;
+ ecore_idler_add(windowCloseIdlerCallback, This);
}
void ViewLogic::policyNavigationDecideCallback(
void ViewLogic::windowClose()
{
LogDebug("windowClose");
+ Assert(m_closedEwkView && "no closed webview");
if (1 >= m_ewkViewList.size()) {
- if (!m_cbs->windowClose.empty()) {
- m_cbs->windowClose();
+ if (!m_cbs->webkitExit.empty()) {
+ m_cbs->webkitExit();
}
} else {
- // hide current ewkView
-
+ // call user callbacks
if (!m_cbs->bufferUnset.empty()) {
m_cbs->bufferUnset(m_currentEwkView);
}
- removeEwkView(m_currentEwkView);
+ if (!m_cbs->windowClose.empty()) {
+ m_cbs->windowClose(m_closedEwkView);
+ }
+ removeEwkView(m_closedEwkView);
// get latest ewkView
m_currentEwkView = m_ewkViewList.back();
return true;
}
-void WrtClient::loadFinishCallback(bool success)
+void WrtClient::loadFinishCallback(Evas_Object* webview)
{
ADD_PROFILING_POINT("loadFinishCallback", "start");
SDKDebugData* debug = new SDKDebugData;
fclose(doutput);
}
- if (success) {
+ if (webview) {
LogDebug("Launch succesfull");
m_launched = true;
if(debug->debugMode)
{
- LogDebug("Send RT signal to wrt-launcher(pid: "
- << m_sdkLauncherPid << ", status: " << success);
+ LogDebug("Send RT signal to wrt-launcher(pid: " << m_sdkLauncherPid);
union sigval sv;
/* send real time signal with result to wrt-launcher */
- if(success)
- {
+ if(webview) {
LogDebug("userData->portnum : " << debug->portnum);
sv.sival_int = debug->portnum;
- }
- else
- {
+ } else {
sv.sival_int = -1;
}
sigqueue(m_sdkLauncherPid, SIGRTMIN, sv);
m_splashScreen->stopSplashScreen();
}
-void WrtClient::windowCloseCallback()
+void WrtClient::webkitExitCallback()
{
LogDebug("window close called, terminating app");
SwitchToStep(&WrtClient::shutdownStep);
cbs->loadFinish = DPL::MakeDelegate(this, &WrtClient::loadFinishCallback);
cbs->bufferSet = DPL::MakeDelegate(this, &WrtClient::setLayout);
cbs->bufferUnset = DPL::MakeDelegate(this, &WrtClient::unsetLayout);
- cbs->windowClose = DPL::MakeDelegate(this, &WrtClient::windowCloseCallback);
+ cbs->webkitExit = DPL::MakeDelegate(this, &WrtClient::webkitExitCallback);
cbs->webCrash = DPL::MakeDelegate(this, &WrtClient::webCrashCallback);
cbs->toggleFullscreen = DPL::MakeDelegate(m_windowData.get(), &WindowData::toggleFullscreen);