Index: device/geolocation/BUILD.gn |
diff --git a/device/geolocation/BUILD.gn b/device/geolocation/BUILD.gn |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0b3d92e1c2170656f4f9ec6648529ddada23c16a |
--- /dev/null |
+++ b/device/geolocation/BUILD.gn |
@@ -0,0 +1,200 @@ |
+# 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.h", |
+ "location_arbitrator_impl.cc", |
+ "location_arbitrator_impl.h", |
+ "location_provider.h", |
+ "location_provider_android.cc", |
+ "location_provider_android.h", |
+ "location_provider_base.cc", |
+ "location_provider_base.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", |
+ |
+ # TODO(mcasas): move geolocation.mojom to public/interfaces. |
+ "//third_party/WebKit/public:mojo_bindings", |
+ "//ui/gfx", |
+ ] |
+ |
+ 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("unittests") { |
+ testonly = true |
+ |
+ sources = [ |
+ "fake_access_token_store.cc", |
+ "fake_access_token_store.h", |
+ "geolocation_provider_impl_unittest.cc", |
+ "location_arbitrator_impl_unittest.cc", |
+ "mock_location_arbitrator.cc", |
+ "mock_location_arbitrator.h", |
+ "mock_location_provider.cc", |
+ "mock_location_provider.h", |
+ "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 = [ |
+ "//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" ] |
+ } |
+} |