# Copyright 2015 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/buildflag_header.gni")
import("//build/config/ui.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//components/vector_icons/vector_icons.gni")

buildflag_header("buildflags") {
  header = "buildflags.h"
  flags = [ "ENABLE_VR=$enable_vr" ]
}

aggregate_vector_icons("toolbar_vector_icons") {
  icon_directory = "vector_icons"

  icons = [
    "find_in_page.icon",
    "http.icon",
    "https_invalid.icon",
    "https_valid.icon",
    "https_valid_in_chip.icon",
    "offline_pin.icon",
    "open_in_new.icon",
    "product.icon",
    "star_active.icon",
    "star.icon",
  ]
}

static_library("vector_icons") {
  sources = get_target_outputs(":toolbar_vector_icons")
  deps = [
    ":toolbar_vector_icons",
    "//components/vector_icons",
    "//skia",
    "//ui/gfx",
  ]
}

static_library("toolbar") {
  sources = [
    "toolbar_field_trial.cc",
    "toolbar_field_trial.h",
    "toolbar_model.h",
    "toolbar_model_delegate.cc",
    "toolbar_model_delegate.h",
    "toolbar_model_impl.cc",
    "toolbar_model_impl.h",
  ]

  public_deps = [
    "//base",
    "//components/security_state/core",
    "//url",
  ]

  deps = [
    ":buildflags",
    "//components/google/core/browser",
    "//components/prefs",
    "//components/resources",
    "//components/strings",
    "//components/url_formatter",
    "//net",
    "//ui/base",
    "//ui/gfx",
  ]

  if ((!is_android || enable_vr) && !is_ios) {
    deps += [ ":vector_icons" ]
  }
}

static_library("test_support") {
  testonly = true

  sources = [
    "test_toolbar_model.cc",
    "test_toolbar_model.h",
  ]

  public_deps = [
    ":toolbar",
    "//base",
  ]

  deps = [
    "//components/resources",
    "//ui/gfx",
  ]

  if (toolkit_views) {
    # Needed to get the TOOLKIT_VIEWS define.
    deps += [ "//ui/views" ]
  }
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "toolbar_model_impl_unittest.cc",
  ]

  deps = [
    ":toolbar",
    "//base",
    "//testing/gtest",
    "//url",
  ]
}