chromium/ios/chrome/browser/permissions/model/BUILD.gn

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

import("//ios/web/public/js_messaging/optimize_ts.gni")

source_set("infobar_delegate") {
  sources = [
    "permissions_infobar_delegate.h",
    "permissions_infobar_delegate.mm",
  ]
  deps = [ "//components/infobars/core" ]
}

source_set("tab_helper") {
  sources = [
    "permissions_tab_helper.h",
    "permissions_tab_helper.mm",
  ]
  deps = [
    ":infobar_delegate",
    "//components/infobars/core",
    "//ios/chrome/browser/infobars/model",
    "//ios/chrome/browser/infobars/model/overlays",
    "//ios/chrome/browser/infobars/model/overlays:util",
    "//ios/chrome/browser/overlays/model",
    "//ios/chrome/browser/overlays/model/public/common/infobars",
    "//ios/chrome/browser/overlays/model/public/infobar_banner",
    "//ios/chrome/browser/overlays/model/public/web_content_area",
    "//ios/web/public",
  ]
}

source_set("features") {
  sources = [
    "features.h",
    "features.mm",
  ]
  public_deps = [ "//base" ]
}

source_set("geolocation") {
  deps = [
    ":geolocation_js",
    "//base",
    "//ios/chrome/browser/geolocation/model",
    "//ios/web/public/js_messaging",
  ]

  sources = [
    "geolocation_api_usage_java_script_feature.h",
    "geolocation_api_usage_java_script_feature.mm",
  ]
}

optimize_ts("geolocation_js") {
  visibility = [
    ":geolocation",
    ":js_tests",
  ]

  sources = [ "resources/geolocation_overrides.ts" ]

  deps = [ "//ios/web/public/js_messaging:util_scripts" ]
}

source_set("media") {
  deps = [
    ":media_js",
    "//base",
    "//ios/web/public/js_messaging",
  ]

  sources = [
    "media_api_usage_java_script_feature.h",
    "media_api_usage_java_script_feature.mm",
  ]
}

optimize_ts("media_js") {
  visibility = [
    ":js_tests",
    ":media",
  ]

  sources = [ "resources/media_overrides.ts" ]

  deps = [ "//ios/web/public/js_messaging:util_scripts" ]
}

source_set("unit_tests") {
  testonly = true
  sources = [ "permissions_tab_helper_unittest.mm" ]
  deps = [
    ":infobar_delegate",
    ":js_tests",
    ":tab_helper",
    "//base",
    "//base/test:test_support",
    "//ios/chrome/browser/infobars/model",
    "//ios/chrome/browser/infobars/model/overlays",
    "//ios/chrome/browser/overlays/model",
    "//ios/chrome/browser/permissions/model:infobar_delegate",
    "//ios/chrome/test:test_support",
    "//ios/web/public/permissions",
    "//ios/web/public/test",
    "//ios/web/public/test/fakes",
    "//testing/gtest",
  ]
}

source_set("js_tests") {
  testonly = true
  sources = [
    "geolocation_overrides_javascript_test.mm",
    "media_overrides_javascript_test.mm",
  ]
  deps = [
    ":geolocation_js",
    ":media_js",
    "//base",
    "//ios/web/public/test",
    "//ios/web/public/test:javascript_test",
    "//net:test_support",
    "//testing/gtest",
  ]
}