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