BUILD.gn revision a02191e04bc25c4935f804f2c080ae28663d096d
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.
4
5import("//build/config/ui.gni")
6
7static_library("dom4_keycode_converter") {
8  sources = [
9    "keycodes/dom4/keycode_converter.cc",
10    "keycodes/dom4/keycode_converter.h",
11    "keycodes/dom4/keycode_converter_data.h",
12  ]
13
14  deps = [ "//base" ]
15}
16
17component("events_base") {
18  sources = [
19    "event_constants.h",
20    "event_switches.cc",
21    "event_switches.h",
22    "events_base_export.h",
23    "gesture_event_details.cc",
24    "gesture_event_details.h",
25    "keycodes/keyboard_code_conversion.cc",
26    "keycodes/keyboard_code_conversion.h",
27    "keycodes/keyboard_code_conversion_android.cc",
28    "keycodes/keyboard_code_conversion_android.h",
29    "keycodes/keyboard_code_conversion_mac.h",
30    "keycodes/keyboard_code_conversion_mac.mm",
31    "keycodes/keyboard_code_conversion_win.cc",
32    "keycodes/keyboard_code_conversion_win.h",
33    "keycodes/keyboard_codes.h",
34    "latency_info.cc",
35    "latency_info.h",
36  ]
37
38  defines = [ "EVENTS_BASE_IMPLEMENTATION" ]
39
40  deps = [
41    ":dom4_keycode_converter",
42    "//base",
43    "//base/third_party/dynamic_annotations",
44    "//ui/gfx/geometry",
45  ]
46
47  if (use_x11) {
48    configs += [ "//build/config/linux:x11" ]
49
50    sources += [
51      "keycodes/keyboard_code_conversion_x.cc",
52      "keycodes/keyboard_code_conversion_x.h",
53      "x/device_data_manager.cc",
54      "x/device_data_manager.h",
55      "x/device_list_cache_x.cc",
56      "x/device_list_cache_x.h",
57      "x/touch_factory_x11.cc",
58      "x/touch_factory_x11.h",
59    ]
60  }
61}
62
63component("events") {
64  deps = [
65    ":dom4_keycode_converter",
66    ":events_base",
67    "//skia",
68    "//ui/gfx",
69    "//ui/gfx/geometry",
70  ]
71
72  defines = [ "EVENTS_IMPLEMENTATION" ]
73
74  sources = [
75    "cocoa/cocoa_event_utils.h",
76    "cocoa/cocoa_event_utils.mm",
77    "event.cc",
78    "event.h",
79    "event_dispatcher.cc",
80    "event_dispatcher.h",
81    "event_handler.cc",
82    "event_handler.h",
83    "event_processor.cc",
84    "event_processor.h",
85    "event_rewriter.h",
86    "event_source.cc",
87    "event_source.h",
88    "event_target.cc",
89    "event_target.h",
90    "event_target_iterator.h",
91    "event_targeter.cc",
92    "event_targeter.h",
93    "event_utils.cc",
94    "event_utils.h",
95    "events_export.h",
96    "events_stub.cc",
97    "gestures/gesture_configuration.cc",
98    "gestures/gesture_configuration.h",
99    "gestures/gesture_point.cc",
100    "gestures/gesture_point.h",
101    "gestures/gesture_recognizer.h",
102    "gestures/gesture_recognizer_impl.cc",
103    "gestures/gesture_recognizer_impl.h",
104    "gestures/gesture_sequence.cc",
105    "gestures/gesture_sequence.h",
106    "gestures/gesture_types.h",
107    "gestures/velocity_calculator.cc",
108    "gestures/velocity_calculator.h",
109    "platform/platform_event_dispatcher.h",
110    "platform/platform_event_observer.h",
111    "platform/platform_event_source.cc",
112    "platform/platform_event_source.h",
113    "platform/platform_event_source_stub.cc",
114    "platform/platform_event_types.h",
115    "platform/scoped_event_dispatcher.cc",
116    "platform/scoped_event_dispatcher.h",
117    "platform/x11/x11_event_source.cc",
118    "platform/x11/x11_event_source.h",
119    "win/events_win.cc",
120    "x/events_x.cc",
121  ]
122
123  if (use_x11) {
124    configs += [
125      "//build/config/linux:glib",
126      "//build/config/linux:x11",
127    ]
128  } else {
129    sources -= [
130      "platform/x11/x11_event_source.cc",
131      "platform/x11/x11_event_source.h",
132      "x/events_x.cc",
133    ]
134  }
135
136  if (!is_chromeos && is_linux) {
137    sources += [
138      "linux/text_edit_command_auralinux.cc",
139      "linux/text_edit_command_auralinux.h",
140      "linux/text_edit_key_bindings_delegate_auralinux.cc",
141      "linux/text_edit_key_bindings_delegate_auralinux.h",
142    ]
143  }
144
145  if (use_ozone) {
146    sources += [
147      "ozone/evdev/device_manager_evdev.cc",
148      "ozone/evdev/device_manager_evdev.h",
149      "ozone/evdev/device_manager_udev.cc",
150      "ozone/evdev/device_manager_udev.h",
151      "ozone/evdev/event_converter_evdev.cc",
152      "ozone/evdev/event_converter_evdev.h",
153      "ozone/evdev/event_device_info.cc",
154      "ozone/evdev/event_device_info.h",
155      "ozone/evdev/event_factory_evdev.cc",
156      "ozone/evdev/event_factory_evdev.h",
157      "ozone/evdev/event_modifiers_evdev.cc",
158      "ozone/evdev/event_modifiers_evdev.h",
159      "ozone/evdev/key_event_converter_evdev.cc",
160      "ozone/evdev/key_event_converter_evdev.h",
161      "ozone/evdev/touch_event_converter_evdev.cc",
162      "ozone/evdev/touch_event_converter_evdev.h",
163      "ozone/event_factory_ozone.cc",
164      "ozone/event_factory_ozone.h",
165      "ozone/events_ozone.cc",
166    ]
167  }
168
169  if (is_win || use_x11 || use_ozone) {
170    sources -= [ "events_stub.cc" ]
171  }
172}
173
174component("gesture_detection") {
175  sources = [
176    "gesture_detection/bitset_32.h",
177    "gesture_detection/filtered_gesture_provider.cc",
178    "gesture_detection/filtered_gesture_provider.h",
179    "gesture_detection/gesture_detection_export.h",
180    "gesture_detection/gesture_detector.cc",
181    "gesture_detection/gesture_detector.h",
182    "gesture_detection/gesture_event_data.cc",
183    "gesture_detection/gesture_event_data.h",
184    "gesture_detection/gesture_event_data_packet.cc",
185    "gesture_detection/gesture_event_data_packet.h",
186    "gesture_detection/gesture_config_helper.h",
187    "gesture_detection/gesture_config_helper_aura.cc",
188    "gesture_detection/gesture_config_helper_android.cc",
189    "gesture_detection/gesture_provider.cc",
190    "gesture_detection/gesture_provider.h",
191    "gesture_detection/motion_event.h",
192    "gesture_detection/scale_gesture_detector.cc",
193    "gesture_detection/scale_gesture_detector.h",
194    "gesture_detection/snap_scroll_controller.cc",
195    "gesture_detection/snap_scroll_controller.h",
196    "gesture_detection/touch_disposition_gesture_filter.cc",
197    "gesture_detection/touch_disposition_gesture_filter.h",
198    "gesture_detection/velocity_tracker_state.cc",
199    "gesture_detection/velocity_tracker_state.h",
200    "gesture_detection/velocity_tracker.cc",
201    "gesture_detection/velocity_tracker.h",
202  ]
203
204  deps = [
205    ":events_base",
206    "//base",
207    "//ui/gfx",
208    "//ui/gfx/geometry",
209  ]
210
211  defines = [ "GESTURE_DETECTION_IMPLEMENTATION" ]
212
213  if (use_aura) {
214    deps += [ ":events" ]
215  }
216
217  if (!use_aura && !is_android) {
218    sources -= [ "gesture_detection/gesture_config_helper.cc" ]
219  }
220}
221
222source_set("events_test_support") {
223  sources = [
224    "test/cocoa_test_event_utils.h",
225    "test/cocoa_test_event_utils.mm",
226    "test/events_test_utils.cc",
227    "test/events_test_utils.h",
228    "test/events_test_utils_x11.cc",
229    "test/events_test_utils_x11.h",
230    "test/platform_event_waiter.cc",
231    "test/platform_event_waiter.h",
232    "test/test_event_handler.cc",
233    "test/test_event_handler.h",
234    "test/test_event_processor.cc",
235    "test/test_event_processor.h",
236    "test/test_event_target.cc",
237    "test/test_event_target.h",
238  ]
239
240  deps = [
241    ":events_base",
242    ":events",
243  ]
244
245  if (is_ios) {
246    sources -= [
247      "test/cocoa_test_event_utils.h",
248      "test/cocoa_test_event_utils.mm",
249    ]
250  }
251
252  if (use_x11) {
253    configs += [ "//build/config/linux:x11" ]
254  } else {
255    sources -= [
256      "test/events_test_utils_x11.cc",
257      "test/events_test_utils_x11.h",
258    ]
259  }
260}
261
262test("events_unittest") {
263  sources = [
264    "cocoa/cocoa_event_utils_unittest.mm",
265    "event_dispatcher_unittest.cc",
266    "event_processor_unittest.cc",
267    "event_rewriter_unittest.cc",
268    "event_unittest.cc",
269    "gestures/velocity_calculator_unittest.cc",
270    "gesture_detection/bitset_32_unittest.cc",
271    "gesture_detection/gesture_provider_unittest.cc",
272    "gesture_detection/mock_motion_event.h",
273    "gesture_detection/mock_motion_event.cc",
274    "gesture_detection/velocity_tracker_unittest.cc",
275    "gesture_detection/touch_disposition_gesture_filter_unittest.cc",
276    "keycodes/dom4/keycode_converter_unittest.cc",
277    "latency_info_unittest.cc",
278    "platform/platform_event_source_unittest.cc",
279    "x/events_x_unittest.cc",
280  ]
281
282  if (!use_x11) {
283    sources -= [
284      "x/events_x_unittest.cc",
285    ]
286  }
287
288  if (use_ozone) {
289    sources += [
290      "ozone/evdev/key_event_converter_evdev_unittest.cc",
291      "ozone/evdev/touch_event_converter_evdev_unittest.cc",
292    ]
293  }
294
295  deps = [
296    ":events",
297    ":events_base",
298    ":events_test_support",
299    ":gesture_detection",
300    "//base",
301    "//base/test:run_all_unittests",
302    "//testing/gtest",
303  ]
304}
305