chromium/ui/native_theme/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.

import("//build/config/ui.gni")
import("//testing/test.gni")

component("features") {
  output_name = "native_theme_features"

  defines = [ "NATIVE_THEME_IMPLEMENTATION" ]

  sources = [
    "native_theme_export.h",
    "native_theme_features.cc",
    "native_theme_features.h",
  ]

  deps = [
    "//base",
    "//build:chromeos_buildflags",
  ]
}

component("native_theme") {
  sources = [
    "caption_style.cc",
    "caption_style.h",
    "common_theme.cc",
    "common_theme.h",
    "native_theme.cc",
    "native_theme.h",
    "native_theme_base.cc",
    "native_theme_base.h",
    "native_theme_constants_fluent.h",
    "native_theme_fluent.cc",
    "native_theme_fluent.h",
    "native_theme_observer.cc",
    "native_theme_observer.h",
    "native_theme_utils.cc",
    "native_theme_utils.h",
  ]

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

  if (is_mac) {
    frameworks = [
      "CoreGraphics.framework",
      "AppKit.framework",
      "MediaAccessibility.framework",
    ]
    sources += [
      "caption_style_mac.mm",
      "native_theme_mac.h",
      "native_theme_mac.mm",
      "scrollbar_animator_mac.cc",
      "scrollbar_animator_mac.h",
    ]
  }

  if (is_ios) {
    sources += [
      "native_theme_ios.h",
      "native_theme_ios.mm",
    ]
  }

  if (is_win) {
    sources += [ "caption_style_win.cc" ]
  }

  if (use_aura || toolkit_views) {
    sources += [
      "native_theme_aura.cc",
      "native_theme_aura.h",
      "overlay_scrollbar_constants_aura.h",
    ]
  }

  defines = [ "NATIVE_THEME_IMPLEMENTATION" ]

  public_deps = [
    ":features",
    "//skia",
  ]

  deps = [
    "//base",
    "//build:chromeos_buildflags",
    "//cc/paint",
    "//ui/base",
    "//ui/color",

    # http://crbug.com/730719 - No !is_android to work around gn --check.
    "//ui/color:mixers",
    "//ui/display",
    "//ui/gfx",
    "//ui/gfx/animation/keyframe",
    "//ui/gfx/geometry",
    "//ui/resources",
  ]
}

if (is_win) {
  component("native_theme_browser") {
    defines = [ "NATIVE_THEME_IMPLEMENTATION" ]

    # These files cannot work in the renderer on Windows.
    sources = [
      "native_theme_win.cc",
      "native_theme_win.h",
    ]

    deps = [
      ":native_theme",
      "//base",
      "//cc/paint",
      "//ui/base",
      "//ui/color",
      "//ui/display",
      "//ui/gfx",
    ]

    libs = [ "uxtheme.lib" ]
  }
} else {
  source_set("native_theme_browser") {
  }
}

source_set("test_support") {
  testonly = true

  deps = [
    ":native_theme",
    "//base",
  ]

  sources = [
    "test_native_theme.cc",
    "test_native_theme.h",
  ]
}

test("native_theme_unittests") {
  use_xvfb = use_xvfb_in_this_config

  sources = [
    "native_theme_fluent_unittest.cc",
    "native_theme_unittest.cc",
  ]

  if (use_aura) {
    sources += [ "native_theme_aura_unittest.cc" ]
  }

  if (is_win) {
    sources += [
      "caption_style_win_unittest.cc",
      "native_theme_win_unittest.cc",
    ]
  }

  deps = [
    ":native_theme",
    ":native_theme_browser",
    ":test_support",
    "//base/test:run_all_unittests",
    "//base/test:test_support",
    "//skia",
    "//testing/gtest",
    "//ui/base",
    "//ui/color",
    "//ui/gfx:test_support",
    "//ui/gfx/geometry:geometry",
  ]

  if (is_mac) {
    sources += [
      "native_theme_mac_unittest.mm",
      "scrollbar_animator_mac_unittest.cc",
    ]
    deps += [ "//ui/gfx:test_support" ]
  }
}