# 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("//build/config/ui.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
static_library("webui_examples_lib") {
testonly = true
sources = [
"app/mac_init.h",
"app/mac_init.mm",
"app/main_delegate.cc",
"app/main_delegate.h",
"browser/browser_context.cc",
"browser/browser_context.h",
"browser/browser_main_parts.cc",
"browser/browser_main_parts.h",
"browser/content_browser_client.cc",
"browser/content_browser_client.h",
"browser/devtools/devtools_frontend.cc",
"browser/devtools/devtools_frontend.h",
"browser/devtools/devtools_manager_delegate.cc",
"browser/devtools/devtools_manager_delegate.h",
"browser/devtools/devtools_server.cc",
"browser/devtools/devtools_server.h",
"browser/ui/web/browser.cc",
"browser/ui/web/browser.h",
"browser/ui/web/browser_page_handler.cc",
"browser/ui/web/browser_page_handler.h",
"browser/ui/web/guest_view_manager_delegate.cc",
"browser/ui/web/guest_view_manager_delegate.h",
"browser/ui/web/web_view.cc",
"browser/ui/web/web_view.h",
"browser/ui/web/webshell_guest_view.cc",
"browser/ui/web/webshell_guest_view.h",
"browser/ui/web/webui.cc",
"browser/ui/web/webui.h",
"browser/webui_controller_factory.cc",
"browser/webui_controller_factory.h",
"common/content_client.cc",
"common/content_client.h",
"renderer/content_renderer_client.cc",
"renderer/content_renderer_client.h",
"renderer/render_frame_observer.cc",
"renderer/render_frame_observer.h",
]
deps = [
":browser_mojo_bindings",
":pak",
":resources_grit",
"resources/browser:resources",
"//base",
"//chrome/browser/resources/webui_gallery:resources",
"//components/guest_view/browser",
"//components/guest_view/common:mojom",
"//components/guest_view/renderer",
"//content/public/app",
"//content/public/browser",
"//content/public/renderer",
"//ipc",
"//mojo/public/cpp/bindings",
"//net",
"//third_party/blink/public:blink",
"//ui/base",
"//ui/display",
"//ui/platform_window",
"//ui/webui",
"//url",
"//v8:v8_headers",
]
data_deps = [ "//tools/v8_context_snapshot" ]
if (use_aura) {
sources += [
"browser/browser_main_parts_aura.cc",
"browser/ui/aura/aura_context.cc",
"browser/ui/aura/aura_context.h",
"browser/ui/aura/content_window.cc",
"browser/ui/aura/content_window.h",
"browser/ui/aura/fill_layout.cc",
"browser/ui/aura/fill_layout.h",
]
deps += [
"//ui/aura",
"//ui/aura:test_support",
"//ui/wm",
"//ui/wm/public",
]
}
if (is_mac) {
sources += [
"browser/browser_main_parts_mac.mm",
"browser/ui/cocoa/content_ns_window.h",
"browser/ui/cocoa/content_ns_window.mm",
]
frameworks = [
"AppKit.framework",
"Cocoa.framework",
]
}
}
grit("resources") {
testonly = true
source = "resources/webui_examples_resources.grd"
outputs = [
"grit/webui_examples_resources.h",
"webui_examples_resources.pak",
]
}
repack("pak") {
testonly = true
sources = [
"$root_gen_dir/chrome/webui_gallery_resources.pak",
"$root_gen_dir/content/browser/devtools/devtools_resources.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_100_percent.pak",
"$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak",
"$root_gen_dir/ui/resources/webui_resources.pak",
"$root_gen_dir/ui/strings/app_locale_settings_en-US.pak",
"$root_gen_dir/ui/strings/ui_strings_en-US.pak",
"$root_gen_dir/ui/webui/examples/resources/browser/webui_examples_browser_resources.pak",
"$target_gen_dir/webui_examples_resources.pak",
]
deps = [
":resources",
"resources/browser:resources",
"//chrome/browser/resources/webui_gallery:resources",
"//content/browser/devtools:devtools_resources",
"//mojo/public/js:resources",
"//third_party/blink/public:devtools_inspector_resources",
"//third_party/blink/public:resources",
"//third_party/blink/public:scaled_resources_100_percent",
"//ui/resources",
"//ui/strings",
]
output = "$root_out_dir/webui_examples.pak"
}
mojom("browser_mojo_bindings") {
sources = [ "browser/ui/web/browser.mojom" ]
public_deps = [
"//mojo/public/mojom/base",
"//url/mojom:url_mojom_gurl",
]
webui_module_path = "/"
}
executable("webui_examples") {
testonly = true
sources = [ "app/main.cc" ]
deps = [
":webui_examples_lib",
"//base",
"//content/public/app",
]
if (is_win) {
configs += [ "//build/config/win:windowed" ]
deps += [
"//build/win:default_exe_manifest",
"//content:sandbox_helper_win",
"//sandbox/win:sandbox",
]
}
if (is_mac) {
deps += [ "//sandbox/mac:seatbelt" ]
}
}