- JavascriptMessageHandler callback which has two arguments of msg name and body
Change-Id: Ia2a430044375e86623664948a1e31fabff9d4155
ewk_view_javascript_message_handler_add(mWebView, &TizenWebEngineChromium::OnJavaScriptInjected, exposedObjectName.c_str());
}
+void TizenWebEngineChromium::AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, JavaScriptEntireMessageHandlerCallback handler)
+{
+ mJavaScriptEntireMessageReceivedCallback = handler;
+ ewk_view_javascript_message_handler_add(mWebView, &TizenWebEngineChromium::OnJavaScriptEntireMessageReceived, exposedObjectName.c_str());
+}
+
void TizenWebEngineChromium::RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback)
{
mJavaScriptAlertCallback = callback;
}
}
+void TizenWebEngineChromium::OnJavaScriptEntireMessageReceived(Evas_Object* o, Ewk_Script_Message message)
+{
+ auto plugin = WebEngineManager::Get().Find(o);
+ if(plugin)
+ {
+ auto pThis = static_cast<TizenWebEngineChromium*>(plugin);
+ std::string messageName = static_cast<const char*>(message.name);
+ std::string messageBody;
+ if(message.body != nullptr)
+ {
+ messageBody = static_cast<char*>(message.body);
+ }
+ ExecuteCallback(pThis->mJavaScriptEntireMessageReceivedCallback, messageName, messageBody);
+ }
+}
+
Eina_Bool TizenWebEngineChromium::OnJavaScriptAlert(Evas_Object* o, const char* alert_text, void* data)
{
auto pThis = static_cast<TizenWebEngineChromium*>(data);
void AddJavaScriptMessageHandler(const std::string& exposedObjectName, JavaScriptMessageHandlerCallback handler) override;
/**
+ * @copydoc Dali::WebEnginePlugin::AddJavaScriptEntireMessageHandler()
+ */
+ void AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, JavaScriptEntireMessageHandlerCallback handler) override;
+
+ /**
* @copydoc Dali::WebEnginePlugin::RegisterJavaScriptAlertCallback()
*/
void RegisterJavaScriptAlertCallback(JavaScriptAlertCallback callback) override;
static void OnAuthenticationChallenged(Evas_Object*, Ewk_Auth_Challenge* authChallenge, void* data);
static void OnJavaScriptEvaluated(Evas_Object* o, const char* result, void* data);
static void OnJavaScriptInjected(Evas_Object* o, Ewk_Script_Message message);
+ static void OnJavaScriptEntireMessageReceived(Evas_Object* o, Ewk_Script_Message message);
static Eina_Bool OnJavaScriptAlert(Evas_Object* o, const char* alert_text, void*);
static Eina_Bool OnJavaScriptConfirm(Evas_Object* o, const char* message, void*);
static Eina_Bool OnJavaScriptPrompt(Evas_Object* o, const char* message, const char* default_value, void*);
GeolocationPermissionCallback mGeolocationPermissionCallback;
PlainTextReceivedCallback mPlainTextReceivedCallback;
JavaScriptMessageHandlerCallback mJavaScriptEvaluatedCallback;
+ JavaScriptEntireMessageHandlerCallback mJavaScriptEntireMessageReceivedCallback;
};
} // namespace Plugin
} // namespace Dali
});
}
+void TizenWebEngineLWE::AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptEntireMessageHandlerCallback handler)
+{
+ // NOT IMPLEMENTED
+}
+
void TizenWebEngineLWE::RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback)
{
// NOT IMPLEMENTED
void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler) override;
/**
+ * @copydoc Dali::WebEnginePlugin::AddJavaScriptEntireMessageHandler()
+ */
+ void AddJavaScriptEntireMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptEntireMessageHandlerCallback handler) override;
+
+ /**
* @copydoc Dali::WebEnginePlugin::RegisterJavaScriptAlertCallback()
*/
void RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback) override;