chromium/chromecast/graphics/BUILD.gn

# Copyright 2015 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/ui.gni")
import("//chromecast/chromecast.gni")
import("//testing/test.gni")

cast_source_set("graphics") {
  sources = [
    "cast_touch_activity_observer.h",
    "gestures/cast_gesture_handler.cc",
    "gestures/cast_gesture_handler.h",
  ]

  deps = [
    "//base",
    "//ui/gfx",
  ]

  public_deps = [ "//chromecast/ui/mojom" ]

  if (use_aura && !is_fuchsia) {
    sources += [
      "cast_display_util.cc",
      "cast_display_util.h",
      "cast_focus_client_aura.cc",
      "cast_focus_client_aura.h",
      "cast_touch_event_gate.cc",
      "cast_touch_event_gate.h",
      "cast_window_manager.h",
      "cast_window_manager_aura.cc",
      "cast_window_manager_aura.h",
      "cast_window_tree_host_aura.cc",
      "cast_window_tree_host_aura.h",
      "gestures/cast_system_gesture_dispatcher.cc",
      "gestures/cast_system_gesture_dispatcher.h",
      "gestures/cast_system_gesture_event_handler.cc",
      "gestures/cast_system_gesture_event_handler.h",
      "gestures/multiple_tap_detector.cc",
      "gestures/multiple_tap_detector.h",
      "gestures/side_swipe_detector.cc",
      "gestures/side_swipe_detector.h",
    ]

    deps += [
      "//chromecast:chromecast_buildflags",
      "//components/viz/common",
      "//ui/base/ime/init",
      "//ui/events:gesture_detection",
      "//ui/touch_selection",
      "//ui/views",
      "//ui/wm",
      "//ui/wm/public",
    ]
  } else {
    public_deps += [ ":default_window_manager" ]
  }

  if (use_aura) {
    sources += [
      "cast_screen.cc",
      "cast_screen.h",
    ]

    deps += [
      "//chromecast/base",
      "//chromecast/public",
      "//skia",
      "//ui/aura",
      "//ui/compositor",
      "//ui/display",
      "//ui/gfx/geometry",
      "//ui/platform_window",
    ]

    if (enable_starboard_graphics) {
      deps += [ "//chromecast/starboard/graphics" ]
    } else {
      deps += [ ":libcast_graphics_1.0" ]
    }
  }

  if (use_ozone) {
    deps += [ "//ui/ozone" ]
  }
}

cast_source_set("default_window_manager") {
  sources = [
    "cast_window_manager.h",
    "cast_window_manager_default.cc",
    "cast_window_manager_default.h",
  ]

  deps = [
    "//base",
    "//ui/gfx",
  ]

  public_deps = [ "//chromecast/ui/mojom" ]
}

cast_shared_library("libcast_graphics_1.0") {
  sources = [
    "cast_egl_platform_default.cc",
    "graphics_properties_default.cc",
    "osd_plane_default.cc",
  ]

  public_deps = [ "//chromecast/public" ]

  deps = [
    "//base",
    "//chromecast/base:chromecast_switches",
    "//chromecast/base:init_shlib",
  ]
}

if (use_aura && !is_cast_audio_only && !is_fuchsia) {
  test("cast_graphics_unittests") {
    sources = [
      "cast_display_util_unittest.cc",
      "cast_focus_client_aura_test.cc",
      "cast_screen_unittest.cc",
      "cast_touch_event_gate_test.cc",
      "cast_views_test.cc",
      "cast_window_manager_aura_test.cc",
      "gestures/cast_system_gesture_dispatcher_test.cc",
      "gestures/multiple_tap_detector_test.cc",
      "gestures/side_swipe_detector_test.cc",
      "run_all_unittests.cc",
    ]
    deps = [
      ":graphics",
      "//base/test:test_support",
      "//mojo/core/embedder",
      "//testing/gmock",
      "//testing/gtest",
      "//ui/aura",
      "//ui/aura:test_support",
      "//ui/base:test_support",
      "//ui/events:test_support",
      "//ui/gfx",
      "//ui/gl:test_support",
      "//ui/platform_window",
      "//ui/views",
      "//ui/views:test_support",
      "//ui/wm",
    ]
  }
}