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.
5 import("//build/config/ui.gni")
6 import("//testing/test.gni")
9 import("//build/config/android/config.gni")
10 import("//build/config/android/rules.gni")
16 output_name = "ui_base"
19 "accelerators/menu_label_accelerator_util_linux.cc",
20 "accelerators/menu_label_accelerator_util_linux.h",
21 "accelerators/platform_accelerator.h",
22 "accelerators/platform_accelerator_cocoa.h",
23 "accelerators/platform_accelerator_cocoa.mm",
24 "android/ui_base_jni_registrar.cc",
25 "android/ui_base_jni_registrar.h",
26 "clipboard/clipboard_android.cc",
27 "clipboard/clipboard_android.h",
28 "clipboard/clipboard_mac.h",
29 "clipboard/clipboard_mac.mm",
30 "clipboard/clipboard_types.h",
31 "clipboard/clipboard_util_win.cc",
32 "clipboard/clipboard_util_win.h",
33 "clipboard/clipboard_win.cc",
34 "clipboard/clipboard_win.h",
35 "clipboard/custom_data_helper_linux.cc",
36 "clipboard/custom_data_helper_mac.mm",
37 "cocoa/animation_utils.h",
38 "cocoa/appkit_utils.h",
39 "cocoa/appkit_utils.mm",
42 "cocoa/cocoa_base_utils.h",
43 "cocoa/cocoa_base_utils.mm",
44 "cocoa/constrained_window/constrained_window_animation.h",
45 "cocoa/constrained_window/constrained_window_animation.mm",
46 "cocoa/controls/blue_label_button.h",
47 "cocoa/controls/blue_label_button.mm",
48 "cocoa/controls/hover_image_menu_button.h",
49 "cocoa/controls/hover_image_menu_button.mm",
50 "cocoa/controls/hover_image_menu_button_cell.h",
51 "cocoa/controls/hover_image_menu_button_cell.mm",
52 "cocoa/controls/hyperlink_button_cell.h",
53 "cocoa/controls/hyperlink_button_cell.mm",
54 "cocoa/controls/hyperlink_text_view.h",
55 "cocoa/controls/hyperlink_text_view.mm",
56 "cocoa/find_pasteboard.h",
57 "cocoa/find_pasteboard.mm",
58 "cocoa/flipped_view.h",
59 "cocoa/flipped_view.mm",
60 "cocoa/focus_tracker.h",
61 "cocoa/focus_tracker.mm",
62 "cocoa/focus_window_set.h",
63 "cocoa/focus_window_set.mm",
64 "cocoa/fullscreen_window_manager.h",
65 "cocoa/fullscreen_window_manager.mm",
66 "cocoa/hover_button.h",
67 "cocoa/hover_button.mm",
68 "cocoa/hover_image_button.h",
69 "cocoa/hover_image_button.mm",
70 "cocoa/menu_controller.h",
71 "cocoa/menu_controller.mm",
72 "cocoa/nib_loading.h",
73 "cocoa/nib_loading.mm",
74 "cocoa/nsgraphics_context_additions.h",
75 "cocoa/nsgraphics_context_additions.mm",
76 "cocoa/nsview_additions.h",
77 "cocoa/nsview_additions.mm",
78 "cocoa/remote_layer_api.h",
79 "cocoa/remote_layer_api.mm",
80 "cocoa/three_part_image.h",
81 "cocoa/three_part_image.mm",
82 "cocoa/tool_tip_base_view.h",
83 "cocoa/tool_tip_base_view.mm",
84 "cocoa/tracking_area.h",
85 "cocoa/tracking_area.mm",
86 "cocoa/underlay_opengl_hosting_window.h",
87 "cocoa/underlay_opengl_hosting_window.mm",
88 "cocoa/view_description.h",
89 "cocoa/view_description.mm",
90 "cocoa/window_size_constants.h",
91 "cocoa/window_size_constants.mm",
94 "cursor/cursor_android.cc",
95 "cursor/cursor_loader.h",
96 "cursor/cursor_win.cc",
97 "default_theme_provider_mac.mm",
98 "device_form_factor.h",
99 "device_form_factor_android.cc",
100 "device_form_factor_android.h",
101 "device_form_factor_desktop.cc",
102 "device_form_factor_ios.mm",
103 "dragdrop/drag_drop_types.h",
104 "dragdrop/drag_drop_types_win.cc",
105 "dragdrop/drag_source_win.cc",
106 "dragdrop/drag_source_win.h",
107 "dragdrop/drag_utils_aura.cc",
108 "dragdrop/drag_utils_mac.mm",
109 "dragdrop/drag_utils_win.cc",
110 "dragdrop/drop_target_event.cc",
111 "dragdrop/drop_target_event.h",
112 "dragdrop/drop_target_win.cc",
113 "dragdrop/drop_target_win.h",
114 "dragdrop/os_exchange_data.cc",
115 "dragdrop/os_exchange_data.h",
116 "dragdrop/os_exchange_data_provider_mac.h",
117 "dragdrop/os_exchange_data_provider_mac.mm",
118 "dragdrop/os_exchange_data_provider_win.cc",
119 "dragdrop/os_exchange_data_provider_win.h",
123 "idle/idle_chromeos.cc",
124 "idle/idle_linux.cc",
127 "ios/cru_context_menu_controller.h",
128 "ios/cru_context_menu_controller.mm",
129 "ios/cru_context_menu_holder.h",
130 "ios/cru_context_menu_holder.mm",
133 "l10n/l10n_font_util.cc",
134 "l10n/l10n_font_util.h",
137 "l10n/l10n_util_android.cc",
138 "l10n/l10n_util_android.h",
139 "l10n/l10n_util_collator.h",
140 "l10n/l10n_util_mac.h",
141 "l10n/l10n_util_mac.mm",
142 "l10n/l10n_util_posix.cc",
143 "l10n/l10n_util_win.cc",
144 "l10n/l10n_util_win.h",
145 "l10n/time_format.cc",
146 "l10n/time_format.h",
150 "models/button_menu_item_model.cc",
151 "models/button_menu_item_model.h",
152 "models/combobox_model.cc",
153 "models/combobox_model.h",
154 "models/combobox_model_observer.h",
155 "models/dialog_model.cc",
156 "models/dialog_model.h",
157 "models/list_model.h",
158 "models/list_model_observer.h",
159 "models/list_selection_model.cc",
160 "models/list_selection_model.h",
161 "models/menu_model.cc",
162 "models/menu_model.h",
163 "models/menu_model_delegate.h",
164 "models/menu_separator_types.h",
165 "models/simple_combobox_model.cc",
166 "models/simple_combobox_model.h",
167 "models/simple_menu_model.cc",
168 "models/simple_menu_model.h",
169 "models/table_model.cc",
170 "models/table_model.h",
171 "models/table_model_observer.h",
172 "models/tree_model.cc",
173 "models/tree_model.h",
174 "models/tree_node_iterator.h",
175 "models/tree_node_model.h",
176 "nine_image_painter_factory.cc",
177 "nine_image_painter_factory.h",
178 "page_transition_types.cc",
179 "page_transition_types.h",
180 "resource/data_pack.cc",
181 "resource/data_pack.h",
182 "resource/material_design/material_design_controller.cc",
183 "resource/material_design/material_design_controller.h",
184 "resource/resource_bundle.cc",
185 "resource/resource_bundle.h",
186 "resource/resource_bundle_android.cc",
187 "resource/resource_bundle_auralinux.cc",
188 "resource/resource_bundle_ios.mm",
189 "resource/resource_bundle_mac.mm",
190 "resource/resource_bundle_win.cc",
191 "resource/resource_bundle_win.h",
192 "resource/resource_data_dll_win.cc",
193 "resource/resource_data_dll_win.h",
194 "resource/resource_handle.h",
195 "template_expressions.cc",
196 "template_expressions.h",
199 "touch/selection_bound.cc",
200 "touch/selection_bound.h",
201 "touch/touch_device.h",
202 "touch/touch_editing_controller.cc",
203 "touch/touch_editing_controller.h",
204 "touch/touch_enabled.cc",
205 "touch/touch_enabled.h",
207 "ui_base_exports.cc",
210 "ui_base_switches.cc",
211 "ui_base_switches.h",
212 "ui_base_switches_util.cc",
213 "ui_base_switches_util.h",
216 "user_activity/user_activity_detector.cc",
217 "user_activity/user_activity_detector.h",
218 "user_activity/user_activity_observer.h",
221 "webui/jstemplate_builder.cc",
222 "webui/jstemplate_builder.h",
223 "webui/web_ui_util.cc",
224 "webui/web_ui_util.h",
225 "win/accessibility_ids_win.h",
226 "win/accessibility_misc_utils.cc",
227 "win/accessibility_misc_utils.h",
229 "win/foreground_helper.cc",
230 "win/foreground_helper.h",
231 "win/hidden_window.cc",
232 "win/hidden_window.h",
233 "win/hwnd_subclass.cc",
234 "win/hwnd_subclass.h",
235 "win/internal_constants.cc",
236 "win/internal_constants.h",
239 "win/message_box_win.cc",
240 "win/message_box_win.h",
241 "win/mouse_wheel_util.cc",
242 "win/mouse_wheel_util.h",
243 "win/open_file_name_win.cc",
244 "win/open_file_name_win.h",
245 "win/scoped_ole_initializer.cc",
246 "win/scoped_ole_initializer.h",
249 "win/touch_input.cc",
251 "win/window_event_target.cc",
252 "win/window_event_target.h",
253 "window_open_disposition.cc",
254 "window_open_disposition.h",
255 "work_area_watcher_observer.h",
260 "accelerators/accelerator.cc",
261 "accelerators/accelerator.h",
262 "accelerators/accelerator_history.cc",
263 "accelerators/accelerator_history.h",
264 "accelerators/accelerator_manager.cc",
265 "accelerators/accelerator_manager.h",
268 "clipboard/clipboard.cc",
269 "clipboard/clipboard.h",
270 "clipboard/clipboard_constants.cc",
271 "clipboard/custom_data_helper.cc",
272 "clipboard/custom_data_helper.h",
273 "clipboard/scoped_clipboard_writer.cc",
274 "clipboard/scoped_clipboard_writer.h",
275 "cursor/cursor_util.cc",
276 "cursor/cursor_util.h",
277 "cursor/cursors_aura.cc",
278 "cursor/cursors_aura.h",
279 "cursor/image_cursors.cc",
280 "cursor/image_cursors.h",
281 "default_theme_provider.cc",
282 "default_theme_provider.h",
283 "dragdrop/cocoa_dnd_util.h",
284 "dragdrop/cocoa_dnd_util.mm",
285 "dragdrop/drag_utils.cc",
286 "dragdrop/drag_utils.h",
287 "dragdrop/file_info.cc",
288 "dragdrop/file_info.h",
289 "text/bytes_formatting.cc",
290 "text/bytes_formatting.h",
295 sources += [ "touch/touch_device_win.cc" ]
296 } else if (is_android) {
297 sources += [ "touch/touch_device_android.cc" ]
299 sources += [ "touch/touch_device_ios.cc" ]
300 } else if (is_linux) {
301 sources += [ "touch/touch_device_linux.cc" ]
303 # Empty implementation for all other cases.
304 sources += [ "touch/touch_device.cc" ]
307 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
308 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
310 defines = [ "UI_BASE_IMPLEMENTATION" ]
315 "//ui/events/platform",
316 "//ui/events:events_base",
321 "//base/third_party/dynamic_annotations",
322 "//base:base_static",
327 "//ui/events/devices",
334 set_sources_assignment_filter([])
336 "l10n/l10n_util_mac.h",
337 "l10n/l10n_util_mac.mm",
339 set_sources_assignment_filter(sources_assignment_filter)
343 deps += [ "//ui/events" ]
346 if (use_x11 && use_aura) {
348 "x/selection_owner.cc",
349 "x/selection_owner.h",
350 "x/selection_requestor.cc",
351 "x/selection_requestor.h",
352 "x/selection_utils.cc",
353 "x/selection_utils.h",
358 deps += [ "//ui/events" ]
363 "dragdrop/drag_utils_aura.cc",
368 "x/x11_foreign_window_manager.cc",
369 "x/x11_foreign_window_manager.h",
370 "x/x11_menu_list.cc",
374 "x/x11_util_internal.h",
378 "idle/idle_query_x11.cc",
379 "idle/idle_query_x11.h",
380 "idle/screensaver_window_finder_x11.cc",
381 "idle/screensaver_window_finder_x11.h",
383 configs += [ "//build/config/linux:xscrnsaver" ]
385 deps += [ "//ui/gfx/x" ]
388 if (!use_aura || !is_linux) {
389 sources -= [ "resource/resource_bundle_auralinux.cc" ]
392 if (use_aura && is_win) {
393 sources -= [ "dragdrop/drag_utils_aura.cc" ]
398 "//build/config/linux:fontconfig",
399 "//build/config/linux:glib",
403 if ((is_linux && !is_chromeos) || is_chromeos) {
404 if (!toolkit_views && !use_aura) {
406 "dragdrop/drag_utils.cc",
407 "dragdrop/drag_utils.h",
413 deps += [ "//chromeos" ]
414 sources -= [ "idle/idle_linux.cc" ]
417 if (is_chromeos || (use_aura && ((is_linux && !use_x11) || is_android))) {
419 "dragdrop/os_exchange_data_provider_aura.cc",
420 "dragdrop/os_exchange_data_provider_aura.h",
427 "cursor/cursor_loader_win.cc",
428 "cursor/cursor_loader_win.h",
430 deps += [ "//third_party/wtl" ]
431 cflags = [ "/wd4324" ] # Structure was padded due to __declspec(align()), which is
435 "/DELAYLOAD:d2d1.dll",
436 "/DELAYLOAD:d3d10_1.dll",
437 "/DELAYLOAD:dwmapi.dll",
457 deps += [ "//third_party/mozilla" ]
460 "cursor/image_cursors.cc",
461 "cursor/image_cursors.h",
462 "dragdrop/drag_utils.cc",
463 "dragdrop/drag_utils.h",
467 "Accelerate.framework",
468 "AudioUnit.framework",
469 "CoreVideo.framework",
474 #'all_dependent_settings': {
479 configs += [ "//build/config/linux:x11" ]
485 "cursor/cursor_loader_x11.cc",
486 "cursor/cursor_loader_x11.h",
487 "cursor/cursor_x11.cc",
490 # These Aura X11 files aren't used on ChromeOS.
492 "dragdrop/os_exchange_data_provider_aurax11.cc",
493 "dragdrop/os_exchange_data_provider_aurax11.h",
498 sources += [ "cursor/cursor_loader_android.cc" ]
503 "cursor/cursor_loader_ozone.cc",
504 "cursor/cursor_loader_ozone.h",
505 "cursor/cursor_ozone.cc",
506 "cursor/ozone/bitmap_cursor_factory_ozone.cc",
507 "cursor/ozone/bitmap_cursor_factory_ozone.h",
511 "//ui/events/ozone:events_ozone_layout",
512 "//ui/ozone:ozone_base",
516 if (!toolkit_views && !use_aura) {
518 "dragdrop/drag_drop_types.h",
519 "dragdrop/drop_target_event.cc",
520 "dragdrop/drop_target_event.h",
521 "dragdrop/os_exchange_data.cc",
522 "dragdrop/os_exchange_data.h",
523 "nine_image_painter_factory.cc",
524 "nine_image_painter_factory.h",
530 ":ui_base_jni_headers",
531 "//ui/android:ui_java",
534 libs += [ "jnigraphics" ]
537 if (is_android && !use_aura) {
539 "cursor/cursor_android.cc",
540 "cursor/image_cursors.cc",
541 "cursor/image_cursors.h",
542 "default_theme_provider.cc",
543 "dragdrop/drag_utils.cc",
544 "dragdrop/drag_utils.h",
545 "l10n/l10n_font_util.cc",
546 "models/button_menu_item_model.cc",
547 "models/dialog_model.cc",
549 "touch/touch_editing_controller.cc",
557 sources += [ "clipboard/clipboard_aurax11.cc" ]
558 } else if (!is_win && !is_android) {
559 # This file is used for all non-X11, non-Windows, non-Android aura Builds.
560 sources += [ "clipboard/clipboard_aura.cc" ]
564 if (is_android || is_ios) {
566 "device_form_factor_desktop.cc",
573 source_set("test_support") {
576 "test/material_design_controller_test_api.cc",
577 "test/material_design_controller_test_api.h",
578 "test/ui_controls.h",
579 "test/ui_controls_aura.cc",
580 "test/ui_controls_internal_win.cc",
581 "test/ui_controls_internal_win.h",
582 "test/ui_controls_mac.mm",
583 "test/ui_controls_win.cc",
588 "test/nswindow_fullscreen_notification_waiter.h",
589 "test/nswindow_fullscreen_notification_waiter.mm",
590 "test/scoped_fake_nswindow_focus.h",
591 "test/scoped_fake_nswindow_focus.mm",
592 "test/scoped_fake_nswindow_fullscreen.h",
593 "test/scoped_fake_nswindow_fullscreen.mm",
594 "test/test_clipboard.cc",
595 "test/test_clipboard.h",
596 "test/windowed_nsnotification_observer.h",
597 "test/windowed_nsnotification_observer.mm",
608 "//ui/events:events_base",
615 "ime/dummy_input_method.cc",
616 "ime/dummy_input_method.h",
617 "ime/dummy_text_input_client.cc",
618 "ime/dummy_text_input_client.h",
621 deps += [ "//ui/base/ime" ]
625 sources -= [ "test/ui_controls_aura.cc" ]
627 sources -= [ "test/ui_controls_win.cc" ]
632 generate_jni("ui_base_jni_headers") {
634 "../android/java/src/org/chromium/ui/base/Clipboard.java",
635 "../android/java/src/org/chromium/ui/base/DeviceFormFactor.java",
636 "../android/java/src/org/chromium/ui/base/LocalizationUtils.java",
637 "../android/java/src/org/chromium/ui/base/ResourceBundle.java",
638 "../android/java/src/org/chromium/ui/base/SelectFileDialog.java",
639 "../android/java/src/org/chromium/ui/base/TouchDevice.java",
646 # TODO(GYP): Delete this after we've converted everything to GN.
647 # The _run targets exist only for compatibility w/ GYP.
648 group("ui_base_unittests_run") {
651 ":ui_base_unittests",
655 # GYP version: ui/base/ui_base_tests.gyp:ui_base_unittests
656 test("ui_base_unittests") {
658 "ios/cru_context_menu_controller_unittest.mm",
659 "l10n/l10n_util_mac_unittest.mm",
660 "l10n/l10n_util_unittest.cc",
661 "l10n/l10n_util_win_unittest.cc",
662 "l10n/time_format_unittest.cc",
663 "layout_unittest.cc",
664 "models/tree_node_iterator_unittest.cc",
665 "resource/data_pack_literal.cc",
666 "resource/data_pack_unittest.cc",
667 "resource/material_design/material_design_controller_unittest.cc",
668 "resource/resource_bundle_unittest.cc",
669 "template_expressions_unittest.cc",
670 "test/run_all_unittests.cc",
671 "user_activity/user_activity_detector_unittest.cc",
675 "test/scoped_fake_nswindow_fullscreen_unittest.mm",
676 "test/test_clipboard_unittest.cc",
684 sources -= [ "user_activity/user_activity_detector_unittest.cc" ]
688 # Compile this Mac file on iOS as well.
689 set_sources_assignment_filter([])
690 sources += [ "l10n/l10n_util_mac_unittest.mm" ]
691 set_sources_assignment_filter(sources_assignment_filter)
694 "accelerators/accelerator_manager_unittest.cc",
695 "accelerators/menu_label_accelerator_util_linux_unittest.cc",
696 "clipboard/custom_data_helper_unittest.cc",
697 "cocoa/base_view_unittest.mm",
698 "cocoa/cocoa_base_utils_unittest.mm",
699 "cocoa/constrained_window/constrained_window_animation_unittest.mm",
700 "cocoa/controls/blue_label_button_unittest.mm",
701 "cocoa/controls/hover_image_menu_button_unittest.mm",
702 "cocoa/controls/hyperlink_button_cell_unittest.mm",
703 "cocoa/controls/hyperlink_text_view_unittest.mm",
704 "cocoa/focus_tracker_unittest.mm",
705 "cocoa/fullscreen_window_manager_unittest.mm",
706 "cocoa/hover_image_button_unittest.mm",
707 "cocoa/menu_controller_unittest.mm",
708 "cocoa/nsgraphics_context_additions_unittest.mm",
709 "cocoa/nsview_additions_unittest.mm",
710 "cocoa/three_part_image_unittest.mm",
711 "cocoa/tracking_area_unittest.mm",
712 "models/list_model_unittest.cc",
713 "models/list_selection_model_unittest.cc",
714 "models/tree_node_model_unittest.cc",
715 "test/data/resource.h",
716 "text/bytes_formatting_unittest.cc",
717 "touch/selection_bound_unittest.cc",
718 "webui/web_ui_util_unittest.cc",
724 "ime/candidate_window_unittest.cc",
725 "ime/chromeos/character_composer_unittest.cc",
726 "ime/chromeos/composition_text_chromeos_unittest.cc",
727 "ime/input_method_base_unittest.cc",
728 "ime/input_method_chromeos_unittest.cc",
729 "ime/remote_input_method_win_unittest.cc",
730 "ime/win/imm32_manager_unittest.cc",
731 "ime/win/tsf_input_scope_unittest.cc",
733 if (is_linux && use_aura && !is_chromeos) {
734 sources += [ "ime/input_method_auralinux_unittest.cc" ]
737 sources += [ "ime/composition_text_util_pango_unittest.cc" ]
739 if (!use_x11 && is_chromeos) {
740 # These were already removed in the non-chromeos case.
741 sources -= [ "ime/input_method_chromeos_unittest.cc" ]
745 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
746 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
751 "//base/test:test_support",
758 "//ui/base:test_support",
759 "//ui/events:events_base",
760 "//ui/events:test_support",
761 "//ui/gfx:test_support",
763 "//ui/resources:ui_test_pak",
769 # TODO(GYP) lots of iOS-only steps for ui_base_unittests
773 deps += [ "//ui/base/ime" ]
778 "dragdrop/os_exchange_data_win_unittest.cc",
779 "win/hwnd_subclass_unittest.cc",
780 "win/open_file_name_win_unittest.cc",
784 "/DELAYLOAD:d2d1.dll",
785 "/DELAYLOAD:d3d10_1.dll",
796 sources += [ "view_prop_unittest.cc" ]
800 apk_deps = [ "//chrome:resources" ]
801 isolate_file = "ui_base_unittests.isolate"
805 configs += [ "//build/config/linux:pangocairo" ]
809 sources += [ "cursor/cursor_loader_x11_unittest.cc" ]
811 configs += [ "//build/config/linux:x11" ]
814 "//ui/events/platform/x11",
818 data_deps += [ "//tools/xdisplaycheck" ]
823 "//third_party/mozilla",
824 #'ui_base_tests_bundle', TODO(GYP)
828 if (use_aura || toolkit_views) {
829 sources += [ "dragdrop/os_exchange_data_unittest.cc" ]
833 "//ui/events/platform",
837 if (use_x11 && !is_chromeos) {
839 "dragdrop/os_exchange_data_provider_aurax11_unittest.cc",
840 "x/selection_requestor_unittest.cc",
847 "//ui/events:dom_keycode_converter",
851 if (is_linux || is_mac || is_win) {
852 # TODO(brettw): We should be able to depend on //ui/resources:ui_test_pak
853 # instead of depending directly on the non-test .pak files, but depending
854 # on ui_test_pak seems to have no effect.
856 "test/data/data_pack_unittest/truncated-header.pak",
857 "$root_out_dir/ui_test.pak", # TODO(brettw): remove this line.
860 "//ui/resources:ui_test_pak", # TODO(brettw): this does nothing.
861 "//third_party/mesa:osmesa",
864 if (is_linux || is_win) {
866 # TODO(brettw): Remove these two lines.
867 "$root_out_dir/ui/en-US.pak",
868 "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
872 data += [ "$root_out_dir/ui_unittests Framework.framework/" ]
874 if (is_asan && symbol_level == 0) {
875 data += [ "$root_out_dir/ui_base_unittests.dSYM/" ]
879 # TODO(GYP) Mac (ui_base_tests_bundle)