x11: Use scoped_ptr<> for X11 objects where it makes sense.
[chromium-blink-merge.git] / ui / events / BUILD.gn
blobc856716fc29b5cf6ca3105726157bdc19be16b97
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")
8 static_library("dom4_keycode_converter") {
9   sources = [
10     "keycodes/dom3/dom_code.h",
11     "keycodes/dom3/dom_key.h",
12     "keycodes/dom3/dom_key_data.h",
13     "keycodes/dom4/keycode_converter.cc",
14     "keycodes/dom4/keycode_converter.h",
15     "keycodes/dom4/keycode_converter_data.h",
16   ]
18   deps = [
19     "//base",
20   ]
23 component("events_base") {
24   sources = [
25     "android/scroller.cc",
26     "android/scroller.h",
27     "event_constants.h",
28     "event_switches.cc",
29     "event_switches.h",
30     "events_base_export.h",
31     "gesture_curve.h",
32     "gesture_event_details.cc",
33     "gesture_event_details.h",
34     "gestures/fling_curve.cc",
35     "gestures/fling_curve.h",
36     "keycodes/keyboard_code_conversion.cc",
37     "keycodes/keyboard_code_conversion.h",
38     "keycodes/keyboard_code_conversion_android.cc",
39     "keycodes/keyboard_code_conversion_android.h",
40     "keycodes/keyboard_code_conversion_mac.h",
41     "keycodes/keyboard_code_conversion_mac.mm",
42     "keycodes/keyboard_code_conversion_win.cc",
43     "keycodes/keyboard_code_conversion_win.h",
44     "keycodes/keyboard_codes.h",
45     "latency_info.cc",
46     "latency_info.h",
47   ]
49   defines = [ "EVENTS_BASE_IMPLEMENTATION" ]
51   deps = [
52     ":dom4_keycode_converter",
53     "//base/third_party/dynamic_annotations",
54     "//skia",
55   ]
57   public_deps = [
58     "//base",
59     "//ui/events/platform",
60     "//ui/gfx",
61     "//ui/gfx/geometry",
62   ]
64   if (use_x11) {
65     configs += [ "//build/config/linux:x11" ]
67     sources += [
68       "keycodes/keyboard_code_conversion_x.cc",
69       "keycodes/keyboard_code_conversion_x.h",
70       "x/keysym_to_unicode.cc",
71       "x/keysym_to_unicode.h",
72     ]
74     deps += [ "//ui/gfx/x" ]
75   }
78 component("events") {
79   sources = [
80     "cocoa/cocoa_event_utils.h",
81     "cocoa/cocoa_event_utils.mm",
82     "cocoa/events_mac.mm",
83     "event.cc",
84     "event.h",
85     "event_dispatcher.cc",
86     "event_dispatcher.h",
87     "event_handler.cc",
88     "event_handler.h",
89     "event_processor.cc",
90     "event_processor.h",
91     "event_rewriter.h",
92     "event_source.cc",
93     "event_source.h",
94     "event_target.cc",
95     "event_target.h",
96     "event_target_iterator.h",
97     "event_targeter.cc",
98     "event_targeter.h",
99     "event_utils.cc",
100     "event_utils.h",
101     "events_export.h",
102     "events_stub.cc",
103     "gestures/gesture_recognizer_impl_mac.cc",
104     "gestures/gesture_types.h",
105     "null_event_targeter.cc",
106     "null_event_targeter.h",
107     "win/events_win.cc",
108   ]
110   defines = [ "EVENTS_IMPLEMENTATION" ]
112   public_deps = [
113     ":events_base",
114   ]
115   deps = [
116     ":dom4_keycode_converter",
117     ":gesture_detection",
118     "//base/third_party/dynamic_annotations",
119     "//skia",
120     "//ui/gfx",
121     "//ui/gfx/geometry",
122   ]
124   if (use_x11) {
125     sources += [ "x/events_x.cc" ]
126     configs += [
127       "//build/config/linux:glib",
128       "//build/config/linux:x11",
129     ]
130     deps += [
131       "//ui/events/devices",
132       "//ui/gfx/x",
133     ]
134   }
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   }
145   if (use_ozone) {
146     sources += [ "ozone/events_ozone.cc" ]
147     deps += [ "//ui/events/ozone:events_ozone_layout" ]
148   }
150   if (use_aura) {
151     sources += [
152       "gestures/gesture_provider_aura.cc",
153       "gestures/gesture_provider_aura.h",
154       "gestures/gesture_recognizer.h",
155       "gestures/gesture_recognizer_impl.cc",
156       "gestures/gesture_recognizer_impl.h",
157       "gestures/motion_event_aura.cc",
158       "gestures/motion_event_aura.h",
159     ]
160   }
162   if (is_win || is_mac || use_x11 || use_ozone) {
163     sources -= [ "events_stub.cc" ]
164   }
167 component("gesture_detection") {
168   sources = [
169     "gesture_detection/bitset_32.h",
170     "gesture_detection/filtered_gesture_provider.cc",
171     "gesture_detection/filtered_gesture_provider.h",
172     "gesture_detection/gesture_configuration.cc",
173     "gesture_detection/gesture_configuration.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_listeners.cc",
182     "gesture_detection/gesture_listeners.h",
183     "gesture_detection/gesture_provider.cc",
184     "gesture_detection/gesture_provider.h",
185     "gesture_detection/gesture_provider_config_helper.cc",
186     "gesture_detection/gesture_provider_config_helper.h",
187     "gesture_detection/gesture_touch_uma_histogram.cc",
188     "gesture_detection/gesture_touch_uma_histogram.h",
189     "gesture_detection/motion_event.cc",
190     "gesture_detection/motion_event.h",
191     "gesture_detection/motion_event_buffer.cc",
192     "gesture_detection/motion_event_buffer.h",
193     "gesture_detection/motion_event_generic.cc",
194     "gesture_detection/motion_event_generic.h",
195     "gesture_detection/scale_gesture_detector.cc",
196     "gesture_detection/scale_gesture_detector.h",
197     "gesture_detection/scale_gesture_listeners.cc",
198     "gesture_detection/scale_gesture_listeners.h",
199     "gesture_detection/snap_scroll_controller.cc",
200     "gesture_detection/snap_scroll_controller.h",
201     "gesture_detection/touch_disposition_gesture_filter.cc",
202     "gesture_detection/touch_disposition_gesture_filter.h",
203     "gesture_detection/velocity_tracker.cc",
204     "gesture_detection/velocity_tracker.h",
205     "gesture_detection/velocity_tracker_state.cc",
206     "gesture_detection/velocity_tracker_state.h",
207   ]
209   deps = [
210     ":events_base",
211     "//base",
212     "//base/third_party/dynamic_annotations",
213     "//ui/gfx",
214     "//ui/gfx/geometry",
215   ]
217   defines = [ "GESTURE_DETECTION_IMPLEMENTATION" ]
219   if (is_android) {
220     sources += [ "gesture_detection/gesture_configuration_android.cc" ]
221   } else if (use_aura) {
222     sources += [ "gesture_detection/gesture_configuration_aura.cc" ]
223   } else {
224     sources += [ "gesture_detection/gesture_configuration_default.cc" ]
225   }
228 source_set("test_support") {
229   sources = [
230     "test/cocoa_test_event_utils.h",
231     "test/cocoa_test_event_utils.mm",
232     "test/event_generator.cc",
233     "test/event_generator.h",
234     "test/events_test_utils.cc",
235     "test/events_test_utils.h",
236     "test/motion_event_test_utils.cc",
237     "test/motion_event_test_utils.h",
238     "test/platform_event_waiter.cc",
239     "test/platform_event_waiter.h",
240     "test/test_event_handler.cc",
241     "test/test_event_handler.h",
242     "test/test_event_processor.cc",
243     "test/test_event_processor.h",
244     "test/test_event_target.cc",
245     "test/test_event_target.h",
246   ]
248   public_deps = [
249     ":events",
250     ":events_base",
251     ":gesture_detection",
252   ]
253   deps = [
254     "//base",
255     "//skia",
256     "//ui/events/platform",
257     "//ui/gfx/geometry",
258   ]
260   if (is_ios) {
261     sources -= [
262       "test/cocoa_test_event_utils.h",
263       "test/cocoa_test_event_utils.mm",
264     ]
265   }
267   if (use_x11) {
268     sources += [
269       "test/events_test_utils_x11.cc",
270       "test/events_test_utils_x11.h",
271     ]
272     deps += [
273       "//ui/events/devices",
274       "//ui/gfx/x",
275     ]
276   }
279 test("events_unittests") {
280   sources = [
281     "android/scroller_unittest.cc",
282     "cocoa/events_mac_unittest.mm",
283     "devices/x11/device_data_manager_x11_unittest.cc",
284     "event_dispatcher_unittest.cc",
285     "event_processor_unittest.cc",
286     "event_rewriter_unittest.cc",
287     "event_unittest.cc",
288     "gesture_detection/bitset_32_unittest.cc",
289     "gesture_detection/filtered_gesture_provider_unittest.cc",
290     "gesture_detection/gesture_event_data_packet_unittest.cc",
291     "gesture_detection/gesture_provider_unittest.cc",
292     "gesture_detection/motion_event_buffer_unittest.cc",
293     "gesture_detection/motion_event_generic_unittest.cc",
294     "gesture_detection/snap_scroll_controller_unittest.cc",
295     "gesture_detection/touch_disposition_gesture_filter_unittest.cc",
296     "gesture_detection/velocity_tracker_unittest.cc",
297     "gestures/fling_curve_unittest.cc",
298     "keycodes/dom4/keycode_converter_unittest.cc",
299     "latency_info_unittest.cc",
300     "platform/platform_event_source_unittest.cc",
301     "x/events_x_unittest.cc",
302   ]
304   deps = [
305     ":dom4_keycode_converter",
306     ":events",
307     ":events_base",
308     ":gesture_detection",
309     ":test_support",
310     "//base",
311     "//base/test:run_all_unittests",
312     "//skia",
313     "//testing/gtest",
314     "//ui/events/devices",
315     "//ui/events/platform",
316     "//ui/gfx:test_support",
317   ]
319   include_dirs = [ "//testing/gmock/include" ]
321   if (use_x11) {
322     configs += [ "//build/config/linux:x11" ]
323     deps += [ "//ui/gfx/x" ]
324   } else {
325     sources -= [
326       "devices/x11/device_data_manager_x11_unittest.cc",
327       "x/events_x_unittest.cc",
328     ]
329   }
331   if (use_ozone) {
332     sources += [
333       "ozone/chromeos/cursor_controller_unittest.cc",
334       "ozone/evdev/event_converter_evdev_impl_unittest.cc",
335       "ozone/evdev/event_converter_test_util.cc",
336       "ozone/evdev/input_injector_evdev_unittest.cc",
337       "ozone/evdev/tablet_event_converter_evdev_unittest.cc",
338       "ozone/evdev/touch_event_converter_evdev_unittest.cc",
339       "ozone/layout/xkb/xkb_keyboard_layout_engine_unittest.cc",
340     ]
341     deps += [
342       "//ui/events/ozone:events_ozone",
343       "//ui/events/ozone:events_ozone_evdev",
344       "//ui/events/ozone:events_ozone_layout",
345     ]
346   }
348   if (use_aura) {
349     sources += [ "gestures/gesture_provider_aura_unittest.cc" ]
350   }
353 if (is_nacl) {
354   source_set("latency_info") {
355     sources = [
356       "ipc/latency_info_param_traits.cc",
357       "ipc/latency_info_param_traits.h",
358       "latency_info.cc",
359       "latency_info.h",
360     ]
361   }