# Copyright 2016 The Chromium Authors. All rights reserved. # 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") if (is_android) { import("//build/config/android/config.gni") import("//build/config/android/rules.gni") # For generate_jni(). } component("geolocation") { defines = [ "DEVICE_GEOLOCATION_IMPLEMENTATION" ] sources = [ "empty_wifi_data_provider.cc", "empty_wifi_data_provider.h", "geolocation_config.cc", "geolocation_config.h", "geolocation_context.cc", "geolocation_context.h", "geolocation_export.h", "geolocation_impl.cc", "geolocation_impl.h", "geolocation_provider.h", "geolocation_provider_impl.cc", "geolocation_provider_impl.h", "location_api_adapter_android.cc", "location_api_adapter_android.h", "location_arbitrator.cc", "location_arbitrator.h", "location_provider_android.cc", "location_provider_android.h", "network_location_provider.cc", "network_location_provider.h", "network_location_request.cc", "network_location_request.h", "wifi_data.cc", "wifi_data.h", "wifi_data_provider.cc", "wifi_data_provider.h", "wifi_data_provider_chromeos.cc", "wifi_data_provider_chromeos.h", "wifi_data_provider_common.cc", "wifi_data_provider_common.h", "wifi_data_provider_common_win.cc", "wifi_data_provider_common_win.h", "wifi_data_provider_linux.cc", "wifi_data_provider_linux.h", "wifi_data_provider_mac.h", "wifi_data_provider_mac.mm", "wifi_data_provider_manager.cc", "wifi_data_provider_manager.h", "wifi_data_provider_win.cc", "wifi_data_provider_win.h", "wifi_polling_policy.h", ] deps = [ "//base", "//mojo/edk/system", "//mojo/public/cpp/bindings", "//net", "//ui/gfx", ] public_deps = [ "//device/geolocation/public/cpp", "//device/geolocation/public/interfaces", ] if (is_android) { sources -= [ "network_location_provider.cc", "network_location_provider.h", ] deps += [ ":geolocation_jni_headers" ] } # TODO(mcasas): prefer adding files than removing them (see cookbook.md). # Dealing with *wifi_data_provider_*.cc is also a bit complicated given # android, chromeos, linux and use_dbus. if (is_android) { sources -= [ "wifi_data_provider_common.cc" ] } if (is_chromeos || (is_linux && !use_dbus)) { sources -= [ "wifi_data_provider_linux.cc" ] } if (is_linux && use_dbus) { sources -= [ "empty_wifi_data_provider.cc" ] deps += [ "//dbus" ] } if (is_win || is_mac) { sources -= [ "empty_wifi_data_provider.cc", "empty_wifi_data_provider.h", ] } if (is_chromeos) { deps += [ "//chromeos" ] } if (is_mac) { libs = [ "CoreWLAN.framework", "Foundation.framework", ] } } if (is_android) { generate_jni("geolocation_jni_headers") { sources = [ "android/java/src/org/chromium/device/geolocation/LocationProviderAdapter.java", ] jni_package = "device" } android_library("geolocation_java") { java_files = [ "android/java/src/org/chromium/device/geolocation/LocationProviderAdapter.java", "android/java/src/org/chromium/device/geolocation/LocationProviderAndroid.java", "android/java/src/org/chromium/device/geolocation/LocationProviderFactory.java", "android/java/src/org/chromium/device/geolocation/LocationProviderGmsCore.java", ] deps = [ ":geolocation", ":geolocation_jni_headers", "$google_play_services_package:google_play_services_base_java", "$google_play_services_package:google_play_services_basement_java", "$google_play_services_package:google_play_services_location_java", "//base:base_java", ] } android_library("geolocation_java_test_support") { testonly = true java_files = [ "android/javatests/src/org/chromium/device/geolocation/MockLocationProvider.java" ] deps = [ ":geolocation_java", "//base:base_java", ] } } source_set("test_support") { testonly = true sources = [ "fake_location_provider.cc", "fake_location_provider.h", ] public_deps = [ ":geolocation", ] deps = [ "//device/geolocation/public/cpp", "//testing/gmock", "//testing/gtest", ] } source_set("unittests") { testonly = true sources = [ "geolocation_provider_impl_unittest.cc", "location_arbitrator_unittest.cc", "network_location_provider_unittest.cc", "wifi_data_provider_chromeos_unittest.cc", "wifi_data_provider_common_unittest.cc", "wifi_data_provider_linux_unittest.cc", "wifi_data_provider_win_unittest.cc", ] public_deps = [ ":geolocation", ] deps = [ ":test_support", "//base", "//base/third_party/dynamic_annotations", "//device/geolocation/public/cpp", "//device/geolocation/public/interfaces", "//net:test_support", "//testing/gmock", "//testing/gtest", ] if (is_linux) { if (use_dbus) { deps += [ "//dbus:test_support" ] } else { sources -= [ "wifi_data_provider_linux_unittest.cc" ] } } if (is_chromeos) { sources -= [ "wifi_data_provider_linux_unittest.cc" ] deps += [ "//chromeos" ] } if (is_android) { sources -= [ "network_location_provider_unittest.cc", "wifi_data_provider_common_unittest.cc", ] deps += [ ":geolocation_java_test_support" ] } }