#include <memory>
#include <sstream>
#include <vector>
+#include <efl_extension.h>
#include "common/application_data.h"
#include "common/app_db.h"
ewk_context_notify_low_memory(ewk_context_);
}
+void WebApplication::OnRotaryEvent(WebView* /*view*/,
+ Eext_Rotary_Event_Info* info) {
+ LOGGER(DEBUG) << "OnRotaryEvent";
+ std::stringstream script;
+ script
+ << "(function(){"
+ << "var __event = document.createEvent(\"CustomEvent\");\n"
+ << "var __detail = {};\n"
+ << "__event.initCustomEvent(\"rotarydetent\", true, true, __detail);\n"
+ << "__event.detail.direction = \""
+ << (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE ? "CW" : "CCW")
+ << "\";\n"
+ << "document.dispatchEvent(__event);\n"
+ << "\n"
+ << "for (var i=0; i < window.frames.length; i++)\n"
+ << "{ window.frames[i].document.dispatchEvent(__event); }"
+ << "})()";
+ std::string kRotaryEventScript = script.str();
+ if (view_stack_.size() > 0 && view_stack_.front() != NULL)
+ view_stack_.front()->EvalJavascript(kRotaryEventScript.c_str());
+}
+
bool WebApplication::OnContextMenuDisabled(WebView* /*view*/) {
return !(app_data_->setting_info() != NULL
? app_data_->setting_info()->context_menu_enabled()
#include <list>
#include <memory>
#include <string>
+#include <efl_extension.h>
#include "runtime/browser/web_view.h"
virtual void OnUsermediaPermissionRequest(
WebView* view, const std::string& url,
std::function<void(bool)> result_handler);
+ virtual void OnRotaryEvent(WebView* view,
+ Eext_Rotary_Event_Info* info);
private:
bool Initialize();
#include <ewk_chromium.h>
#include <functional>
#include <sstream>
+#include <efl_extension.h>
#include "runtime/browser/native_window.h"
#include "runtime/browser/web_view_impl.h"
#include <ewk_chromium.h>
#include <functional>
#include <string>
+#include <efl_extension.h>
#include "runtime/browser/native_window.h"
WebView* /*view*/,
const std::string& /*url*/,
std::function<void(bool)> /*result_handler*/) {}
+ virtual void OnRotaryEvent(
+ WebView* /*view*/,
+ Eext_Rotary_Event_Info* info) {}
};
WebView(NativeWindow* window, Ewk_Context* context);
InitCertificateAllowCallback();
InitPopupWaitCallback();
InitUsermediaCallback();
+ InitRotaryEventCallback();
Ewk_Settings* settings = ewk_view_settings_get(ewk_view_);
ewk_settings_scripts_can_open_windows_set(settings, EINA_TRUE);
ewk_view_user_media_permission_callback_set(ewk_view_, callback, this);
}
+void WebViewImpl::InitRotaryEventCallback() {
+ auto rotary_callback = [](void* user_data,
+ Evas_Object* /*obj*/,
+ Eext_Rotary_Event_Info* event_info) -> Eina_Bool {
+ WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
+ Eext_Rotary_Event_Info* rotary = event_info;
+ self->listener_->OnRotaryEvent(self->view_, rotary);
+ return EINA_TRUE;
+ };
+
+ // add callback to handle rotary event
+ eext_rotary_object_event_callback_add(ewk_view_, rotary_callback, this);
+ eext_rotary_object_event_activated_set(ewk_view_, EINA_TRUE);
+}
+
std::string WebViewImpl::GetUrl() {
return std::string(ewk_view_url_get(ewk_view_));
}
void InitCertificateAllowCallback();
void InitPopupWaitCallback();
void InitUsermediaCallback();
+ void InitRotaryEventCallback();
NativeWindow* window_;
Ewk_Context* context_;