%build
export GYP_GENERATORS='ninja'
-GYP_OPTIONS="--depth=."
+GYP_OPTIONS="--depth=.
+-Dprofile=%{profile}"
# BuildType: Debug / Release
%if 0%{?tizen_build_devel_mode}
ewk_context_notify_low_memory(ewk_context_);
}
+#ifdef PROFILE_WEARABLE
+void WebApplication::OnRotaryEvent(WebView* /*view*/,
+ RotaryEventType type) {
+ 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 = \""
+ << (type == RotaryEventType::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());
+}
+#endif // PROFILE_WEARABLE
+
bool WebApplication::OnContextMenuDisabled(WebView* /*view*/) {
return !(app_data_->setting_info() != NULL
? app_data_->setting_info()->context_menu_enabled()
virtual void OnUsermediaPermissionRequest(
WebView* view, const std::string& url,
std::function<void(bool)> result_handler);
+#ifdef PROFILE_WEARABLE
+ virtual void OnRotaryEvent(WebView* view,
+ RotaryEventType type);
+#endif // PROFILE_WEARABLE
private:
bool Initialize();
namespace runtime {
class WebViewImpl;
+enum class RotaryEventType {
+ CLOCKWISE, // Rotary is rotated clockwise direction
+ COUNTER_CLOCKWISE // Rotary is rotated counter clockwise direction
+};
+
class WebView {
public:
class EventListener {
WebView* /*view*/,
const std::string& /*url*/,
std::function<void(bool)> /*result_handler*/) {}
+#ifdef PROFILE_WEARABLE
+ virtual void OnRotaryEvent(
+ WebView* /*view*/,
+ RotaryEventType /*type*/) {}
+#endif // PROFILE_WEARABLE
};
WebView(NativeWindow* window, Ewk_Context* context);
InitCertificateAllowCallback();
InitPopupWaitCallback();
InitUsermediaCallback();
+#ifdef PROFILE_WEARABLE
+ InitRotaryEventCallback();
+#endif // PROFILE_WEARABLE
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);
}
+#ifdef PROFILE_WEARABLE
+void WebViewImpl::InitRotaryEventCallback() {
+ auto rotary_callback = [](void* user_data,
+ Evas_Object*,
+ Eext_Rotary_Event_Info* event_info) -> Eina_Bool {
+ WebViewImpl* self = static_cast<WebViewImpl*>(user_data);
+ Eext_Rotary_Event_Info* rotary = event_info;
+
+ RotaryEventType type;
+ if (rotary->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE)
+ type = RotaryEventType::CLOCKWISE;
+ else
+ type = RotaryEventType::COUNTER_CLOCKWISE;
+
+ self->listener_->OnRotaryEvent(self->view_, type);
+ 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);
+}
+#endif // PROFILE_WEARABLE
+
std::string WebViewImpl::GetUrl() {
return std::string(ewk_view_url_get(ewk_view_));
}
void InitCertificateAllowCallback();
void InitPopupWaitCallback();
void InitUsermediaCallback();
+#ifdef PROFILE_WEARABLE
+ void InitRotaryEventCallback();
+#endif // PROFILE_WEARABLE
NativeWindow* window_;
Ewk_Context* context_;
'launchpad',
],
},
+ 'conditions': [
+ ['profile == "wearable"', {
+ 'defines': ['PROFILE_WEARABLE'],
+ }],
+ ],
}, # end of target 'xwalk_runtime'
{
'target_name': 'xwalk_injected_bundle',