BUILD.gn 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # Copyright 2014 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//build/config/chromeos/ui_mode.gni")
  5. import("//build/config/features.gni")
  6. static_library("storage_monitor") {
  7. sources = [
  8. "media_storage_util.cc",
  9. "media_storage_util.h",
  10. "removable_device_constants.cc",
  11. "removable_device_constants.h",
  12. "removable_storage_observer.h",
  13. "storage_info.cc",
  14. "storage_info.h",
  15. "storage_monitor.cc",
  16. "storage_monitor.h",
  17. "transient_device_ids.cc",
  18. "transient_device_ids.h",
  19. ]
  20. deps = [
  21. "//base",
  22. "//build:chromeos_buildflags",
  23. "//content/public/browser",
  24. "//mojo/public/cpp/bindings",
  25. "//services/service_manager/public/cpp",
  26. "//ui/base",
  27. ]
  28. if (is_win) {
  29. sources += [
  30. "portable_device_watcher_win.cc",
  31. "portable_device_watcher_win.h",
  32. "storage_monitor_win.cc",
  33. "storage_monitor_win.h",
  34. "volume_mount_watcher_win.cc",
  35. "volume_mount_watcher_win.h",
  36. ]
  37. } else if (is_mac) {
  38. sources += [
  39. "image_capture_device.h",
  40. "image_capture_device.mm",
  41. "image_capture_device_manager.h",
  42. "image_capture_device_manager.mm",
  43. "storage_monitor_mac.h",
  44. "storage_monitor_mac.mm",
  45. ]
  46. frameworks = [
  47. "DiskArbitration.framework",
  48. "Foundation.framework",
  49. "ImageCaptureCore.framework",
  50. ]
  51. } else if (is_chromeos_ash) {
  52. # For Chrome OS, |is_linux| is also true. Put this in an else-if block above
  53. # the |is_linux| else-if block, so they do not clash.
  54. sources += [
  55. "storage_monitor_chromeos.cc",
  56. "storage_monitor_chromeos.h",
  57. ]
  58. deps += [ "//ash/components/disks" ]
  59. if (use_dbus) {
  60. sources += [
  61. "mtp_manager_client_chromeos.cc",
  62. "mtp_manager_client_chromeos.h",
  63. "storage_info_utils.cc",
  64. "storage_info_utils.h",
  65. ]
  66. deps += [ "//services/device/public/mojom" ]
  67. }
  68. } else if (is_linux || is_chromeos_lacros) {
  69. if (use_udev) {
  70. sources += [
  71. "mtab_watcher_linux.cc",
  72. "mtab_watcher_linux.h",
  73. "storage_monitor_linux.cc",
  74. "storage_monitor_linux.h",
  75. ]
  76. } else {
  77. sources += [ "storage_monitor_dummy.cc" ]
  78. }
  79. }
  80. if (use_udev) {
  81. if (is_linux || is_chromeos) {
  82. sources += [
  83. "udev_util_linux.cc",
  84. "udev_util_linux.h",
  85. ]
  86. }
  87. deps += [ "//device/udev_linux" ]
  88. }
  89. if (is_fuchsia) {
  90. sources += [ "storage_monitor_fuchsia.cc" ]
  91. }
  92. }
  93. static_library("test_support") {
  94. testonly = true
  95. sources = [
  96. "mock_removable_storage_observer.cc",
  97. "mock_removable_storage_observer.h",
  98. "test_storage_monitor.cc",
  99. "test_storage_monitor.h",
  100. ]
  101. public_deps = [
  102. ":storage_monitor",
  103. "//base",
  104. "//content/public/browser",
  105. ]
  106. deps = [ "//build:chromeos_buildflags" ]
  107. if (is_chromeos_ash) {
  108. sources += [
  109. "test_media_transfer_protocol_manager_chromeos.cc",
  110. "test_media_transfer_protocol_manager_chromeos.h",
  111. ]
  112. if (use_dbus) {
  113. deps += [ "//services/device/public/mojom" ]
  114. }
  115. }
  116. if (is_win) {
  117. sources += [
  118. "test_portable_device_watcher_win.cc",
  119. "test_portable_device_watcher_win.h",
  120. "test_storage_monitor_win.cc",
  121. "test_storage_monitor_win.h",
  122. "test_volume_mount_watcher_win.cc",
  123. "test_volume_mount_watcher_win.h",
  124. ]
  125. deps += [ "//testing/gtest" ]
  126. }
  127. }
  128. source_set("unit_tests") {
  129. testonly = true
  130. sources = [
  131. "media_storage_util_unittest.cc",
  132. "storage_info_unittest.cc",
  133. "storage_monitor_unittest.cc",
  134. ]
  135. deps = [
  136. ":test_support",
  137. "//base/test:test_support",
  138. "//content/test:test_support",
  139. "//testing/gtest",
  140. ]
  141. if (is_win) {
  142. sources += [ "storage_monitor_win_unittest.cc" ]
  143. }
  144. if (is_mac) {
  145. sources += [
  146. "image_capture_device_manager_unittest.mm",
  147. "storage_monitor_mac_unittest.mm",
  148. ]
  149. }
  150. if (is_chromeos_ash) {
  151. if (use_dbus) {
  152. deps += [
  153. "//services/device/public/mojom",
  154. "//testing/gmock",
  155. ]
  156. sources += [
  157. "mtp_manager_client_chromeos_unittest.cc",
  158. "storage_monitor_chromeos_unittest.cc",
  159. ]
  160. }
  161. } else if (is_linux || is_chromeos_lacros) {
  162. if (use_udev) {
  163. sources += [ "storage_monitor_linux_unittest.cc" ]
  164. }
  165. }
  166. if (is_chromeos_ash) {
  167. deps += [ "//ash/components/disks:test_support" ]
  168. }
  169. }