| # 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/features.gni") |
| |
| component("storage_monitor") { |
| sources = [ |
| "media_storage_util.cc", |
| "media_storage_util.h", |
| "removable_device_constants.cc", |
| "removable_device_constants.h", |
| "removable_storage_observer.h", |
| "storage_info.cc", |
| "storage_info.h", |
| "storage_monitor.cc", |
| "storage_monitor.h", |
| "transient_device_ids.cc", |
| "transient_device_ids.h", |
| ] |
| |
| defines = [ "IS_STORAGE_MONITOR_IMPL" ] |
| |
| deps = [ |
| "//base", |
| "//content/public/browser", |
| "//mojo/public/cpp/bindings", |
| "//services/service_manager/public/cpp", |
| "//ui/base", |
| ] |
| |
| if (is_win) { |
| sources += [ |
| "portable_device_watcher_win.cc", |
| "portable_device_watcher_win.h", |
| "storage_monitor_win.cc", |
| "storage_monitor_win.h", |
| "volume_mount_watcher_win.cc", |
| "volume_mount_watcher_win.h", |
| ] |
| } else if (is_mac) { |
| sources += [ |
| "image_capture_device.h", |
| "image_capture_device.mm", |
| "image_capture_device_manager.h", |
| "image_capture_device_manager.mm", |
| "storage_monitor_mac.h", |
| "storage_monitor_mac.mm", |
| ] |
| frameworks = [ |
| "DiskArbitration.framework", |
| "Foundation.framework", |
| "ImageCaptureCore.framework", |
| "UniformTypeIdentifiers.framework", |
| ] |
| } else if (is_chromeos) { |
| sources += [ |
| "storage_monitor_chromeos.cc", |
| "storage_monitor_chromeos.h", |
| ] |
| deps += [ |
| "//chromeos/ash/components/dbus/cros_disks", |
| "//chromeos/ash/components/disks", |
| ] |
| |
| if (use_dbus) { |
| sources += [ |
| "mtp_manager_client_chromeos.cc", |
| "mtp_manager_client_chromeos.h", |
| "storage_info_utils.cc", |
| "storage_info_utils.h", |
| ] |
| deps += [ "//services/device/public/mojom" ] |
| } |
| } else if (is_linux) { |
| if (use_udev) { |
| sources += [ |
| "mtab_watcher_linux.cc", |
| "mtab_watcher_linux.h", |
| "storage_monitor_linux.cc", |
| "storage_monitor_linux.h", |
| ] |
| } else { |
| sources += [ "storage_monitor_dummy.cc" ] |
| } |
| } |
| |
| if (use_udev) { |
| if (is_linux || is_chromeos) { |
| sources += [ |
| "udev_util_linux.cc", |
| "udev_util_linux.h", |
| ] |
| } |
| deps += [ "//device/udev_linux" ] |
| } |
| |
| if (is_fuchsia) { |
| sources += [ "storage_monitor_fuchsia.cc" ] |
| } |
| } |
| |
| static_library("test_support") { |
| testonly = true |
| sources = [ |
| "mock_removable_storage_observer.cc", |
| "mock_removable_storage_observer.h", |
| "test_storage_monitor.cc", |
| "test_storage_monitor.h", |
| ] |
| |
| public_deps = [ |
| ":storage_monitor", |
| "//base", |
| "//content/public/browser", |
| ] |
| |
| deps = [] |
| |
| if (is_chromeos) { |
| sources += [ |
| "test_media_transfer_protocol_manager_chromeos.cc", |
| "test_media_transfer_protocol_manager_chromeos.h", |
| ] |
| if (use_dbus) { |
| deps += [ "//services/device/public/mojom" ] |
| } |
| } |
| |
| if (is_win) { |
| sources += [ |
| "test_portable_device_watcher_win.cc", |
| "test_portable_device_watcher_win.h", |
| "test_storage_monitor_win.cc", |
| "test_storage_monitor_win.h", |
| "test_volume_mount_watcher_win.cc", |
| "test_volume_mount_watcher_win.h", |
| ] |
| deps += [ "//testing/gtest" ] |
| } |
| } |
| |
| source_set("unit_tests") { |
| testonly = true |
| sources = [ |
| "media_storage_util_unittest.cc", |
| "storage_info_unittest.cc", |
| "storage_monitor_unittest.cc", |
| ] |
| |
| deps = [ |
| ":test_support", |
| "//base/test:test_support", |
| "//content/test:test_support", |
| "//testing/gtest", |
| ] |
| |
| if (is_win) { |
| sources += [ "storage_monitor_win_unittest.cc" ] |
| } |
| |
| if (is_mac) { |
| sources += [ |
| "image_capture_device_manager_unittest.mm", |
| "storage_monitor_mac_unittest.mm", |
| ] |
| frameworks = [ |
| "ImageCaptureCore.framework", |
| "UniformTypeIdentifiers.framework", |
| ] |
| } |
| |
| if (is_chromeos) { |
| deps += [ "//chromeos/ash/components/disks:test_support" ] |
| if (use_dbus) { |
| deps += [ |
| "//services/device/public/mojom", |
| "//testing/gmock", |
| ] |
| sources += [ |
| "mtp_manager_client_chromeos_unittest.cc", |
| "storage_monitor_chromeos_unittest.cc", |
| ] |
| } |
| } else if (is_linux) { |
| if (use_udev) { |
| sources += [ "storage_monitor_linux_unittest.cc" ] |
| } |
| } |
| } |