# Copyright 2015 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/android/rules.gni") import("//build/config/locales.gni") import("//testing/test.gni") assert(is_android) component("android") { output_name = "ui_android" sources = [ "animation_utils.h", "delegated_frame_host_android.cc", "delegated_frame_host_android.h", "display_android_manager.cc", "display_android_manager.h", "edge_effect.cc", "edge_effect.h", "edge_effect_base.cc", "edge_effect_base.h", "edge_effect_l.cc", "edge_effect_l.h", "event_forwarder.cc", "event_forwarder.h", "handle_view_resources.cc", "handle_view_resources.h", "overscroll_glow.cc", "overscroll_glow.h", "overscroll_refresh.cc", "overscroll_refresh.h", "overscroll_refresh_handler.cc", "overscroll_refresh_handler.h", "resources/nine_patch_resource.cc", "resources/nine_patch_resource.h", "resources/resource.cc", "resources/resource.h", "resources/resource_factory.cc", "resources/resource_manager.h", "resources/resource_manager_impl.cc", "resources/resource_manager_impl.h", "resources/ui_resource_provider.h", "screen_android.h", "ui_android_export.h", "view_android.cc", "view_android.h", "view_android_observer.h", "window_android.cc", "window_android.h", "window_android_compositor.h", "window_android_observer.h", ] defines = [ "UI_ANDROID_IMPLEMENTATION" ] deps = [ ":java_enums_srcjar", ":ui_android_jni_headers", "//base", "//cc", "//components/viz/client", "//components/viz/common", "//components/viz/host", "//components/viz/service", "//services/viz/public/interfaces", "//skia", "//third_party/blink/public:blink_headers", "//ui/base", "//ui/compositor", "//ui/display", "//ui/events", "//ui/events/devices", "//ui/gfx", "//ui/gfx/geometry", "//ui/touch_selection", "//url", ] } static_library("test_support") { testonly = true sources = [ "dummy_screen_android.cc", "dummy_screen_android.h", ] deps = [ "//ui/android", "//ui/display", ] } generate_jni("ui_android_jni_headers") { sources = [ "java/src/org/chromium/ui/OverscrollRefreshHandler.java", "java/src/org/chromium/ui/base/EventForwarder.java", "java/src/org/chromium/ui/base/ViewAndroidDelegate.java", "java/src/org/chromium/ui/base/WindowAndroid.java", "java/src/org/chromium/ui/display/DisplayAndroidManager.java", "java/src/org/chromium/ui/resources/HandleViewResources.java", "java/src/org/chromium/ui/resources/ResourceFactory.java", "java/src/org/chromium/ui/resources/ResourceManager.java", ] jni_package = "ui_android" } java_cpp_enum("java_enums_srcjar") { sources = [ "../base/ime/text_input_type.h", "../base/page_transition_types.h", "../base/touch/touch_device.h", "../base/ui_base_types.h", "../events/android/gesture_event_type.h", "../gfx/android/java_bitmap.h", "resources/resource_manager.h", "resources/system_ui_resource_type.h", ] } java_strings_grd("ui_strings_grd") { grd_file = "java/strings/android_ui_strings.grd" outputs = [ "values-am/android_ui_strings.xml", "values-ar/android_ui_strings.xml", "values-bg/android_ui_strings.xml", "values-ca/android_ui_strings.xml", "values-cs/android_ui_strings.xml", "values-da/android_ui_strings.xml", "values-de/android_ui_strings.xml", "values-el/android_ui_strings.xml", "values/android_ui_strings.xml", "values-en-rGB/android_ui_strings.xml", "values-es/android_ui_strings.xml", "values-es-rUS/android_ui_strings.xml", "values-fa/android_ui_strings.xml", "values-fi/android_ui_strings.xml", "values-tl/android_ui_strings.xml", "values-fr/android_ui_strings.xml", "values-hi/android_ui_strings.xml", "values-hr/android_ui_strings.xml", "values-hu/android_ui_strings.xml", "values-in/android_ui_strings.xml", "values-it/android_ui_strings.xml", "values-iw/android_ui_strings.xml", "values-ja/android_ui_strings.xml", "values-ko/android_ui_strings.xml", "values-lt/android_ui_strings.xml", "values-lv/android_ui_strings.xml", "values-nl/android_ui_strings.xml", "values-nb/android_ui_strings.xml", "values-pl/android_ui_strings.xml", "values-pt-rBR/android_ui_strings.xml", "values-pt-rPT/android_ui_strings.xml", "values-ro/android_ui_strings.xml", "values-ru/android_ui_strings.xml", "values-sk/android_ui_strings.xml", "values-sl/android_ui_strings.xml", "values-sr/android_ui_strings.xml", "values-sv/android_ui_strings.xml", "values-sw/android_ui_strings.xml", "values-th/android_ui_strings.xml", "values-tr/android_ui_strings.xml", "values-uk/android_ui_strings.xml", "values-vi/android_ui_strings.xml", "values-zh-rCN/android_ui_strings.xml", "values-zh-rTW/android_ui_strings.xml", ] } # Generate an Android resources target that contains localized strings # describing the current locale used by the Android framework to display # UI strings. These are used by org.chromium.ui.base.LocalizationUtils. # # Variables: # ui_locales: List of Chromium locale names to generate resources for. # template("generate_ui_locale_resources") { _generating_target_name = "${target_name}__generate" _rebased_output_zip_path = rebase_path(target_gen_dir, root_gen_dir) _output_zip = "${root_out_dir}/resource_zips/${_rebased_output_zip_path}/" + "${target_name}.zip" _locales = invoker.ui_locales _depfile = "$target_gen_dir/$target_name.d" action(_generating_target_name) { script = "build/create_ui_locale_resources.py" depfile = _depfile outputs = [ _output_zip, ] args = [ "--locale-list=$_locales", "--depfile", rebase_path(_depfile, root_build_dir), "--output-zip", rebase_path(_output_zip, root_build_dir), ] } android_generated_resources(target_name) { generating_target_name = ":$_generating_target_name" generated_resources_zip = _output_zip } } generate_ui_locale_resources("ui_locale_string_resources") { # NOTE: It is not possible to pass just |locales| here, otherwise # the lint step will later complain that 3 strings in android_ui_strings.grd # are not localized to the omitted locales! ui_locales = locales - android_chrome_omitted_locales } android_resources("ui_java_resources") { custom_package = "org.chromium.ui" resource_dirs = [ "java/res" ] deps = [ ":ui_locale_string_resources", ":ui_strings_grd", ] } java_group("ui_java") { deps = [ ":ui_full_java", ":ui_utils_java", ] } # This is created explicitly for remoting_apk to avoid including # unused JNI functions. android_library("ui_utils_java") { java_files = [ "java/src/org/chromium/ui/ContactsPickerListener.java", "java/src/org/chromium/ui/PhotoPickerListener.java", "java/src/org/chromium/ui/UiUtils.java", ] deps = [ "//base:base_java", ] } android_library("ui_full_java") { java_files = [ "java/src/org/chromium/ui/AsyncViewStub.java", "java/src/org/chromium/ui/AsyncViewProvider.java", "java/src/org/chromium/ui/DropdownAdapter.java", "java/src/org/chromium/ui/DropdownDividerDrawable.java", "java/src/org/chromium/ui/DropdownItem.java", "java/src/org/chromium/ui/DropdownItemBase.java", "java/src/org/chromium/ui/DropdownPopupWindowImpl.java", "java/src/org/chromium/ui/DropdownPopupWindow.java", "java/src/org/chromium/ui/DropdownPopupWindowJellyBean.java", "java/src/org/chromium/ui/DropdownPopupWindowInterface.java", "java/src/org/chromium/ui/HorizontalListDividerDrawable.java", "java/src/org/chromium/ui/OverscrollRefreshHandler.java", "java/src/org/chromium/ui/VSyncMonitor.java", "java/src/org/chromium/ui/base/ActivityAndroidPermissionDelegate.java", "java/src/org/chromium/ui/base/ActivityWindowAndroid.java", "java/src/org/chromium/ui/base/AndroidPermissionDelegate.java", "java/src/org/chromium/ui/base/Clipboard.java", "java/src/org/chromium/ui/base/DeviceFormFactor.java", "java/src/org/chromium/ui/base/EventForwarder.java", "java/src/org/chromium/ui/base/LocalizationUtils.java", "java/src/org/chromium/ui/base/PermissionCallback.java", "java/src/org/chromium/ui/base/ResourceBundle.java", "java/src/org/chromium/ui/base/SelectFileDialog.java", "java/src/org/chromium/ui/base/SPenSupport.java", "java/src/org/chromium/ui/base/TouchDevice.java", "java/src/org/chromium/ui/base/ViewAndroidDelegate.java", "java/src/org/chromium/ui/base/ViewUtils.java", "java/src/org/chromium/ui/base/WindowAndroid.java", "java/src/org/chromium/ui/display/DisplayAndroid.java", "java/src/org/chromium/ui/display/DisplayAndroidManager.java", "java/src/org/chromium/ui/display/DisplaySwitches.java", "java/src/org/chromium/ui/display/DisplayUtil.java", "java/src/org/chromium/ui/display/PhysicalDisplayAndroid.java", "java/src/org/chromium/ui/display/VirtualDisplayAndroid.java", "java/src/org/chromium/ui/drawable/StateListDrawableBuilder.java", "java/src/org/chromium/ui/events/devices/InputDeviceObserver.java", "java/src/org/chromium/ui/gfx/BitmapHelper.java", "java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java", "java/src/org/chromium/ui/gl/SurfaceTextureListener.java", "java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java", "java/src/org/chromium/ui/interpolators/BakedBezierInterpolator.java", "java/src/org/chromium/ui/resources/HandleViewResources.java", "java/src/org/chromium/ui/resources/LayoutResource.java", "java/src/org/chromium/ui/resources/Resource.java", "java/src/org/chromium/ui/resources/ResourceExtractor.java", "java/src/org/chromium/ui/resources/ResourceFactory.java", "java/src/org/chromium/ui/resources/ResourceLoader.java", "java/src/org/chromium/ui/resources/ResourceManager.java", "java/src/org/chromium/ui/resources/async/AsyncPreloadResourceLoader.java", "java/src/org/chromium/ui/resources/dynamics/BitmapDynamicResource.java", "java/src/org/chromium/ui/resources/dynamics/DynamicResource.java", "java/src/org/chromium/ui/resources/dynamics/DynamicResourceLoader.java", "java/src/org/chromium/ui/resources/dynamics/ViewResourceAdapter.java", "java/src/org/chromium/ui/resources/dynamics/ViewResourceInflater.java", "java/src/org/chromium/ui/resources/statics/NinePatchData.java", "java/src/org/chromium/ui/resources/statics/StaticResource.java", "java/src/org/chromium/ui/resources/statics/StaticResourceLoader.java", "java/src/org/chromium/ui/resources/system/SystemResourceLoader.java", "java/src/org/chromium/ui/text/NoUnderlineClickableSpan.java", "java/src/org/chromium/ui/text/SpanApplier.java", "java/src/org/chromium/ui/widget/AnchoredPopupWindow.java", "java/src/org/chromium/ui/widget/ButtonCompat.java", "java/src/org/chromium/ui/widget/CheckableImageView.java", "java/src/org/chromium/ui/widget/RectProvider.java", "java/src/org/chromium/ui/widget/TextViewWithClickableSpans.java", "java/src/org/chromium/ui/widget/TextViewWithLeading.java", "java/src/org/chromium/ui/widget/Toast.java", "java/src/org/chromium/ui/widget/UiWidgetFactory.java", "java/src/org/chromium/ui/widget/ViewRectProvider.java", ] deps = [ ":ui_java_resources", ":ui_utils_java", "//base:base_java", "//third_party/android_tools:android_support_annotations_java", "//third_party/android_tools:android_support_v7_appcompat_java", ] srcjar_deps = [ ":java_enums_srcjar", "//third_party/blink/public:blink_cursor_type_java_enums_srcjar", ] } android_library("ui_java_test_support") { testonly = true java_files = [ "javatests/src/org/chromium/ui/test/util/UiDisableIf.java", "javatests/src/org/chromium/ui/test/util/UiDisableIfSkipCheck.java", "javatests/src/org/chromium/ui/test/util/UiRestriction.java", "javatests/src/org/chromium/ui/test/util/UiRestrictionSkipCheck.java", ] deps = [ ":ui_java", "//base:base_java", "//base:base_java_test_support", ] } android_resources("ui_javatest_resources") { custom_package = "org.chromium.test.ui" resource_dirs = [ "junit/res" ] } junit_binary("ui_junit_tests") { package_name = "org.chromium.test.ui" java_files = [ "junit/src/org/chromium/ui/AsyncViewStubTest.java", "junit/src/org/chromium/ui/AsyncViewProviderTest.java", "junit/src/org/chromium/ui/base/ClipboardTest.java", "junit/src/org/chromium/ui/base/SelectFileDialogTest.java", "junit/src/org/chromium/ui/drawable/StateListDrawableBuilderTest.java", "junit/src/org/chromium/ui/text/SpanApplierTest.java", "junit/src/org/chromium/ui/shadows/ShadowAsyncLayoutInflater.java", "junit/src/org/chromium/ui/shadows/ShadowAppCompatResources.java", "junit/src/org/chromium/ui/shadows/ShadowAppCompatResourcesTest.java", "junit/src/org/chromium/ui/shadows/ShadowAnimatedStateListDrawable.java", "junit/src/org/chromium/ui/widget/AnchoredPopupWindowTest.java", ] deps = [ ":ui_java", ":ui_javatest_resources", "//base:base_java", "//base:base_java_test_support", "//base:base_junit_test_support", ] } test("ui_android_unittests") { sources = [ "delegated_frame_host_android_unittest.cc", "overscroll_refresh_unittest.cc", "resources/resource_manager_impl_unittest.cc", "run_all_unittests.cc", "view_android_unittests.cc", ] deps = [ ":android", ":java_enums_srcjar", ":ui_java", "//base", "//base/test:test_support", "//cc", "//cc:test_support", "//components/viz/host:host", "//components/viz/service:service", "//components/viz/test:test_support", "//skia", "//testing/gmock", "//testing/gtest", "//ui/base", "//ui/compositor", "//ui/events", "//ui/gfx", "//ui/resources:ui_test_pak", ] }