// IME Callback
const char * const EWK_INPUTMETHOD_CHANGED = "inputmethod,changed";
const char * const EWK_EDITORCLIENT_IME_CLOSED = "editorclient,ime,closed";
+
+// Custom handlers
+const char * const EWK_PROTOCOLHANDLER_REGISTRATION = "protocolhandler,registration,requested";
+const char * const EWK_PROTOCOLHANDLER_ISREGISTERED = "protocolhandler,isregistered";
+const char * const EWK_PROTOCOLHANDLER_UNREGISTRATION = "protocolhandler,unregistration,requested";
+const char * const EWK_CONTENTHANDLER_REGISTRATION = "contenthandler,registration,requested";
+const char * const EWK_CONTENTHANDLER_ISREGISTERED = "contenthandler,isregistered";
+const char * const EWK_CONTENTHANDLER_UNREGISTRATION = "contenthandler,unregistration,requested";
}
ViewLogic::ViewLogic():
EWK_EDITORCLIENT_IME_CLOSED,
imeCloseCallback,
this);
+
+ // custom content/scheme handlers
+ evas_object_smart_callback_add(
+ wkView,
+ EWK_PROTOCOLHANDLER_REGISTRATION,
+ protocolHandlerRegistrationCallback,
+ this);
+ evas_object_smart_callback_add(
+ wkView,
+ EWK_PROTOCOLHANDLER_ISREGISTERED,
+ protocolHandlerIsRegisteredCallback,
+ this);
+ evas_object_smart_callback_add(
+ wkView,
+ EWK_PROTOCOLHANDLER_UNREGISTRATION,
+ protocolHandlerUnregistrationCallback,
+ this);
+
+ evas_object_smart_callback_add(
+ wkView,
+ EWK_CONTENTHANDLER_REGISTRATION,
+ contentHandlerRegistrationCallback,
+ this);
+ evas_object_smart_callback_add(
+ wkView,
+ EWK_CONTENTHANDLER_ISREGISTERED,
+ contentHandlerIsRegisteredCallback,
+ this);
+ evas_object_smart_callback_add(
+ wkView,
+ EWK_CONTENTHANDLER_UNREGISTRATION,
+ contentHandlerUnregistrationCallback,
+ this);
}
void ViewLogic::ewkClientDeinit(Evas_Object *wkView) {
wkView,
EWK_EDITORCLIENT_IME_CLOSED,
imeCloseCallback);
+
+ // custom content/scheme handlers
+ evas_object_smart_callback_del(
+ wkView,
+ EWK_PROTOCOLHANDLER_REGISTRATION,
+ protocolHandlerRegistrationCallback);
+ evas_object_smart_callback_del(
+ wkView,
+ EWK_PROTOCOLHANDLER_ISREGISTERED,
+ protocolHandlerIsRegisteredCallback);
+ evas_object_smart_callback_del(
+ wkView,
+ EWK_PROTOCOLHANDLER_UNREGISTRATION,
+ protocolHandlerUnregistrationCallback);
+
+ evas_object_smart_callback_del(
+ wkView,
+ EWK_CONTENTHANDLER_REGISTRATION,
+ contentHandlerRegistrationCallback);
+ evas_object_smart_callback_del(
+ wkView,
+ EWK_CONTENTHANDLER_ISREGISTERED,
+ contentHandlerIsRegisteredCallback);
+ evas_object_smart_callback_del(
+ wkView,
+ EWK_CONTENTHANDLER_UNREGISTRATION,
+ contentHandlerUnregistrationCallback);
}
void ViewLogic::createEwkView(Evas* canvas)
&args);
}
+// helper method
+void ViewLogic::debugCustomHandlerData(void* data)
+{
+ Assert(data);
+ Ewk_Custom_Handlers_Data* handler =
+ static_cast<Ewk_Custom_Handlers_Data*>(data);
+ const char* base_url = ewk_custom_handlers_data_base_url_get(handler);
+ if (base_url) {
+ LogDebug("base url: " << base_url);
+ }
+ const char* url = ewk_custom_handlers_data_url_get(handler);
+ if (url) {
+ LogDebug("url: " << url);
+ }
+ const char* target = ewk_custom_handlers_data_target_get(handler);
+ if (target) {
+ LogDebug("target: " << target);
+ }
+ const char* title = ewk_custom_handlers_data_title_get(handler);
+ if (title) {
+ LogDebug("title: " << title);
+ }
+}
+
+void ViewLogic::protocolHandlerRegistrationCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo)
+{
+ LogDebug("enter");
+ debugCustomHandlerData(eventInfo);
+ // TODO to be continued...
+}
+
+void ViewLogic::protocolHandlerIsRegisteredCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo)
+{
+ LogDebug("enter");
+ debugCustomHandlerData(eventInfo);
+ // TODO to be continued...
+}
+
+void ViewLogic::protocolHandlerUnregistrationCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo)
+{
+ LogDebug("enter");
+ debugCustomHandlerData(eventInfo);
+ // TODO to be continued...
+}
+
+void ViewLogic::contentHandlerRegistrationCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo)
+{
+ LogDebug("enter");
+ debugCustomHandlerData(eventInfo);
+ // TODO to be continued...
+}
+
+void ViewLogic::contentHandlerIsRegisteredCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo)
+{
+ LogDebug("enter");
+ debugCustomHandlerData(eventInfo);
+ // TODO to be continued...
+}
+
+void ViewLogic::contentHandlerUnregistrationCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo)
+{
+ LogDebug("enter");
+ debugCustomHandlerData(eventInfo);
+ // TODO to be continued...
+}
+
void ViewLogic::didRunJavaScriptCallback(
Evas_Object* /*obj*/,
const char* result,