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"
18 "accelerators/accelerator.cc",
19 "accelerators/accelerator.h",
20 "accelerators/accelerator_history.cc",
21 "accelerators/accelerator_history.h",
22 "accelerators/accelerator_manager.cc",
23 "accelerators/accelerator_manager.h",
24 "accelerators/menu_label_accelerator_util_linux.cc",
25 "accelerators/menu_label_accelerator_util_linux.h",
26 "accelerators/platform_accelerator.h",
27 "accelerators/platform_accelerator_cocoa.h",
28 "accelerators/platform_accelerator_cocoa.mm",
29 "android/ui_base_jni_registrar.cc",
30 "android/ui_base_jni_registrar.h",
33 "clipboard/clipboard.cc",
34 "clipboard/clipboard.h",
35 "clipboard/clipboard_android.cc",
36 "clipboard/clipboard_android.h",
37 "clipboard/clipboard_constants.cc",
38 "clipboard/clipboard_mac.h",
39 "clipboard/clipboard_mac.mm",
40 "clipboard/clipboard_types.h",
41 "clipboard/clipboard_util_win.cc",
42 "clipboard/clipboard_util_win.h",
43 "clipboard/clipboard_win.cc",
44 "clipboard/clipboard_win.h",
45 "clipboard/custom_data_helper.cc",
46 "clipboard/custom_data_helper.h",
47 "clipboard/custom_data_helper_linux.cc",
48 "clipboard/custom_data_helper_mac.mm",
49 "clipboard/scoped_clipboard_writer.cc",
50 "clipboard/scoped_clipboard_writer.h",
51 "cocoa/animation_utils.h",
52 "cocoa/appkit_utils.h",
53 "cocoa/appkit_utils.mm",
56 "cocoa/cocoa_base_utils.h",
57 "cocoa/cocoa_base_utils.mm",
58 "cocoa/constrained_window/constrained_window_animation.h",
59 "cocoa/constrained_window/constrained_window_animation.mm",
60 "cocoa/controls/blue_label_button.h",
61 "cocoa/controls/blue_label_button.mm",
62 "cocoa/controls/hover_image_menu_button.h",
63 "cocoa/controls/hover_image_menu_button.mm",
64 "cocoa/controls/hover_image_menu_button_cell.h",
65 "cocoa/controls/hover_image_menu_button_cell.mm",
66 "cocoa/controls/hyperlink_button_cell.h",
67 "cocoa/controls/hyperlink_button_cell.mm",
68 "cocoa/controls/hyperlink_text_view.h",
69 "cocoa/controls/hyperlink_text_view.mm",
70 "cocoa/find_pasteboard.h",
71 "cocoa/find_pasteboard.mm",
72 "cocoa/flipped_view.h",
73 "cocoa/flipped_view.mm",
74 "cocoa/focus_tracker.h",
75 "cocoa/focus_tracker.mm",
76 "cocoa/focus_window_set.h",
77 "cocoa/focus_window_set.mm",
78 "cocoa/fullscreen_window_manager.h",
79 "cocoa/fullscreen_window_manager.mm",
80 "cocoa/hover_button.h",
81 "cocoa/hover_button.mm",
82 "cocoa/hover_image_button.h",
83 "cocoa/hover_image_button.mm",
84 "cocoa/menu_controller.h",
85 "cocoa/menu_controller.mm",
86 "cocoa/nib_loading.h",
87 "cocoa/nib_loading.mm",
88 "cocoa/nsgraphics_context_additions.h",
89 "cocoa/nsgraphics_context_additions.mm",
90 "cocoa/nsview_additions.h",
91 "cocoa/nsview_additions.mm",
92 "cocoa/remote_layer_api.h",
93 "cocoa/remote_layer_api.mm",
94 "cocoa/three_part_image.h",
95 "cocoa/three_part_image.mm",
96 "cocoa/tool_tip_base_view.h",
97 "cocoa/tool_tip_base_view.mm",
98 "cocoa/tracking_area.h",
99 "cocoa/tracking_area.mm",
100 "cocoa/underlay_opengl_hosting_window.h",
101 "cocoa/underlay_opengl_hosting_window.mm",
102 "cocoa/view_description.h",
103 "cocoa/view_description.mm",
104 "cocoa/window_size_constants.h",
105 "cocoa/window_size_constants.mm",
108 "cursor/cursor_android.cc",
109 "cursor/cursor_loader.h",
110 "cursor/cursor_util.cc",
111 "cursor/cursor_util.h",
112 "cursor/cursor_win.cc",
113 "cursor/cursors_aura.cc",
114 "cursor/cursors_aura.h",
115 "cursor/image_cursors.cc",
116 "cursor/image_cursors.h",
117 "default_theme_provider.cc",
118 "default_theme_provider.h",
119 "default_theme_provider_mac.mm",
120 "device_form_factor.h",
121 "device_form_factor_android.cc",
122 "device_form_factor_android.h",
123 "device_form_factor_desktop.cc",
124 "device_form_factor_ios.mm",
125 "dragdrop/cocoa_dnd_util.h",
126 "dragdrop/cocoa_dnd_util.mm",
127 "dragdrop/drag_drop_types.h",
128 "dragdrop/drag_drop_types_win.cc",
129 "dragdrop/drag_source_win.cc",
130 "dragdrop/drag_source_win.h",
131 "dragdrop/drag_utils.cc",
132 "dragdrop/drag_utils.h",
133 "dragdrop/drag_utils_aura.cc",
134 "dragdrop/drag_utils_mac.mm",
135 "dragdrop/drag_utils_win.cc",
136 "dragdrop/drop_target_event.cc",
137 "dragdrop/drop_target_event.h",
138 "dragdrop/drop_target_win.cc",
139 "dragdrop/drop_target_win.h",
140 "dragdrop/file_info.cc",
141 "dragdrop/file_info.h",
142 "dragdrop/os_exchange_data.cc",
143 "dragdrop/os_exchange_data.h",
144 "dragdrop/os_exchange_data_provider_mac.h",
145 "dragdrop/os_exchange_data_provider_mac.mm",
146 "dragdrop/os_exchange_data_provider_win.cc",
147 "dragdrop/os_exchange_data_provider_win.h",
151 "idle/idle_chromeos.cc",
152 "idle/idle_linux.cc",
155 "ios/cru_context_menu_controller.h",
156 "ios/cru_context_menu_controller.mm",
157 "ios/cru_context_menu_holder.h",
158 "ios/cru_context_menu_holder.mm",
161 "l10n/l10n_font_util.cc",
162 "l10n/l10n_font_util.h",
165 "l10n/l10n_util_android.cc",
166 "l10n/l10n_util_android.h",
167 "l10n/l10n_util_collator.h",
168 "l10n/l10n_util_mac.h",
169 "l10n/l10n_util_mac.mm",
170 "l10n/l10n_util_posix.cc",
171 "l10n/l10n_util_win.cc",
172 "l10n/l10n_util_win.h",
173 "l10n/time_format.cc",
174 "l10n/time_format.h",
178 "models/button_menu_item_model.cc",
179 "models/button_menu_item_model.h",
180 "models/combobox_model.cc",
181 "models/combobox_model.h",
182 "models/combobox_model_observer.h",
183 "models/dialog_model.cc",
184 "models/dialog_model.h",
185 "models/list_model.h",
186 "models/list_model_observer.h",
187 "models/list_selection_model.cc",
188 "models/list_selection_model.h",
189 "models/menu_model.cc",
190 "models/menu_model.h",
191 "models/menu_model_delegate.h",
192 "models/menu_separator_types.h",
193 "models/simple_combobox_model.cc",
194 "models/simple_combobox_model.h",
195 "models/simple_menu_model.cc",
196 "models/simple_menu_model.h",
197 "models/table_model.cc",
198 "models/table_model.h",
199 "models/table_model_observer.h",
200 "models/tree_model.cc",
201 "models/tree_model.h",
202 "models/tree_node_iterator.h",
203 "models/tree_node_model.h",
204 "nine_image_painter_factory.cc",
205 "nine_image_painter_factory.h",
206 "page_transition_types.cc",
207 "page_transition_types.h",
208 "resource/data_pack.cc",
209 "resource/data_pack.h",
210 "resource/material_design/material_design_controller.cc",
211 "resource/material_design/material_design_controller.h",
212 "resource/resource_bundle.cc",
213 "resource/resource_bundle.h",
214 "resource/resource_bundle_android.cc",
215 "resource/resource_bundle_auralinux.cc",
216 "resource/resource_bundle_ios.mm",
217 "resource/resource_bundle_mac.mm",
218 "resource/resource_bundle_win.cc",
219 "resource/resource_bundle_win.h",
220 "resource/resource_data_dll_win.cc",
221 "resource/resource_data_dll_win.h",
222 "resource/resource_handle.h",
223 "template_expressions.cc",
224 "template_expressions.h",
225 "text/bytes_formatting.cc",
226 "text/bytes_formatting.h",
229 "touch/selection_bound.cc",
230 "touch/selection_bound.h",
231 "touch/touch_device.h",
232 "touch/touch_editing_controller.cc",
233 "touch/touch_editing_controller.h",
234 "touch/touch_enabled.cc",
235 "touch/touch_enabled.h",
237 "ui_base_exports.cc",
240 "ui_base_switches.cc",
241 "ui_base_switches.h",
242 "ui_base_switches_util.cc",
243 "ui_base_switches_util.h",
246 "user_activity/user_activity_detector.cc",
247 "user_activity/user_activity_detector.h",
248 "user_activity/user_activity_observer.h",
251 "webui/jstemplate_builder.cc",
252 "webui/jstemplate_builder.h",
253 "webui/web_ui_util.cc",
254 "webui/web_ui_util.h",
255 "win/accessibility_ids_win.h",
256 "win/accessibility_misc_utils.cc",
257 "win/accessibility_misc_utils.h",
259 "win/foreground_helper.cc",
260 "win/foreground_helper.h",
261 "win/hidden_window.cc",
262 "win/hidden_window.h",
263 "win/hwnd_subclass.cc",
264 "win/hwnd_subclass.h",
265 "win/internal_constants.cc",
266 "win/internal_constants.h",
269 "win/message_box_win.cc",
270 "win/message_box_win.h",
271 "win/mouse_wheel_util.cc",
272 "win/mouse_wheel_util.h",
273 "win/open_file_name_win.cc",
274 "win/open_file_name_win.h",
275 "win/scoped_ole_initializer.cc",
276 "win/scoped_ole_initializer.h",
279 "win/touch_input.cc",
281 "win/window_event_target.cc",
282 "win/window_event_target.h",
283 "window_open_disposition.cc",
284 "window_open_disposition.h",
285 "work_area_watcher_observer.h",
289 sources += [ "touch/touch_device_win.cc" ]
290 } else if (is_android) {
291 sources += [ "touch/touch_device_android.cc" ]
293 sources += [ "touch/touch_device_ios.cc" ]
294 } else if (is_linux) {
295 sources += [ "touch/touch_device_linux.cc" ]
297 # Empty implementation for all other cases.
298 sources += [ "touch/touch_device.cc" ]
301 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
302 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
304 defines = [ "UI_BASE_IMPLEMENTATION" ]
309 "//ui/events/platform",
310 "//ui/events:events_base",
315 "//base/third_party/dynamic_annotations",
316 "//base:base_static",
321 "//ui/events/devices",
329 "l10n/l10n_util_mac.h",
330 "l10n/l10n_util_mac.mm",
335 deps += [ "//ui/events" ]
338 if (use_x11 && use_aura) {
340 "x/selection_owner.cc",
341 "x/selection_owner.h",
342 "x/selection_requestor.cc",
343 "x/selection_requestor.h",
344 "x/selection_utils.cc",
345 "x/selection_utils.h",
350 deps += [ "//ui/events" ]
355 "dragdrop/drag_utils_aura.cc",
360 "x/x11_foreign_window_manager.cc",
361 "x/x11_foreign_window_manager.h",
362 "x/x11_menu_list.cc",
366 "x/x11_util_internal.h",
370 "idle/idle_query_x11.cc",
371 "idle/idle_query_x11.h",
372 "idle/screensaver_window_finder_x11.cc",
373 "idle/screensaver_window_finder_x11.h",
375 configs += [ "//build/config/linux:xscrnsaver" ]
377 deps += [ "//ui/gfx/x" ]
380 if (!use_aura || !is_linux) {
381 sources -= [ "resource/resource_bundle_auralinux.cc" ]
384 if (use_aura && is_win) {
385 sources -= [ "dragdrop/drag_utils_aura.cc" ]
390 "//build/config/linux:fontconfig",
391 "//build/config/linux:glib",
395 if ((is_linux && !is_chromeos) || is_chromeos) {
396 if (!toolkit_views && !use_aura) {
398 "dragdrop/drag_utils.cc",
399 "dragdrop/drag_utils.h",
405 deps += [ "//chromeos" ]
406 sources -= [ "idle/idle_linux.cc" ]
409 if (is_chromeos || (use_aura && ((is_linux && !use_x11) || is_android))) {
411 "dragdrop/os_exchange_data_provider_aura.cc",
412 "dragdrop/os_exchange_data_provider_aura.h",
419 "cursor/cursor_loader_win.cc",
420 "cursor/cursor_loader_win.h",
422 deps += [ "//third_party/wtl" ]
423 cflags = [ "/wd4324" ] # Structure was padded due to __declspec(align()), which is
427 "/DELAYLOAD:d2d1.dll",
428 "/DELAYLOAD:d3d10_1.dll",
429 "/DELAYLOAD:dwmapi.dll",
449 deps += [ "//third_party/mozilla" ]
452 "cursor/image_cursors.cc",
453 "cursor/image_cursors.h",
454 "dragdrop/drag_utils.cc",
455 "dragdrop/drag_utils.h",
459 "Accelerate.framework",
460 "AudioUnit.framework",
461 "CoreVideo.framework",
466 #'all_dependent_settings': {
471 configs += [ "//build/config/linux:x11" ]
477 "cursor/cursor_loader_x11.cc",
478 "cursor/cursor_loader_x11.h",
479 "cursor/cursor_x11.cc",
482 # These Aura X11 files aren't used on ChromeOS.
484 "dragdrop/os_exchange_data_provider_aurax11.cc",
485 "dragdrop/os_exchange_data_provider_aurax11.h",
490 sources += [ "cursor/cursor_loader_android.cc" ]
495 "cursor/cursor_loader_ozone.cc",
496 "cursor/cursor_loader_ozone.h",
497 "cursor/cursor_ozone.cc",
498 "cursor/ozone/bitmap_cursor_factory_ozone.cc",
499 "cursor/ozone/bitmap_cursor_factory_ozone.h",
503 "//ui/events/ozone:events_ozone_layout",
504 "//ui/ozone:ozone_base",
508 if (!toolkit_views && !use_aura) {
510 "dragdrop/drag_drop_types.h",
511 "dragdrop/drop_target_event.cc",
512 "dragdrop/drop_target_event.h",
513 "dragdrop/os_exchange_data.cc",
514 "dragdrop/os_exchange_data.h",
515 "nine_image_painter_factory.cc",
516 "nine_image_painter_factory.h",
522 ":ui_base_jni_headers",
523 "//ui/android:ui_java",
526 libs += [ "jnigraphics" ]
529 if (is_android && !use_aura) {
531 "cursor/cursor_android.cc",
532 "cursor/image_cursors.cc",
533 "cursor/image_cursors.h",
534 "default_theme_provider.cc",
535 "dragdrop/drag_utils.cc",
536 "dragdrop/drag_utils.h",
537 "l10n/l10n_font_util.cc",
538 "models/button_menu_item_model.cc",
539 "models/dialog_model.cc",
541 "touch/touch_editing_controller.cc",
549 sources += [ "clipboard/clipboard_aurax11.cc" ]
550 } else if (!is_win && !is_android) {
551 # This file is used for all non-X11, non-Windows, non-Android aura Builds.
552 sources += [ "clipboard/clipboard_aura.cc" ]
556 if (is_android || is_ios) {
558 "device_form_factor_desktop.cc",
565 source_set("test_support") {
568 "test/material_design_controller_test_api.cc",
569 "test/material_design_controller_test_api.h",
570 "test/nswindow_fullscreen_notification_waiter.h",
571 "test/nswindow_fullscreen_notification_waiter.mm",
572 "test/scoped_fake_nswindow_focus.h",
573 "test/scoped_fake_nswindow_focus.mm",
574 "test/scoped_fake_nswindow_fullscreen.h",
575 "test/scoped_fake_nswindow_fullscreen.mm",
576 "test/test_clipboard.cc",
577 "test/test_clipboard.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",
584 "test/windowed_nsnotification_observer.h",
585 "test/windowed_nsnotification_observer.mm",
595 "//ui/events:events_base",
602 "ime/dummy_input_method.cc",
603 "ime/dummy_input_method.h",
604 "ime/dummy_text_input_client.cc",
605 "ime/dummy_text_input_client.h",
608 deps += [ "//ui/base/ime" ]
612 sources -= [ "test/ui_controls_aura.cc" ]
614 sources -= [ "test/ui_controls_win.cc" ]
619 generate_jni("ui_base_jni_headers") {
621 "../android/java/src/org/chromium/ui/base/Clipboard.java",
622 "../android/java/src/org/chromium/ui/base/DeviceFormFactor.java",
623 "../android/java/src/org/chromium/ui/base/LocalizationUtils.java",
624 "../android/java/src/org/chromium/ui/base/ResourceBundle.java",
625 "../android/java/src/org/chromium/ui/base/SelectFileDialog.java",
626 "../android/java/src/org/chromium/ui/base/TouchDevice.java",
633 # TODO(GYP): Delete this after we've converted everything to GN.
634 # The _run targets exist only for compatibility w/ GYP.
635 group("ui_base_unittests_run") {
638 ":ui_base_unittests",
642 # GYP version: ui/base/ui_base_tests.gyp:ui_base_unittests
643 test("ui_base_unittests") {
645 "ios/cru_context_menu_controller_unittest.mm",
646 "l10n/l10n_util_mac_unittest.mm",
647 "l10n/l10n_util_unittest.cc",
648 "l10n/l10n_util_win_unittest.cc",
649 "l10n/time_format_unittest.cc",
650 "layout_unittest.cc",
651 "models/tree_node_iterator_unittest.cc",
652 "resource/data_pack_literal.cc",
653 "resource/data_pack_unittest.cc",
654 "resource/material_design/material_design_controller_unittest.cc",
655 "resource/resource_bundle_unittest.cc",
656 "template_expressions_unittest.cc",
657 "test/run_all_unittests.cc",
658 "test/scoped_fake_nswindow_fullscreen_unittest.mm",
659 "test/test_clipboard_unittest.cc",
660 "user_activity/user_activity_detector_unittest.cc",
667 sources -= [ "user_activity/user_activity_detector_unittest.cc" ]
671 # Compile this Mac file on iOS as well.
672 set_sources_assignment_filter([])
673 sources += [ "l10n/l10n_util_mac_unittest.mm" ]
674 set_sources_assignment_filter(sources_assignment_filter)
677 "accelerators/accelerator_manager_unittest.cc",
678 "accelerators/menu_label_accelerator_util_linux_unittest.cc",
679 "clipboard/custom_data_helper_unittest.cc",
680 "cocoa/base_view_unittest.mm",
681 "cocoa/cocoa_base_utils_unittest.mm",
682 "cocoa/constrained_window/constrained_window_animation_unittest.mm",
683 "cocoa/controls/blue_label_button_unittest.mm",
684 "cocoa/controls/hover_image_menu_button_unittest.mm",
685 "cocoa/controls/hyperlink_button_cell_unittest.mm",
686 "cocoa/controls/hyperlink_text_view_unittest.mm",
687 "cocoa/focus_tracker_unittest.mm",
688 "cocoa/fullscreen_window_manager_unittest.mm",
689 "cocoa/hover_image_button_unittest.mm",
690 "cocoa/menu_controller_unittest.mm",
691 "cocoa/nsgraphics_context_additions_unittest.mm",
692 "cocoa/nsview_additions_unittest.mm",
693 "cocoa/three_part_image_unittest.mm",
694 "cocoa/tracking_area_unittest.mm",
695 "models/list_model_unittest.cc",
696 "models/list_selection_model_unittest.cc",
697 "models/tree_node_model_unittest.cc",
698 "test/data/resource.h",
699 "text/bytes_formatting_unittest.cc",
700 "touch/selection_bound_unittest.cc",
701 "webui/web_ui_util_unittest.cc",
707 "ime/candidate_window_unittest.cc",
708 "ime/chromeos/character_composer_unittest.cc",
709 "ime/chromeos/composition_text_chromeos_unittest.cc",
710 "ime/input_method_base_unittest.cc",
711 "ime/input_method_chromeos_unittest.cc",
712 "ime/remote_input_method_win_unittest.cc",
713 "ime/win/imm32_manager_unittest.cc",
714 "ime/win/tsf_input_scope_unittest.cc",
716 if (is_linux && use_aura && !is_chromeos) {
717 sources += [ "ime/input_method_auralinux_unittest.cc" ]
720 sources += [ "ime/composition_text_util_pango_unittest.cc" ]
722 if (!use_x11 && is_chromeos) {
723 # These were already removed in the non-chromeos case.
724 sources -= [ "ime/input_method_chromeos_unittest.cc" ]
728 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
729 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
734 "//base/test:test_support",
741 "//ui/base:test_support",
742 "//ui/events:events_base",
743 "//ui/events:test_support",
744 "//ui/gfx:test_support",
746 "//ui/resources:ui_test_pak",
752 # TODO(GYP) lots of iOS-only steps for ui_base_unittests
756 deps += [ "//ui/base/ime" ]
761 "dragdrop/os_exchange_data_win_unittest.cc",
762 "win/hwnd_subclass_unittest.cc",
763 "win/open_file_name_win_unittest.cc",
767 "/DELAYLOAD:d2d1.dll",
768 "/DELAYLOAD:d3d10_1.dll",
779 sources += [ "view_prop_unittest.cc" ]
783 apk_deps = [ "//chrome:resources" ]
784 isolate_file = "ui_base_unittests.isolate"
788 configs += [ "//build/config/linux:pangocairo" ]
792 sources += [ "cursor/cursor_loader_x11_unittest.cc" ]
794 configs += [ "//build/config/linux:x11" ]
797 "//ui/events/platform/x11",
801 data_deps += [ "//tools/xdisplaycheck" ]
806 "//third_party/mozilla",
807 #'ui_base_tests_bundle', TODO(GYP)
811 if (use_aura || toolkit_views) {
812 sources += [ "dragdrop/os_exchange_data_unittest.cc" ]
816 "//ui/events/platform",
820 if (use_x11 && !is_chromeos) {
822 "dragdrop/os_exchange_data_provider_aurax11_unittest.cc",
823 "x/selection_requestor_unittest.cc",
830 "//ui/events:dom_keycode_converter",
834 if (is_linux || is_mac || is_win) {
835 # TODO(brettw): We should be able to depend on //ui/resources:ui_test_pak
836 # instead of depending directly on the non-test .pak files, but depending
837 # on ui_test_pak seems to have no effect.
839 "test/data/data_pack_unittest/truncated-header.pak",
840 "$root_out_dir/ui_test.pak", # TODO(brettw): remove this line.
843 "//ui/resources:ui_test_pak", # TODO(brettw): this does nothing.
844 "//third_party/mesa:osmesa",
847 if (is_linux || is_win) {
849 # TODO(brettw): Remove these two lines.
850 "$root_out_dir/ui/en-US.pak",
851 "$root_gen_dir/ui/resources/ui_resources_100_percent.pak",
855 data += [ "$root_out_dir/ui_unittests Framework.framework/" ]
857 if (is_asan && symbol_level == 0) {
858 data += [ "$root_out_dir/ui_base_unittests.dSYM/" ]
862 # TODO(GYP) Mac (ui_base_tests_bundle)