chromium/ui/events/devices/BUILD.gn

# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

if (is_android) {
  import("//build/config/android/config.gni")
  import("//build/config/android/rules.gni")
  import("//third_party/jni_zero/jni_zero.gni")
}

component("devices") {
  sources = [
    "device_data_manager.cc",
    "device_data_manager.h",
    "device_hotplug_event_observer.h",
    "events_devices_export.h",
    "gamepad_device.cc",
    "gamepad_device.h",
    "haptic_touchpad_effects.h",
    "input_device.cc",
    "input_device.h",
    "input_device_event_observer.h",
    "keyboard_device.cc",
    "keyboard_device.h",
    "microphone_mute_switch_monitor.cc",
    "microphone_mute_switch_monitor.h",
    "stylus_state.h",
    "touch_device_transform.cc",
    "touch_device_transform.h",
    "touchpad_device.cc",
    "touchpad_device.h",
    "touchscreen_device.cc",
    "touchscreen_device.h",
  ]

  if (is_linux || is_chromeos) {
    sources += [
      "device_util_linux.cc",
      "device_util_linux.h",
    ]
  }

  if (is_android) {
    sources += [
      "input_device_observer_android.cc",
      "input_device_observer_android.h",
    ]
  }

  if (is_win) {
    sources += [
      "input_device_observer_win.cc",
      "input_device_observer_win.h",
    ]
  }

  defines = [ "EVENTS_DEVICES_IMPLEMENTATION" ]

  public_deps = [
    "//ui/display/types",
    "//ui/gfx",
  ]

  deps = [
    "//base",
    "//skia",
    "//ui/events:platform_event",
    "//ui/gfx/geometry",
    "//ui/gfx/geometry:geometry_skia",
  ]

  if (is_android) {
    deps += [ ":ui_events_devices_jni_headers" ]
  }
}

if (is_android) {
  generate_jni("ui_events_devices_jni_headers") {
    sources = [ "../../android/java/src/org/chromium/ui/events/devices/InputDeviceObserver.java" ]
  }
}

source_set("unittests") {
  testonly = true

  sources = [
    "input_device_unittest.cc",
    "touchscreen_device_unittest.cc",
  ]

  deps = [
    ":devices",
    "//base",
    "//base/test:test_support",
  ]
}

source_set("test_support") {
  sources = [
    "device_data_manager_test_api.cc",
    "device_data_manager_test_api.h",
  ]

  deps = [ "//base" ]

  public_deps = [ ":devices" ]
}