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

import("//mojo/public/tools/bindings/mojom.gni")
import("//ui/webui/webui_features.gni")

assert(enable_webui_ntp)

mojom("shared") {
  sources = [ "ntp_microsoft_auth_shared_ui.mojom" ]
  webui_module_path = "/"

  public_deps = [ "//mojo/public/mojom/base" ]
}

mojom("untrusted") {
  sources = [ "ntp_microsoft_auth_untrusted_ui.mojom" ]
  webui_module_path = "/"

  public_deps = [
    "//chrome/browser/ui/webui/ntp_microsoft_auth:shared",
    "//mojo/public/mojom/base",
  ]
}

source_set("ntp_microsoft_auth") {
  sources = [
    "ntp_microsoft_auth_page_handler.cc",
    "ntp_microsoft_auth_response_capture_navigation_throttle.cc",
    "ntp_microsoft_auth_untrusted_ui.cc",
  ]
  public = [
    "ntp_microsoft_auth_page_handler.h",
    "ntp_microsoft_auth_response_capture_navigation_throttle.h",
    "ntp_microsoft_auth_untrusted_ui.h",
  ]
  public_deps = [ "//chrome/browser:browser_public_dependencies" ]
  deps = [
    ":shared",
    ":untrusted",
    "//base",
    "//chrome/browser/new_tab_page",
    "//chrome/browser/profiles:profile",
    "//chrome/browser/resources/new_tab_page/untrusted:resources",
    "//chrome/browser/search",
    "//chrome/browser/ui/webui/new_tab_page",
    "//chrome/common",
    "//components/search",
    "//components/url_matcher",
    "//content/public/browser",
    "//mojo/public/cpp/bindings",
    "//ui/webui",
    "//url",
  ]
}

if (!is_android) {
  source_set("unit_tests") {
    testonly = true
    sources = [
      "ntp_microsoft_auth_page_handler_unittest.cc",
      "ntp_microsoft_auth_response_capture_navigation_throttle_unittest.cc",
    ]
    deps = [
      ":ntp_microsoft_auth",
      "//base",
      "//base/test:test_support",
      "//chrome/browser",
      "//chrome/browser/new_tab_page",
      "//chrome/browser/search_engines",
      "//chrome/browser/ui/search:test_support_ui",
      "//chrome/test:test_support",
      "//content/test:test_support",
      "//testing/gtest",
    ]
  }
}
