#define MAX_SURFACE_WIDTH_EGL 4096 //max supported Framebuffer width
#define MAX_SURFACE_HEIGHT_EGL 4096 //max supported Framebuffer height
-namespace {
-const char kSmartCallbackName_MotionEnable[] = "motion,enable";
-const char kSmartCallbackName_MotionMove[] = "motion,move";
-const char kSmartCallbackName_MotionZoom[] = "motion,zoom";
-}
-
namespace content {
void RenderWidgetHostViewBase::GetDefaultScreenInfo(
evas_object_smart_callback_add(content_image_elm_host_,
"unfocused", OnHostFocusOut, this);
- if (smart_parent_) {
- evas_object_smart_callback_add(smart_parent_,
- kSmartCallbackName_MotionEnable, OnMotionEnable, this);
- evas_object_smart_callback_add(smart_parent_,
- kSmartCallbackName_MotionMove, OnMotionMove, this);
- evas_object_smart_callback_add(smart_parent_,
- kSmartCallbackName_MotionZoom, OnMotionZoom, this);
- }
-
evas_object_event_callback_add(content_image_, EVAS_CALLBACK_MOUSE_DOWN,
OnMouseDown, this);
evas_object_event_callback_add(content_image_, EVAS_CALLBACK_MOUSE_UP,
evas_object_smart_callback_del(content_image_elm_host_,
"unfocused", OnHostFocusOut);
- if (smart_parent_) {
- evas_object_smart_callback_del(smart_parent_,
- kSmartCallbackName_MotionEnable, OnMotionEnable);
- evas_object_smart_callback_del(smart_parent_,
- kSmartCallbackName_MotionMove, OnMotionMove);
- evas_object_smart_callback_del(smart_parent_,
- kSmartCallbackName_MotionZoom, OnMotionZoom);
- }
-
evas_object_event_callback_del(content_image_, EVAS_CALLBACK_MOUSE_DOWN,
OnMouseDown);
evas_object_event_callback_del(content_image_, EVAS_CALLBACK_MOUSE_UP,
thiz->Blur();
}
-void RenderWidgetHostViewEfl::OnMotionEnable(
- void* data, Evas_Object*, void*) {
- NOTIMPLEMENTED();
-}
-
-void RenderWidgetHostViewEfl::OnMotionMove(
- void* data, Evas_Object*, void*) {
- NOTIMPLEMENTED();
-}
-
-void RenderWidgetHostViewEfl::OnMotionZoom(
- void* data, Evas_Object* eo, void* event_info) {
- NOTIMPLEMENTED();
-}
-
void RenderWidgetHostViewEfl::OnMouseDown(
void* data, Evas* evas, Evas_Object* obj, void* event_info) {
RenderWidgetHostViewEfl* rwhv = static_cast<RenderWidgetHostViewEfl*>(data);
ui::TouchEvent touch_event = MakeTouchEvent(pt, state, id, content_image_);
HandleTouchEvent(&touch_event);
}
-
-#if defined(EWK_REFACTOR) //defined(OS_TIZEN)
- if (count >= 2) {
- state = evas_touch_point_list_nth_state_get(evas_, 0);
- if (state == EVAS_TOUCH_POINT_DOWN) {
- wkext_motion_tilt_start(content_image_, &pt);
- } else if (state == EVAS_TOUCH_POINT_UP) {
- wkext_motion_tilt_stop();
- }
- }
-#endif
}
void RenderWidgetHostViewEfl::SetDoubleTapSupportEnabled(bool enabled) {
magnifier_ = status;
}
-void RenderWidgetHostViewEfl::FilterInputMotion(const blink::WebGestureEvent& gesture_event) {
-#if defined(EWK_REFACTOR) //defined(OS_TIZEN)
- if (gesture_event.type == blink::WebInputEvent::GesturePinchUpdate) {
- Evas_Coord_Point position;
-
- position.x = gesture_event.x;
- position.y = gesture_event.y;
- wkext_motion_tilt_position_update(&position);
- }
-#endif
-}
-
ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& event) {
ui::LatencyInfo latency_info;
// The latency number should only be added if the timestamp is valid.
void RenderWidgetHostViewEfl::SendGestureEvent(
blink::WebGestureEvent& event) {
HandleGesture(event);
- FilterInputMotion(event);
if (magnifier_ && event.type == blink::WebInputEvent::GestureScrollUpdate)
return;
if (host_ && event.type != blink::WebInputEvent::Undefined)
+++ /dev/null
-// Copyright 2012 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "MotionUI.h"
-#include "wkext_motion.h"
-#include "base/logging.h"
-
-unsigned int MotionUI::s_tiltToZoomStartAngle = 3;
-
-static void freeTitleViewHashEntry(void *data) {
- free(data);
-}
-
-MotionUI& MotionUI::motionUI() {
- static MotionUI& motionUI = *new MotionUI();
- return motionUI;
-}
-
-MotionUI::MotionUI()
- : m_sensorHandle(0)
- , m_sensorTimer(0)
- , m_ewkView(0)
- , m_isTiltToZoomStarted(false)
- , m_tiltAngle(0)
- , m_lastTiltScale(0)
- , m_lastPinchScale(0)
- , tiltBaseScaleFactor(0.01)
- , tiltScaleFactorUnit(0.0005) {
- m_tiltViewHash = eina_hash_pointer_new(freeTitleViewHashEntry);
-}
-
-MotionUI::~MotionUI() {
- eina_hash_free(m_tiltViewHash);
- stopSensor();
-}
-
-#if !defined(TIZEN_LEGACY_V_2_2_1)
-static sensor_listener_h listener_;
-#endif
-
-Eina_Bool MotionUI::initializeSensor(void*) {
- MotionUI& motionUI(MotionUI::motionUI());
-
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- sensor_get_default_sensor(SENSOR_GRAVITY, &motionUI.m_sensorHandle);
-
- if (sensor_create_listener(motionUI.m_sensorHandle, &listener_) == SENSOR_ERROR_NONE) {
- if (sensor_listener_set_event_cb(listener_, 100, tiltCallback, 0) == SENSOR_ERROR_NONE) {
- int retSensorStart = sensor_listener_start(listener_);
-#else
- if (sensor_create(&motionUI.m_sensorHandle) == SENSOR_ERROR_NONE) {
- if (sensor_motion_tilt_set_cb(motionUI.m_sensorHandle, tiltCallback, 0) == SENSOR_ERROR_NONE) {
- int retSensorStart = sensor_start(motionUI.m_sensorHandle, SENSOR_MOTION_TILT);
-#endif
- if (retSensorStart == SENSOR_ERROR_NONE || retSensorStart == SENSOR_ERROR_NOT_SUPPORTED) {
- motionUI.m_sensorTimer = 0;
- return ECORE_CALLBACK_CANCEL;
- }
- }
- } else {
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- motionUI.m_sensorHandle = 0;
-#endif
- return ECORE_CALLBACK_RENEW;
- }
-
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- sensor_listener_stop(listener_);
- sensor_destroy_listener(listener_);
-#else
- sensor_destroy(motionUI.m_sensorHandle);
- motionUI.m_sensorHandle = 0;
-#endif
-
- return ECORE_CALLBACK_RENEW;
-}
-
-void MotionUI::startSensor() {
- if (m_sensorTimer)
- return;
-
- if (initializeSensor(0) == ECORE_CALLBACK_RENEW)
- m_sensorTimer = ecore_timer_add(.1, initializeSensor, 0);
-}
-
-void MotionUI::stopSensor() {
- if (m_sensorTimer) {
- ecore_timer_del(m_sensorTimer);
- m_sensorTimer = 0;
- }
-
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- if (!listener_)
-#else
- if (!m_sensorHandle)
-#endif
- return;
-
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- sensor_destroy_listener(listener_);
-#else
- sensor_destroy(m_sensorHandle);
-
- m_sensorHandle = 0;
-#endif
-}
-
-void MotionUI::setTiltToZoom(Evas_Object* view, bool enable, unsigned int sensitivity) {
- LOG(ERROR)<<"***************** MotionUI::setTiltToZoom " << enable << ",sen " << sensitivity;
-
- if (enable) {
- unsigned* data = new unsigned(sensitivity);
- eina_hash_add(m_tiltViewHash, &view, data);
- }
- else {
- eina_hash_del(m_tiltViewHash, &view, NULL);
-
- if (!eina_hash_population(m_tiltViewHash))
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- sensor_listener_unset_event_cb(listener_);
-#else
- sensor_motion_tilt_unset_cb(m_sensorHandle);
-#endif
- }
-}
-
-#if !defined(TIZEN_LEGACY_V_2_2_1)
-void MotionUI::tiltCallback(sensor_h sensor, sensor_event_s *event, void*) {
-#else
-void MotionUI::tiltCallback(unsigned long long, int x, int y, void*) {
-#endif
- MotionUI& motionUI(MotionUI::motionUI());
-
- if (!motionUI.m_ewkView)
- return;
-
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- int x = event->values[0];
- int y = event->values[1];
-#endif
-
- Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(motionUI.m_ewkView));
- int angle;
- switch (ecore_evas_rotation_get(ee)) {
- case 90:
- angle = -x;
- break;
- case 180:
- angle = -y;
- break;
- case 270:
- angle = x;
- break;
- default:
- angle = y;
- break;
- }
- if (motionUI.m_tiltAngle == 0) {
- motionUI.m_tiltAngle += angle;
- unsigned sensitivity = 0;
- void* data = eina_hash_find(motionUI.m_tiltViewHash, motionUI.m_ewkView);
- if (data)
- sensitivity = *static_cast<unsigned*>(data);
-
- motionUI.m_lastTiltScale = 1.0f + (motionUI.m_tiltAngle * (motionUI.tiltBaseScaleFactor + sensitivity * motionUI.tiltScaleFactorUnit));
- }
-
- motionUI.m_tiltAngle += angle;
- if (!motionUI.m_isTiltToZoomStarted && abs(motionUI.m_tiltAngle) < MotionUI::s_tiltToZoomStartAngle)
- return;
-
- motionUI.tiltToZoom();
-}
-
-void MotionUI::initializeTiltToZoom(Evas_Object* view, const Evas_Coord_Point* position) {
- if (!eina_hash_find(m_tiltViewHash, &view))
- return;
-
- m_ewkView = view;
-
- if (position)
- memcpy(&m_tiltPosition, position, sizeof(Evas_Coord_Point));
-
- m_isTiltToZoomStarted = false;
- m_tiltAngle = 0;
-
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- if (sensor_listener_set_event_cb(listener_, 100, tiltCallback, 0))
-#else
- if (sensor_motion_tilt_set_cb(m_sensorHandle, tiltCallback, 0))
-#endif
- startSensor();
-}
-
-void MotionUI::stopTiltToZoom() {
- if (!m_ewkView)
- return;
-
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- sensor_listener_unset_event_cb(listener_);
-#else
- sensor_motion_tilt_unset_cb(m_sensorHandle);
-#endif
-
- stopSensor();
- m_ewkView = 0;
-}
-
-bool MotionUI::isTiltToZoomStarted() {
- return m_isTiltToZoomStarted;
-}
-
-void MotionUI::tiltToZoom() {
- if (!m_isTiltToZoomStarted) {
- m_isTiltToZoomStarted = true;
- evas_object_smart_callback_call(m_ewkView, "motion,move" , 0);
- }
-
- Wkext_Motion_Event motionEvent;
- motionEvent.position.x = m_tiltPosition.x;
- motionEvent.position.y = m_tiltPosition.y;
-
- unsigned sensitivity = 0;
- void* data = eina_hash_find(m_tiltViewHash, m_ewkView);
- if (data)
- sensitivity = *static_cast<unsigned*>(data);
-
- double lastTiltScale = 1.0f + (m_tiltAngle * (tiltBaseScaleFactor + sensitivity * tiltScaleFactorUnit));
-
- if (m_lastTiltScale != -10.0) {
- motionEvent.scale = 1.0f + (lastTiltScale - m_lastTiltScale);
-
- LOG(ERROR) << "###m_tiltAngle :" << m_tiltAngle << " scale " << motionEvent.scale << ", m_lastTiltScale" << m_lastTiltScale;
- // motionEvent.scale = syncScale(lastTiltScale, true);
- // motionEvent.scale = lastTiltScale;
- evas_object_smart_callback_call(m_ewkView, "motion,zoom", &motionEvent);
- }
- m_lastTiltScale = lastTiltScale;
-}
-
-void MotionUI::scaleInitialize(double scale) {
- m_syncScale = scale;
- if (m_syncScale < 0)
- m_syncScale = 0;
- m_lastTiltScale = scale;
- m_lastPinchScale = scale;
-}
-
-void MotionUI::updateTiltPosition(Evas_Coord_Point* position) {
- m_tiltPosition.x = position->x;
- m_tiltPosition.y = position->y;
-}
-
-double MotionUI::syncScale(double scale, bool isTiltMode) {
- if (isTiltMode)
- m_syncScale = 1.0 + (scale - m_lastTiltScale);
- else
- m_syncScale = 1.0 + (scale - m_lastPinchScale);
-
- if (m_syncScale < 0)
- m_syncScale = 0;
- else if (m_syncScale > 5)
- m_syncScale = 5;
- if (isTiltMode)
- m_lastTiltScale = scale;
- else
- m_lastPinchScale = scale;
-
- return m_syncScale;
-}
+++ /dev/null
-// Copyright 2012 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MotionUI_h
-#define MotionUI_h
-
-#include <Ecore.h>
-#include <Ecore_Evas.h>
-#if !defined(TIZEN_LEGACY_V_2_2_1)
-#include <sensor/sensor.h>
-#else
-#include <sensors.h>
-#endif
-
-
-class MotionUI {
- public:
- static MotionUI& motionUI();
- ~MotionUI();
-
- void setTiltToZoom(Evas_Object*, bool, unsigned int);
-
- void initializeTiltToZoom(Evas_Object*, const Evas_Coord_Point*);
- void stopTiltToZoom();
- bool isTiltToZoomStarted();
-
- void updateTiltPosition(Evas_Coord_Point* position);
- void scaleInitialize(double scale);
- double syncScale(double scale, bool isTiltMode);
-
- private:
- static Eina_Bool initializeSensor(void*);
-#if !defined(TIZEN_LEGACY_V_2_2_1)
- static void tiltCallback(sensor_h sensor, sensor_event_s *event, void*);
-#else
- static void tiltCallback(unsigned long long, int, int, void*);
-#endif
- MotionUI();
-
- void startSensor();
- void stopSensor();
-
- void tiltToZoom();
-
- static unsigned int s_tiltToZoomStartAngle;
-
- Eina_Hash* m_tiltViewHash;
-
- sensor_h m_sensorHandle;
- Ecore_Timer* m_sensorTimer;
-
- Evas_Object* m_ewkView;
- Evas_Coord_Point m_tiltPosition;
- bool m_isTiltToZoomStarted;
- int m_tiltAngle;
-
- //Sync for pinch zoom
- double m_syncScale;
- double m_lastTiltScale;
- double m_lastPinchScale;
- double tiltBaseScaleFactor;
- double tiltScaleFactorUnit;
-};
-
-#endif // MotionUI_h
+++ /dev/null
-// Copyright 2000 - 2013 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "wkext_motion.h"
-#include "MotionUI.h"
-#include "base/logging.h"
-
-#if !defined(EWK_BRINGUP)
-void wkext_motion_tilt_enable_set(Evas_Object* view, int enable, unsigned int sensitivity) {
- LOG(ERROR)<<"wkext_motion_tilt_enable_set";
- MotionUI::motionUI().setTiltToZoom(view, enable, sensitivity);
-}
-
-void wkext_motion_tilt_start(Evas_Object* view, const Evas_Coord_Point* position) {
- MotionUI::motionUI().initializeTiltToZoom(view, position);
-}
-
-void wkext_motion_tilt_stop() {
- MotionUI::motionUI().stopTiltToZoom();
-}
-
-int wkext_motion_tilt_is_running() {
- return MotionUI::motionUI().isTiltToZoomStarted();
-}
-
-void wkext_motion_tilt_position_update(Evas_Coord_Point* position) {
- MotionUI::motionUI().updateTiltPosition(position);
-}
-
-void wkext_motion_tilt_scale_initialize(double scale) {
- MotionUI::motionUI().scaleInitialize(scale);
-}
-
-double wkext_motion_tilt_scale_sync(double scale, Wkext_Motion_Type type) {
- int isTiltMode = true;
- if (type == WKEXT_MOTION_TYPE_PINCH)
- isTiltMode = false;
-
- return MotionUI::motionUI().syncScale(scale, isTiltMode);
-}
-#else
-void wkext_motion_tilt_enable_set(Evas_Object* view, int enable, unsigned int sensitivity) {}
-void wkext_motion_tilt_start(Evas_Object* view, const Evas_Coord_Point* position) {}
-void wkext_motion_tilt_stop() {}
-int wkext_motion_tilt_is_running() { return EINA_FALSE; }
-void wkext_motion_tilt_position_update(Evas_Coord_Point* position) {}
-void wkext_motion_tilt_scale_initialize(double scale) {}
-double wkext_motion_tilt_scale_sync(double scale, Wkext_Motion_Type type) { return 0.; }
-#endif
+++ /dev/null
-// Copyright 2000 - 2013 Samsung Electronics. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <Evas.h>
-
-#ifndef wkext_motion_h
-#define wkext_motion_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _Wkext_Motion_Event {
- Evas_Coord_Point position;
- double scale;
-} Wkext_Motion_Event;
-
-enum _Wkext_Motion_Type {
- WKEXT_MOTION_TYPE_PINCH,
- WKEXT_MOTION_TYPE_TILT
-};
-typedef enum _Wkext_Motion_Type Wkext_Motion_Type;
-
-EAPI void wkext_motion_tilt_start(Evas_Object* view, const Evas_Coord_Point* position);
-EAPI void wkext_motion_tilt_stop();
-EAPI int wkext_motion_tilt_is_running();
-EAPI void wkext_motion_tilt_position_update(Evas_Coord_Point* position);
-EAPI void wkext_motion_tilt_scale_initialize(double scale);
-EAPI double wkext_motion_tilt_scale_sync(double scale, Wkext_Motion_Type type);
-EAPI void wkext_motion_tilt_enable_set(Evas_Object *view, int enable, unsigned int sensitivity);
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
],
}], # building_for_tizen==1
- ['building_for_tizen_mobile==1', {
- 'sources': [
- 'browser/motion/wkext_motion.h',
- 'browser/motion/wkext_motion.cc',
- 'browser/motion/MotionUI.cc',
- 'browser/motion/MotionUI.h',
- ],
- }], # building_for_tizen_mobile==1
-
['notifications==1', {
'sources': [
'browser/notification/notification_controller_efl.cc',
#include "ui/events/event_switches.h"
#include "web_contents_efl_delegate_ewk.h"
#include "web_contents_view_efl_delegate_ewk.h"
-#if defined(OS_TIZEN_MOBILE)
-#include "browser/motion/wkext_motion.h"
-#endif
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/screen.h"
#include "devtools_delegate_efl.h"
#include "browser/web_view_evas_handler.h"
-#if defined(OS_TIZEN)
-#include <vconf.h>
-#endif
#include "browser/selectpicker/popup_menu_item.h"
#include "browser/selectpicker/popup_menu_item_private.h"
#include <Ecore_Evas.h>
}
}
-#if defined(OS_TIZEN_MOBILE)
-bool GetTiltZoomEnabled()
-{
- int motion_enabled = 0;
- vconf_get_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &motion_enabled);
- if (motion_enabled) {
- int tilt_enabled = 0;
- vconf_get_bool(VCONFKEY_SETAPPL_USE_TILT, &tilt_enabled);
- //BROWSER_LOGD("******* motion_enabled=[%d], tilt_enabled=[%d]", motion_enabled, tilt_enabled);
- if (tilt_enabled) {
- return true;
- }
- }
- return false;
-}
-#endif // OS_TIZEN
-
void GetEinaRectFromGfxRect(const gfx::Rect& gfx_rect, Eina_Rectangle* eina_rect)
{
eina_rect->x = gfx_rect.x();
geolocation_permission_cb_.reset(new WebViewGeolocationPermissionCallback(NULL, NULL));
unfocus_allow_cb_.reset(new WebViewUnfocusAllowCallback(NULL, NULL));
-#if defined(OS_TIZEN_MOBILE)
-#if defined(EWK_REFACTOR)
- bool enable = GetTiltZoomEnabled();
- if (enable) {
- evas_event_handler_->BindMotionEventHandlers();
- } else {
- evas_event_handler_->UnbindMotionEventHandlers();
- }
- //evas_object_smart_callback_call(evas_object(), "motion,enable", (void*)&enable);
- wkext_motion_tilt_enable_set(evas_object_, static_cast<int>(enable),
- g_default_tilt_motion_sensitivity);
-#endif
-#endif
-
base::CommandLine *cmdline = base::CommandLine::ForCurrentProcess();
if (cmdline->HasSwitch(switches::kTouchEvents))
SetTouchEventsEnabled(true);