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    "device_data_manager.cc",
20    "device_data_manager.h",
21    "device_hotplug_event_observer.h",
22    "event_constants.h",
23    "event_switches.cc",
24    "event_switches.h",
25    "events_base_export.h",
26    "gesture_event_details.cc",
27    "gesture_event_details.h",
28    "gestures/fling_curve.cc",
29    "gestures/fling_curve.h",
30    "gestures/gesture_configuration.cc",
31    "gestures/gesture_configuration.h",
32    "keycodes/keyboard_code_conversion.cc",
33    "keycodes/keyboard_code_conversion.h",
34    "keycodes/keyboard_code_conversion_android.cc",
35    "keycodes/keyboard_code_conversion_android.h",
36    "keycodes/keyboard_code_conversion_mac.h",
37    "keycodes/keyboard_code_conversion_mac.mm",
38    "keycodes/keyboard_code_conversion_win.cc",
39    "keycodes/keyboard_code_conversion_win.h",
40    "keycodes/keyboard_codes.h",
41    "latency_info.cc",
42    "latency_info.h",
43    "touchscreen_device.cc",
44    "touchscreen_device.h",
45  ]
46
47  defines = [ "EVENTS_BASE_IMPLEMENTATION" ]
48
49  deps = [
50    ":dom4_keycode_converter",
51    "//base/third_party/dynamic_annotations",
52    "//skia",
53  ]
54
55  public_deps = [
56    "//base",
57    "//ui/events/platform",
58    "//ui/gfx",
59    "//ui/gfx/geometry",
60  ]
61
62  if (use_x11) {
63    configs += [ "//build/config/linux:x11" ]
64
65    sources += [
66      "keycodes/keyboard_code_conversion_x.cc",
67      "keycodes/keyboard_code_conversion_x.h",
68      "x/device_data_manager_x11.cc",
69      "x/device_data_manager_x11.h",
70      "x/device_list_cache_x.cc",
71      "x/device_list_cache_x.h",
72      "x/hotplug_event_handler_x11.cc",
73      "x/hotplug_event_handler_x11.h",
74      "x/keysym_to_unicode.cc",
75      "x/keysym_to_unicode.h",
76      "x/touch_factory_x11.cc",
77      "x/touch_factory_x11.h",
78    ]
79
80    deps += [ "//ui/gfx/x" ]
81  }
82}
83
84component("events") {
85  sources = [
86    "cocoa/cocoa_event_utils.h",
87    "cocoa/cocoa_event_utils.mm",
88    "cocoa/events_mac.mm",
89    "event.cc",
90    "event.h",
91    "event_dispatcher.cc",
92    "event_dispatcher.h",
93    "event_handler.cc",
94    "event_handler.h",
95    "event_processor.cc",
96    "event_processor.h",
97    "event_rewriter.h",
98    "event_source.cc",
99    "event_source.h",
100    "event_target.cc",
101    "event_target.h",
102    "event_target_iterator.h",
103    "event_targeter.cc",
104    "event_targeter.h",
105    "event_utils.cc",
106    "event_utils.h",
107    "events_export.h",
108    "events_stub.cc",
109    "gestures/gesture_recognizer_impl_mac.cc",
110    "gestures/gesture_types.h",
111    "win/events_win.cc",
112  ]
113
114  defines = [ "EVENTS_IMPLEMENTATION" ]
115
116  public_deps = [
117    ":events_base",
118  ]
119  deps = [
120    ":dom4_keycode_converter",
121    ":gesture_detection",
122    "//base/third_party/dynamic_annotations",
123    "//skia",
124    "//ui/gfx",
125    "//ui/gfx/geometry",
126  ]
127
128  if (use_x11) {
129    sources += [ "x/events_x.cc" ]
130    configs += [
131      "//build/config/linux:glib",
132      "//build/config/linux:x11",
133    ]
134    deps += [ "//ui/gfx/x" ]
135  }
136
137  if (!is_chromeos && is_linux) {
138    sources += [
139      "linux/text_edit_command_auralinux.cc",
140      "linux/text_edit_command_auralinux.h",
141      "linux/text_edit_key_bindings_delegate_auralinux.cc",
142      "linux/text_edit_key_bindings_delegate_auralinux.h",
143    ]
144  }
145
146  if (use_ozone) {
147    sources += [
148      "ozone/events_ozone.cc",
149    ]
150  }
151
152  if (use_aura) {
153    sources += [
154      "gestures/gesture_provider_aura.cc",
155      "gestures/gesture_provider_aura.h",
156      "gestures/motion_event_aura.cc",
157      "gestures/motion_event_aura.h",
158      "gestures/gesture_recognizer.h",
159      "gestures/gesture_recognizer_impl.cc",
160      "gestures/gesture_recognizer_impl.h",
161    ]
162  }
163
164  if (is_win || is_mac || use_x11 || use_ozone) {
165    sources -= [ "events_stub.cc" ]
166  }
167}
168
169component("gesture_detection") {
170  sources = [
171    "gesture_detection/bitset_32.h",
172    "gesture_detection/filtered_gesture_provider.cc",
173    "gesture_detection/filtered_gesture_provider.h",
174    "gesture_detection/gesture_detection_export.h",
175    "gesture_detection/gesture_detector.cc",
176    "gesture_detection/gesture_detector.h",
177    "gesture_detection/gesture_event_data.cc",
178    "gesture_detection/gesture_event_data.h",
179    "gesture_detection/gesture_event_data_packet.cc",
180    "gesture_detection/gesture_event_data_packet.h",
181    "gesture_detection/gesture_config_helper.h",
182    "gesture_detection/gesture_provider.cc",
183    "gesture_detection/gesture_provider.h",
184    "gesture_detection/gesture_touch_uma_histogram.cc",
185    "gesture_detection/gesture_touch_uma_histogram.h",
186    "gesture_detection/motion_event.cc",
187    "gesture_detection/motion_event.h",
188    "gesture_detection/motion_event_buffer.cc",
189    "gesture_detection/motion_event_buffer.h",
190    "gesture_detection/motion_event_generic.cc",
191    "gesture_detection/motion_event_generic.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 (is_android) {
214    sources += [ "gesture_detection/gesture_config_helper_android.cc" ]
215  } else if (use_aura) {
216    sources += [ "gesture_detection/gesture_config_helper_aura.cc" ]
217  } else {
218    sources += [ "gesture_detection/gesture_config_helper.cc" ]
219  }
220}
221
222source_set("test_support") {
223  sources = [
224    "test/cocoa_test_event_utils.h",
225    "test/cocoa_test_event_utils.mm",
226    "test/event_generator.cc",
227    "test/event_generator.h",
228    "test/events_test_utils.cc",
229    "test/events_test_utils.h",
230    "test/mock_motion_event.cc",
231    "test/mock_motion_event.h",
232    "test/platform_event_waiter.cc",
233    "test/platform_event_waiter.h",
234    "test/test_event_handler.cc",
235    "test/test_event_handler.h",
236    "test/test_event_processor.cc",
237    "test/test_event_processor.h",
238    "test/test_event_target.cc",
239    "test/test_event_target.h",
240  ]
241
242  public_deps = [
243    ":events",
244    ":events_base",
245    ":gesture_detection",
246  ]
247  deps = [
248    "//base",
249    "//skia",
250    "//ui/events/platform",
251    "//ui/gfx/geometry",
252  ]
253
254  if (is_ios) {
255    sources -= [
256      "test/cocoa_test_event_utils.h",
257      "test/cocoa_test_event_utils.mm",
258    ]
259  }
260
261  if (use_x11) {
262    sources += [
263      "test/events_test_utils_x11.cc",
264      "test/events_test_utils_x11.h",
265    ]
266    deps += [ "//ui/gfx/x" ]
267  }
268}
269
270test("events_unittests") {
271  sources = [
272    "cocoa/events_mac_unittest.mm",
273    "event_dispatcher_unittest.cc",
274    "event_processor_unittest.cc",
275    "event_rewriter_unittest.cc",
276    "event_unittest.cc",
277    "gesture_detection/bitset_32_unittest.cc",
278    "gesture_detection/gesture_event_data_packet_unittest.cc",
279    "gesture_detection/gesture_provider_unittest.cc",
280    "gesture_detection/motion_event_buffer_unittest.cc",
281    "gesture_detection/motion_event_generic_unittest.cc",
282    "gesture_detection/touch_disposition_gesture_filter_unittest.cc",
283    "gesture_detection/velocity_tracker_unittest.cc",
284    "gestures/fling_curve_unittest.cc",
285    "keycodes/dom4/keycode_converter_unittest.cc",
286    "latency_info_unittest.cc",
287    "platform/platform_event_source_unittest.cc",
288    "x/events_x_unittest.cc",
289  ]
290
291  deps = [
292    ":dom4_keycode_converter",
293    ":events",
294    ":events_base",
295    ":gesture_detection",
296    ":test_support",
297    "//base",
298    "//base/test:run_all_unittests",
299    "//skia",
300    "//testing/gtest",
301    "//ui/events/platform",
302    "//ui/gfx:test_support",
303  ]
304
305  if (use_x11) {
306    configs += [ "//build/config/linux:x11" ]
307    deps += [ "//ui/gfx/x" ]
308  } else {
309    sources -= [
310      "x/events_x_unittest.cc",
311    ]
312  }
313
314  if (use_ozone) {
315    sources += [
316      "ozone/evdev/key_event_converter_evdev_unittest.cc",
317      "ozone/evdev/touch_event_converter_evdev_unittest.cc",
318    ]
319  }
320
321  if (use_aura) {
322    sources += [
323      "gestures/gesture_provider_aura_unittest.cc",
324    ]
325  }
326}
327