| # 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/rules.gni") # For generate_jni(). |
| } |
| |
| component("device_geolocation") { |
| defines = [ "DEVICE_GEOLOCATION_IMPLEMENTATION" ] |
| |
| sources = [ |
| "access_token_store.h", |
| "android/geolocation_jni_registrar.cc", |
| "android/geolocation_jni_registrar.h", |
| "empty_wifi_data_provider.cc", |
| "empty_wifi_data_provider.h", |
| "geolocation_delegate.cc", |
| "geolocation_delegate.h", |
| "geolocation_export.h", |
| "geolocation_provider.h", |
| "geolocation_provider_impl.cc", |
| "geolocation_provider_impl.h", |
| "geolocation_service_context.cc", |
| "geolocation_service_context.h", |
| "geolocation_service_impl.cc", |
| "geolocation_service_impl.h", |
| "geoposition.cc", |
| "geoposition.h", |
| "location_api_adapter_android.cc", |
| "location_api_adapter_android.h", |
| "location_arbitrator.cc", |
| "location_arbitrator.h", |
| "location_provider.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_corewlan_mac.mm", |
| "wifi_data_provider_linux.cc", |
| "wifi_data_provider_linux.h", |
| "wifi_data_provider_mac.cc", |
| "wifi_data_provider_mac.h", |
| "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", |
| "//google_apis:google_apis", |
| "//mojo/edk/system", |
| "//mojo/public/cpp/bindings", |
| "//net", |
| "//ui/gfx", |
| ] |
| public_deps = [ |
| "//device/geolocation/public/interfaces", |
| ] |
| if (is_android) { |
| sources -= [ |
| "network_location_provider.cc", |
| "network_location_provider.h", |
| "network_location_request.cc", |
| "network_location_request.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 = [ "Foundation.framework" ] |
| } |
| } |
| |
| if (is_android) { |
| generate_jni("geolocation_jni_headers") { |
| sources = [ |
| "android/java/org/chromium/device/geolocation/LocationProviderAdapter.java", |
| ] |
| jni_package = "device" |
| } |
| |
| android_library("geolocation_java") { |
| java_files = [ |
| "android/java/org/chromium/device/geolocation/LocationProviderAdapter.java", |
| "android/java/org/chromium/device/geolocation/LocationProviderFactory.java", |
| ] |
| |
| deps = [ |
| ":device_geolocation", |
| ":geolocation_jni_headers", |
| "//base:base_java", |
| ] |
| } |
| |
| android_library("geolocation_java_test_support") { |
| testonly = true |
| |
| java_files = [ "android/java/org/chromium/device/geolocation/MockLocationProvider.java" ] |
| deps = [ |
| ":geolocation_java", |
| "//base:base_java", |
| ] |
| } |
| } |
| |
| source_set("test_support") { |
| testonly = true |
| |
| sources = [ |
| "fake_access_token_store.cc", |
| "fake_access_token_store.h", |
| "fake_location_provider.cc", |
| "fake_location_provider.h", |
| "mock_location_provider.cc", |
| "mock_location_provider.h", |
| ] |
| public_deps = [ |
| ":device_geolocation", |
| ] |
| deps = [ |
| "//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 = [ |
| ":device_geolocation", |
| ] |
| deps = [ |
| ":test_support", |
| "//base", |
| "//base/third_party/dynamic_annotations", |
| "//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" ] |
| } |
| } |