| # 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/chromeos/ui_mode.gni") |
| import("//build/config/features.gni") |
| import("//build/config/ui.gni") |
| import("//testing/test.gni") |
| |
| if (is_android) { |
| import("//build/config/android/config.gni") |
| } |
| if (is_mac) { |
| import("//build/config/mac/rules.gni") |
| } |
| |
| component("shell_dialogs") { |
| sources = [ |
| "base_shell_dialog.cc", |
| "base_shell_dialog.h", |
| "select_file_dialog.cc", |
| "select_file_dialog.h", |
| "select_file_dialog_factory.cc", |
| "select_file_dialog_factory.h", |
| "select_file_policy.cc", |
| "select_file_policy.h", |
| "selected_file_info.cc", |
| "selected_file_info.h", |
| "shell_dialogs_export.h", |
| ] |
| |
| defines = [ "SHELL_DIALOGS_IMPLEMENTATION" ] |
| |
| deps = [ |
| "//base", |
| "//base:i18n", |
| "//build:chromeos_buildflags", |
| "//skia", |
| "//ui/base", |
| "//ui/strings", |
| "//url", |
| ] |
| |
| if (is_chromeos || is_castos || is_cast_android) { |
| sources += [ "shell_dialog_stub.cc" ] |
| } |
| |
| if (is_linux && !is_castos) { |
| sources += [ |
| "select_file_dialog_linux.cc", |
| "select_file_dialog_linux.h", |
| "select_file_dialog_linux_kde.cc", |
| "select_file_dialog_linux_kde.h", |
| "shell_dialog_linux.cc", |
| "shell_dialog_linux.h", |
| ] |
| deps += [ |
| "//components/dbus/thread_linux", |
| "//ui/linux:linux_ui", |
| ] |
| if (use_dbus) { |
| defines += [ "USE_DBUS" ] |
| sources += [ |
| "select_file_dialog_linux_portal.cc", |
| "select_file_dialog_linux_portal.h", |
| ] |
| deps += [ "//dbus" ] |
| } |
| } |
| |
| if (is_mac) { |
| sources += [ |
| "select_file_dialog_mac.h", |
| "select_file_dialog_mac.mm", |
| ] |
| } |
| |
| if (is_ios) { |
| sources += [ |
| "select_file_dialog_ios.h", |
| "select_file_dialog_ios.mm", |
| ] |
| } |
| |
| if (is_win) { |
| sources += [ |
| "base_shell_dialog_win.cc", |
| "base_shell_dialog_win.h", |
| "execute_select_file_win.cc", |
| "execute_select_file_win.h", |
| "select_file_dialog_win.cc", |
| "select_file_dialog_win.h", |
| "select_file_utils_win.h", |
| ] |
| } |
| |
| if (use_aura) { |
| if (is_mac) { |
| # Will be automatically filtered out on non-Mac. |
| sources -= [ "select_file_dialog_mac.mm" ] |
| } |
| deps += [ "//ui/aura" ] |
| } |
| |
| if (is_android) { |
| sources += [ |
| "select_file_dialog_android.cc", |
| "select_file_dialog_android.h", |
| ] |
| deps += [ |
| "//ui/android", |
| "//ui/base:ui_base_jni_headers", |
| ] |
| include_dirs = [ "$root_gen_dir/ui" ] |
| libs = [ "jnigraphics" ] |
| } |
| |
| if (is_apple) { |
| configs += [ "//build/config/compiler:enable_arc" ] |
| } |
| |
| if (is_mac) { |
| frameworks = [ |
| "CoreServices.framework", |
| "Foundation.framework", |
| "AppKit.framework", |
| ] |
| deps += [ |
| "//components/remote_cocoa/app_shim", |
| "//components/remote_cocoa/browser", |
| "//components/remote_cocoa/common:mojo", |
| ] |
| } |
| |
| if (is_fuchsia) { |
| sources += [ "select_file_dialog_fuchsia.cc" ] |
| } |
| |
| # TODO(crbug.com/1052397): Rename is_chromeos_lacros. |
| if (is_chromeos_lacros) { |
| sources += [ |
| "select_file_dialog_lacros.cc", |
| "select_file_dialog_lacros.h", |
| ] |
| deps += [ |
| "//chromeos/crosapi/mojom", |
| "//chromeos/lacros", |
| "//mojo/public/cpp/bindings", |
| "//ui/platform_window", |
| ] |
| } |
| } |
| |
| test("shell_dialogs_unittests") { |
| testonly = true |
| sources = [ |
| "run_all_unittests.cc", |
| "select_file_dialog_unittest.cc", |
| ] |
| |
| if (is_apple) { |
| configs += [ "//build/config/compiler:enable_arc" ] |
| } |
| |
| if (is_mac) { |
| sources += [ "select_file_dialog_mac_unittest.mm" ] |
| weak_frameworks = [ |
| "UniformTypeIdentifiers.framework", # macOS 11 |
| ] |
| } |
| |
| if (is_win) { |
| sources += [ |
| "select_file_dialog_win_unittest.cc", |
| "select_file_utils_win_unittest.cc", |
| ] |
| } |
| |
| deps = [ |
| ":shell_dialogs", |
| "//base", |
| "//base/test:test_support", |
| "//mojo/core/embedder", |
| "//testing/gtest", |
| "//ui/base", |
| "//ui/resources:ui_test_pak_data", |
| "//ui/strings", |
| ] |
| |
| if (is_mac) { |
| deps += [ "//components/remote_cocoa/app_shim" ] |
| } |
| |
| # TODO: Remove once http://crbug.com/951419 is fixed. |
| if (is_android) { |
| deps += [ "//ui/android:ui_java" ] |
| } |
| |
| if (is_ios) { |
| bundle_deps = [ "//ui/resources:ui_test_pak_bundle_data" ] |
| } |
| } |
| |
| source_set("test_support") { |
| testonly = true |
| sources = [ |
| "fake_select_file_dialog.cc", |
| "fake_select_file_dialog.h", |
| ] |
| public_deps = [ ":shell_dialogs" ] |
| deps = [ |
| "//base", |
| "//url", |
| ] |
| } |