# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/features.gni") import("//build/config/ui.gni") import("//testing/test.gni") import("//ui/base/ui_features.gni") import("//ui/ozone/ozone.gni") if (is_android) { import("//build/config/android/rules.gni") } if (is_ios) { import("//ios/build/config.gni") } static_library("dom_keycode_converter") { sources = [ "keycodes/dom/dom_code.h", "keycodes/dom/dom_key.h", "keycodes/dom/dom_key_data.inc", "keycodes/dom/dom_keyboard_layout.cc", "keycodes/dom/dom_keyboard_layout.h", "keycodes/dom/dom_keyboard_layout_manager.cc", "keycodes/dom/dom_keyboard_layout_manager.h", "keycodes/dom/keycode_converter.cc", "keycodes/dom/keycode_converter.h", "keycodes/dom/keycode_converter_data.inc", ] deps = [ "//base", ] if (!is_ios) { deps += [ "//ipc:param_traits" ] } } source_set("event_constants") { sources = [ "event_constants.h", ] } source_set("platform_event") { sources = [ "platform_event.h", ] } component("events_base") { sources = [ "android/scroller.cc", "android/scroller.h", "base_event_utils.cc", "base_event_utils.h", "event_switches.cc", "event_switches.h", "events_base_export.h", "fraction_of_time_without_user_input_recorder.cc", "fraction_of_time_without_user_input_recorder.h", "gesture_curve.h", "gesture_event_details.cc", "gesture_event_details.h", "gestures/fixed_velocity_curve.cc", "gestures/fixed_velocity_curve.h", "gestures/fling_curve.cc", "gestures/fling_curve.h", "keycodes/dom_us_layout_data.h", "keycodes/keyboard_code_conversion.cc", "keycodes/keyboard_code_conversion.h", "keycodes/keyboard_code_conversion_android.cc", "keycodes/keyboard_code_conversion_android.h", "keycodes/keyboard_code_conversion_mac.h", "keycodes/keyboard_code_conversion_mac.mm", "keycodes/keyboard_code_conversion_win.cc", "keycodes/keyboard_code_conversion_win.h", "keycodes/keyboard_codes.h", ] defines = [ "EVENTS_BASE_IMPLEMENTATION" ] deps = [ "//base/third_party/dynamic_annotations", ] public_deps = [ ":dom_keycode_converter", ":event_constants", ":platform_event", "//base", "//ui/events/platform", "//ui/gfx/geometry", ] if (use_x11) { public_deps += [ "//ui/events/keycodes:x11" ] } if (!is_ios) { deps += [ "//ipc:param_traits" ] } if (is_mac) { libs = [ "AppKit.framework", "Carbon.framework", ] } if (is_chromecast && !is_android) { sources += [ "chromecast/scroller.cc", "chromecast/scroller.h", ] } } component("events") { sources = [ "cocoa/cocoa_event_utils.h", "cocoa/cocoa_event_utils.mm", "cocoa/events_mac.mm", "event.cc", "event.h", "event_dispatcher.cc", "event_dispatcher.h", "event_handler.cc", "event_handler.h", "event_modifiers.cc", "event_modifiers.h", "event_processor.cc", "event_processor.h", "event_rewriter.cc", "event_rewriter.h", "event_sink.h", "event_source.cc", "event_source.h", "event_target.cc", "event_target.h", "event_target_iterator.h", "event_targeter.h", "event_utils.cc", "event_utils.h", "events_export.h", "events_stub.cc", "gestures/gesture_recognizer_impl_mac.cc", "gestures/gesture_types.h", "keyboard_hook.h", "keyboard_hook_base.cc", "keyboard_hook_base.h", "keycodes/platform_key_map_win.cc", "keycodes/platform_key_map_win.h", "mac/keyboard_hook_mac.mm", "null_event_targeter.cc", "null_event_targeter.h", "scoped_target_handler.cc", "scoped_target_handler.h", "system_input_injector.cc", "system_input_injector.h", "win/events_win.cc", "win/events_win_utils.cc", "win/events_win_utils.h", "win/keyboard_hook_win.cc", "win/system_event_state_lookup.cc", "win/system_event_state_lookup.h", ] defines = [ "EVENTS_IMPLEMENTATION" ] public_deps = [ ":events_base", "//ui/latency", ] deps = [ ":dom_keycode_converter", ":gesture_detection", "//base/third_party/dynamic_annotations", "//skia", "//ui/display", "//ui/gfx", "//ui/gfx/geometry", ] if (use_x11) { sources += [ "x/events_x.cc", "x/keyboard_hook_x11.cc", ] configs += [ "//build/config/linux:x11" ] deps += [ "//ui/events/devices", "//ui/events/devices/x11", "//ui/events/x", "//ui/gfx/x", ] } if (use_glib) { configs += [ "//build/config/linux:glib" ] } if (use_ozone) { sources += [ "events_default.cc" ] } if (is_win && use_ozone) { sources -= [ "win/events_win.cc" ] } if (use_ozone) { sources += [ "ozone/events_ozone.cc", "ozone/events_ozone.h", "ozone/keyboard_hook_ozone.cc", ] deps += [ "//ui/events/ozone:events_ozone_layout" ] } if (use_aura) { sources += [ "gestures/gesture_provider_aura.cc", "gestures/gesture_provider_aura.h", "gestures/gesture_recognizer.h", "gestures/gesture_recognizer_impl.cc", "gestures/gesture_recognizer_impl.h", "gestures/motion_event_aura.cc", "gestures/motion_event_aura.h", ] } if (is_win || is_mac || use_x11 || use_ozone) { sources -= [ "events_stub.cc" ] } if (is_android) { sources += [ "android/drag_event_android.cc", "android/drag_event_android.h", "android/event_handler_android.cc", "android/event_handler_android.h", "android/gesture_event_android.cc", "android/gesture_event_android.h", "android/gesture_event_type.h", "android/key_event_android.cc", "android/key_event_android.h", "android/key_event_utils.cc", "android/key_event_utils.h", "android/keyboard_hook_android.cc", "android/motion_event_android.cc", "android/motion_event_android.h", ] deps += [ ":keyevent_jni_headers", ":motionevent_jni_headers", ] } if (is_mac) { libs = [ "AppKit.framework" ] } } component("gesture_detection") { sources = [ "gesture_detection/bitset_32.h", "gesture_detection/filtered_gesture_provider.cc", "gesture_detection/filtered_gesture_provider.h", "gesture_detection/gesture_configuration.cc", "gesture_detection/gesture_configuration.h", "gesture_detection/gesture_detection_export.h", "gesture_detection/gesture_detector.cc", "gesture_detection/gesture_detector.h", "gesture_detection/gesture_event_data.cc", "gesture_detection/gesture_event_data.h", "gesture_detection/gesture_event_data_packet.cc", "gesture_detection/gesture_event_data_packet.h", "gesture_detection/gesture_listeners.cc", "gesture_detection/gesture_listeners.h", "gesture_detection/gesture_provider.cc", "gesture_detection/gesture_provider.h", "gesture_detection/gesture_provider_config_helper.cc", "gesture_detection/gesture_provider_config_helper.h", "gesture_detection/gesture_touch_uma_histogram.cc", "gesture_detection/gesture_touch_uma_histogram.h", "gesture_detection/motion_event.cc", "gesture_detection/motion_event.h", "gesture_detection/motion_event_buffer.cc", "gesture_detection/motion_event_buffer.h", "gesture_detection/motion_event_generic.cc", "gesture_detection/motion_event_generic.h", "gesture_detection/scale_gesture_detector.cc", "gesture_detection/scale_gesture_detector.h", "gesture_detection/scale_gesture_listeners.cc", "gesture_detection/scale_gesture_listeners.h", "gesture_detection/snap_scroll_controller.cc", "gesture_detection/snap_scroll_controller.h", "gesture_detection/touch_disposition_gesture_filter.cc", "gesture_detection/touch_disposition_gesture_filter.h", "gesture_detection/velocity_tracker.cc", "gesture_detection/velocity_tracker.h", "gesture_detection/velocity_tracker_state.cc", "gesture_detection/velocity_tracker_state.h", ] deps = [ ":events_base", "//base", "//base/third_party/dynamic_annotations", "//ui/display", "//ui/gfx", "//ui/gfx/geometry", ] defines = [ "GESTURE_DETECTION_IMPLEMENTATION" ] if (is_android) { sources += [ "gesture_detection/gesture_configuration_android.cc" ] } else if (is_chromecast) { sources += [ "gesture_detection/gesture_configuration_cast.cc" ] } else if (use_aura) { sources += [ "gesture_detection/gesture_configuration_aura.cc" ] } else { sources += [ "gesture_detection/gesture_configuration_default.cc" ] } } static_library("test_support") { sources = [ "test/cocoa_test_event_utils.h", "test/cocoa_test_event_utils.mm", "test/event_generator.cc", "test/event_generator.h", "test/events_test_utils.cc", "test/events_test_utils.h", "test/keyboard_layout.cc", "test/keyboard_layout.h", "test/keyboard_layout_mac.cc", "test/keyboard_layout_win.cc", "test/motion_event_test_utils.cc", "test/motion_event_test_utils.h", "test/platform_event_source_test_api.cc", "test/platform_event_source_test_api.h", "test/platform_event_waiter.cc", "test/platform_event_waiter.h", "test/test_event_handler.cc", "test/test_event_handler.h", "test/test_event_processor.cc", "test/test_event_processor.h", "test/test_event_target.cc", "test/test_event_target.h", "test/test_event_targeter.cc", "test/test_event_targeter.h", ] public_deps = [ ":events", ":events_base", ":gesture_detection", "//ui/events/devices", ] deps = [ "//base", "//skia", "//ui/events/platform", "//ui/gfx", "//ui/gfx/geometry", ] if (is_ios) { sources -= [ "test/cocoa_test_event_utils.h", "test/cocoa_test_event_utils.mm", ] } if (is_mac) { libs = [ "Carbon.framework" ] } if (use_x11 || ozone_platform_x11) { sources += [ "test/events_test_utils_x11.cc", "test/events_test_utils_x11.h", ] deps += [ "//ui/events/devices/x11", "//ui/events/keycodes:x11", "//ui/gfx/x", ] } if (use_x11 || ozone_platform_x11) { deps += [ "//ui/events/x" ] } } if (!is_ios) { test("events_unittests") { sources = [ "android/scroller_unittest.cc", "blink/blink_event_util_unittest.cc", "blink/fling_booster_unittest.cc", "blink/input_handler_proxy_unittest.cc", "blink/input_scroll_elasticity_controller_unittest.cc", "blink/web_input_event_traits_unittest.cc", "blink/web_input_event_unittest.cc", "cocoa/events_mac_unittest.mm", "devices/mojo/device_struct_traits_unittest.cc", "devices/mojo/touch_device_transform_struct_traits_unittest.cc", "event_dispatcher_unittest.cc", "event_processor_unittest.cc", "event_rewriter_unittest.cc", "event_target_unittest.cc", "event_unittest.cc", "fraction_of_time_without_user_input_recorder_unittest.cc", "gesture_detection/bitset_32_unittest.cc", "gesture_detection/filtered_gesture_provider_unittest.cc", "gesture_detection/gesture_event_data_packet_unittest.cc", "gesture_detection/gesture_provider_unittest.cc", "gesture_detection/motion_event_buffer_unittest.cc", "gesture_detection/motion_event_generic_unittest.cc", "gesture_detection/snap_scroll_controller_unittest.cc", "gesture_detection/touch_disposition_gesture_filter_unittest.cc", "gesture_detection/velocity_tracker_unittest.cc", "gestures/blink/web_gesture_curve_impl_unittest.cc", "gestures/fling_curve_unittest.cc", "keycodes/dom/keycode_converter_unittest.cc", "keycodes/keyboard_code_conversion_unittest.cc", "keycodes/platform_key_map_win_unittest.cc", "mojo/struct_traits_unittest.cc", "platform/platform_event_source_unittest.cc", "scoped_target_handler_unittest.cc", "win/event_utils_win_unittest.cc", ] deps = [ ":dom_keycode_converter", ":events", ":events_base", ":gesture_detection", ":test_support", "//base", "//base/test:test_support", "//cc", "//ipc:test_support", "//mojo/edk/test:run_all_unittests", "//mojo/public/cpp/bindings", "//skia", "//testing/gmock", "//testing/gtest", "//third_party/blink/public:blink_headers", "//ui/base:test_support", "//ui/display", "//ui/events/blink", "//ui/events/devices", "//ui/events/devices/mojo:test_interfaces", "//ui/events/gestures/blink", "//ui/events/mojo:test_interfaces", "//ui/events/platform", "//ui/gfx/ipc/geometry", ] if (is_android) { sources += [ "android/motion_event_android_unittest.cc" ] } else { data_deps = [ "//third_party/mesa:osmesa", ] } if (use_x11) { sources += [ "devices/x11/device_data_manager_x11_unittest.cc", "x/events_x_unittest.cc", ] configs += [ "//build/config/linux:x11" ] deps += [ "//ui/events/devices/x11", "//ui/events/x", "//ui/gfx/x", ] } if (use_x11 || use_ozone) { sources += [ "devices/device_data_manager_unittest.cc" ] } if (use_ozone) { sources += [ "ozone/chromeos/cursor_controller_unittest.cc", "ozone/evdev/event_converter_evdev_impl_unittest.cc", "ozone/evdev/event_converter_test_util.cc", "ozone/evdev/event_converter_test_util.h", "ozone/evdev/event_device_info_unittest.cc", "ozone/evdev/event_device_test_util.cc", "ozone/evdev/event_device_test_util.h", "ozone/evdev/gamepad_event_converter_evdev_unittest.cc", "ozone/evdev/input_injector_evdev_unittest.cc", "ozone/evdev/tablet_event_converter_evdev_unittest.cc", "ozone/evdev/touch_event_converter_evdev_unittest.cc", "ozone/evdev/touch_filter/false_touch_finder_unittest.cc", "ozone/gamepad/generic_gamepad_mapping_unittest.cc", ] if (use_xkbcommon) { sources += [ "ozone/layout/keyboard_layout_engine_unittest.cc", "ozone/layout/xkb/xkb_keyboard_layout_engine_unittest.cc", ] } deps += [ "//ui/events/ozone:events_ozone", "//ui/events/ozone:events_ozone_evdev", "//ui/events/ozone:events_ozone_layout", ] } if (use_aura) { sources += [ "gestures/gesture_provider_aura_unittest.cc", "gestures/motion_event_aura_unittest.cc", ] } if (is_win) { sources += [ "blink/web_input_event_builders_win_unittest.cc" ] } if (is_chromecast && !is_android) { sources += [ "chromecast/scroller_unittest.cc" ] } } } if (is_android) { generate_jar_jni("motionevent_jni_headers") { jni_package = "ui" classes = [ "android/view/MotionEvent.class" ] } generate_jar_jni("keyevent_jni_headers") { jni_package = "ui" classes = [ "android/view/KeyEvent.class" ] } }