KeyEvent event(type, windows_key_code, domCode, key_modifiers, domKey,
base::TimeTicks::Now(), false);
+#if BUILDFLAG(IS_TIZEN_TV)
+ const char* device_name = evas_device_name_get(evt->dev);
+ if (device_name) {
+ // We need distinguish if key is from RC in render process
+ if (IsRCDevice(evas_device_class_get(evt->dev), device_name))
+ event.is_from_rc = true;
+
+ // Add device name property in keyboard event.
+ event.device_name = device_name;
+ }
+#endif
+
#else
KeyEvent event(type, windows_key_code, key_modifiers, base::TimeTicks::Now());
#endif
namespace ui {
-// TV RC device names
-const std::string kDeviceNameSmartView = "SMART_VIEW";
-const std::string kDeviceNamePanelKey = "wt61p807 panel key device";
-const std::string kDeviceNameRemote = "wt61p807 rc device";
-const std::string kDeviceNameSmartRC = "Smart Control";
-// To allow to receive Tomato send key events
-const std::string kDeviceNameAutoModeDevice = "AUTO_MODE_DEVICE";
-const std::string kDeviceNameIME = "ime";
-
-bool IsRCDevice(Evas_Device_Class device_id, const std::string device_name) {
- if (device_id == EVAS_DEVICE_CLASS_KEYBOARD) {
- return (!device_name.compare(kDeviceNameRemote) ||
- !device_name.compare(kDeviceNameSmartView) ||
- !device_name.compare(kDeviceNamePanelKey) ||
- !device_name.compare(kDeviceNameAutoModeDevice) ||
- device_name.find(kDeviceNameSmartRC) != std::string::npos);
- }
- return false;
-}
-
static ui::KeyboardCode UIKeyCodeFromEflKey(const char* key) {
static std::unordered_map<std::string, ui::KeyboardCode> code_from_key_map({
{"Shift_L", ui::VKEY_SHIFT},
#if BUILDFLAG(IS_EFL)
webkit_event.is_system_key = event.is_system_key;
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ webkit_event.is_from_rc = event.is_from_rc;
+
+ strncpy(webkit_event.device_name, event.device_name.c_str(),
+ sizeof(webkit_event.device_name) - 1);
+ webkit_event.device_name[sizeof(webkit_event.device_name) - 1] = '\0';
+#endif
return webkit_event;
}
#if BUILDFLAG(IS_EFL)
is_system_key(IsSystemKeyFromNative(native_event)),
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ is_from_rc(IsFromRCFromNative(native_event)),
+ device_name(DeviceNameFromNative(native_event)),
+#endif
is_char_(IsCharFromNative(native_event)) {
#if defined(USE_OZONE)
DCHECK(native_event->IsKeyEvent());
bool is_system_key = false;
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ bool is_from_rc = false;
+ std::string device_name;
+#endif
+
protected:
friend class KeyEventTestApi;
EVENTS_EXPORT bool IsSystemKeyFromNative(const PlatformEvent& native_event);
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+// Returns the |is_from_rc| value from a native event.
+EVENTS_EXPORT bool IsFromRCFromNative(const PlatformEvent& native_event);
+
+// Returns the |device_name| value from a native event.
+EVENTS_EXPORT std::string DeviceNameFromNative(
+ const PlatformEvent& native_event);
+#endif
+
// Returns true if the keyboard event is a character event rather than
// a keystroke event.
EVENTS_EXPORT bool IsCharFromNative(const PlatformEvent& native_event);
}
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+bool IsFromRCFromNative(const PlatformEvent& native_event) {
+ const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event);
+ DCHECK(event->IsKeyEvent());
+ return event->is_from_rc;
+}
+
+std::string DeviceNameFromNative(const PlatformEvent& native_event) {
+ const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event);
+ DCHECK(event->IsKeyEvent());
+ return event->device_name;
+}
+#endif
+
bool IsCharFromNative(const PlatformEvent& native_event) {
const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event);
DCHECK(event->IsKeyEvent());