# 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.

import("//build/config/features.gni")
import("//build/config/ui.gni")

assert(use_ozone)

component("ozone") {
  output_name = "events_ozone"

  sources = [
    "device/device_event.cc",
    "device/device_event.h",
    "device/device_event_observer.h",
    "device/device_manager.cc",
    "device/device_manager.h",
    "device/device_manager_manual.cc",
    "device/device_manager_manual.h",
    "features.cc",
    "features.h",
    "gamepad/gamepad_event.cc",
    "gamepad/gamepad_event.h",
    "gamepad/gamepad_observer.h",
    "gamepad/gamepad_provider_ozone.cc",
    "gamepad/gamepad_provider_ozone.h",
    "keyboard/event_auto_repeat_handler.cc",
    "keyboard/event_auto_repeat_handler.h",
    "keyboard/slow_keys_handler.cc",
    "keyboard/slow_keys_handler.h",
  ]

  deps = [
    "//base",
    "//ui/display",
    "//ui/events",
    "//ui/events/devices",
    "//ui/gfx",
  ]

  defines = [ "IS_EVENTS_OZONE_IMPL" ]

  if (is_chromeos) {
    sources += [
      "chromeos/cursor_controller.cc",
      "chromeos/cursor_controller.h",
    ]
  }

  if (use_udev) {
    sources += [
      "device/udev/device_manager_udev.cc",
      "device/udev/device_manager_udev.h",
    ]
    deps += [ "//device/udev_linux" ]
  }
}

source_set("unittests") {
  testonly = true

  sources = []

  deps = [
    ":ozone",
    "//base",
    "//base/test:test_support",
    "//testing/gtest",
    "//ui/events",
    "//ui/events/ozone/layout:unittests",
    "//ui/gfx:native_ui_types",
    "//ui/gfx/geometry",
  ]

  if (is_chromeos) {
    sources += [
      "chromeos/cursor_controller_unittest.cc",
      "keyboard/slow_keys_handler_unittest.cc",
    ]
  }

  if (is_linux || is_chromeos) {
    deps += [ "//ui/events/ozone/evdev:unittests" ]
  }
}
