MacViews: Get c/b/ui/views/tabs to build on Mac
[chromium-blink-merge.git] / ui / events / BUILD.gn
blobc00d2e68e786f7e94cf75369cccfd1674bf92181
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     "input_device.cc",
36     "input_device.h",
37     "keyboard_device.cc",
38     "keyboard_device.h",
39     "keycodes/keyboard_code_conversion.cc",
40     "keycodes/keyboard_code_conversion.h",
41     "keycodes/keyboard_code_conversion_android.cc",
42     "keycodes/keyboard_code_conversion_android.h",
43     "keycodes/keyboard_code_conversion_mac.h",
44     "keycodes/keyboard_code_conversion_mac.mm",
45     "keycodes/keyboard_code_conversion_win.cc",
46     "keycodes/keyboard_code_conversion_win.h",
47     "keycodes/keyboard_codes.h",
48     "latency_info.cc",
49     "latency_info.h",
50     "touchscreen_device.cc",
51     "touchscreen_device.h",
52   ]
54   defines = [ "EVENTS_BASE_IMPLEMENTATION" ]
56   deps = [
57     ":dom4_keycode_converter",
58     "//base/third_party/dynamic_annotations",
59     "//skia",
60   ]
62   public_deps = [
63     "//base",
64     "//ui/events/platform",
65     "//ui/gfx",
66     "//ui/gfx/geometry",
67   ]
69   if (use_x11) {
70     configs += [ "//build/config/linux:x11" ]
72     sources += [
73       "keycodes/keyboard_code_conversion_x.cc",
74       "keycodes/keyboard_code_conversion_x.h",
75       "x/device_data_manager_x11.cc",
76       "x/device_data_manager_x11.h",
77       "x/device_list_cache_x.cc",
78       "x/device_list_cache_x.h",
79       "x/hotplug_event_handler_x11.cc",
80       "x/hotplug_event_handler_x11.h",
81       "x/keysym_to_unicode.cc",
82       "x/keysym_to_unicode.h",
83       "x/touch_factory_x11.cc",
84       "x/touch_factory_x11.h",
85     ]
87     deps += [ "//ui/gfx/x" ]
88   }
91 component("events") {
92   sources = [
93     "cocoa/cocoa_event_utils.h",
94     "cocoa/cocoa_event_utils.mm",
95     "cocoa/events_mac.mm",
96     "event.cc",
97     "event.h",
98     "event_dispatcher.cc",
99     "event_dispatcher.h",
100     "event_handler.cc",
101     "event_handler.h",
102     "event_processor.cc",
103     "event_processor.h",
104     "event_rewriter.h",
105     "event_source.cc",
106     "event_source.h",
107     "event_target.cc",
108     "event_target.h",
109     "event_target_iterator.h",
110     "event_targeter.cc",
111     "event_targeter.h",
112     "event_utils.cc",
113     "event_utils.h",
114     "events_export.h",
115     "events_stub.cc",
116     "gestures/gesture_recognizer_impl_mac.cc",
117     "gestures/gesture_types.h",
118     "win/events_win.cc",
119   ]
121   defines = [ "EVENTS_IMPLEMENTATION" ]
123   public_deps = [
124     ":events_base",
125   ]
126   deps = [
127     ":dom4_keycode_converter",
128     ":gesture_detection",
129     "//base/third_party/dynamic_annotations",
130     "//skia",
131     "//ui/gfx",
132     "//ui/gfx/geometry",
133   ]
135   if (use_x11) {
136     sources += [ "x/events_x.cc" ]
137     configs += [
138       "//build/config/linux:glib",
139       "//build/config/linux:x11",
140     ]
141     deps += [ "//ui/gfx/x" ]
142   }
144   if (!is_chromeos && is_linux) {
145     sources += [
146       "linux/text_edit_command_auralinux.cc",
147       "linux/text_edit_command_auralinux.h",
148       "linux/text_edit_key_bindings_delegate_auralinux.cc",
149       "linux/text_edit_key_bindings_delegate_auralinux.h",
150     ]
151   }
153   if (use_ozone) {
154     sources += [
155       "ozone/events_ozone.cc",
156     ]
157   }
159   if (use_aura) {
160     sources += [
161       "gestures/gesture_provider_aura.cc",
162       "gestures/gesture_provider_aura.h",
163       "gestures/motion_event_aura.cc",
164       "gestures/motion_event_aura.h",
165       "gestures/gesture_recognizer.h",
166       "gestures/gesture_recognizer_impl.cc",
167       "gestures/gesture_recognizer_impl.h",
168     ]
169   }
171   if (is_win || is_mac || use_x11 || use_ozone) {
172     sources -= [ "events_stub.cc" ]
173   }
176 component("gesture_detection") {
177   sources = [
178     "gesture_detection/bitset_32.h",
179     "gesture_detection/filtered_gesture_provider.cc",
180     "gesture_detection/filtered_gesture_provider.h",
181     "gesture_detection/gesture_config_helper.h",
182     "gesture_detection/gesture_detection_export.h",
183     "gesture_detection/gesture_detector.cc",
184     "gesture_detection/gesture_detector.h",
185     "gesture_detection/gesture_event_data.cc",
186     "gesture_detection/gesture_event_data.h",
187     "gesture_detection/gesture_event_data_packet.cc",
188     "gesture_detection/gesture_event_data_packet.h",
189     "gesture_detection/gesture_listeners.cc",
190     "gesture_detection/gesture_listeners.h",
191     "gesture_detection/gesture_provider.cc",
192     "gesture_detection/gesture_provider.h",
193     "gesture_detection/gesture_touch_uma_histogram.cc",
194     "gesture_detection/gesture_touch_uma_histogram.h",
195     "gesture_detection/motion_event.cc",
196     "gesture_detection/motion_event.h",
197     "gesture_detection/motion_event_buffer.cc",
198     "gesture_detection/motion_event_buffer.h",
199     "gesture_detection/motion_event_generic.cc",
200     "gesture_detection/motion_event_generic.h",
201     "gesture_detection/scale_gesture_detector.cc",
202     "gesture_detection/scale_gesture_detector.h",
203     "gesture_detection/scale_gesture_listeners.cc",
204     "gesture_detection/scale_gesture_listeners.h",
205     "gesture_detection/snap_scroll_controller.cc",
206     "gesture_detection/snap_scroll_controller.h",
207     "gesture_detection/touch_disposition_gesture_filter.cc",
208     "gesture_detection/touch_disposition_gesture_filter.h",
209     "gesture_detection/velocity_tracker_state.cc",
210     "gesture_detection/velocity_tracker_state.h",
211     "gesture_detection/velocity_tracker.cc",
212     "gesture_detection/velocity_tracker.h",
213   ]
215   deps = [
216     ":events_base",
217     "//base",
218     "//ui/gfx",
219     "//ui/gfx/geometry",
220   ]
222   defines = [ "GESTURE_DETECTION_IMPLEMENTATION" ]
224   if (is_android) {
225     sources += [ "gesture_detection/gesture_config_helper_android.cc" ]
226   } else if (use_aura) {
227     sources += [ "gesture_detection/gesture_config_helper_aura.cc" ]
228   } else {
229     sources += [ "gesture_detection/gesture_config_helper.cc" ]
230   }
233 source_set("test_support") {
234   sources = [
235     "test/cocoa_test_event_utils.h",
236     "test/cocoa_test_event_utils.mm",
237     "test/event_generator.cc",
238     "test/event_generator.h",
239     "test/events_test_utils.cc",
240     "test/events_test_utils.h",
241     "test/motion_event_test_utils.cc",
242     "test/motion_event_test_utils.h",
243     "test/platform_event_waiter.cc",
244     "test/platform_event_waiter.h",
245     "test/test_event_handler.cc",
246     "test/test_event_handler.h",
247     "test/test_event_processor.cc",
248     "test/test_event_processor.h",
249     "test/test_event_target.cc",
250     "test/test_event_target.h",
251   ]
253   public_deps = [
254     ":events",
255     ":events_base",
256     ":gesture_detection",
257   ]
258   deps = [
259     "//base",
260     "//skia",
261     "//ui/events/platform",
262     "//ui/gfx/geometry",
263   ]
265   if (is_ios) {
266     sources -= [
267       "test/cocoa_test_event_utils.h",
268       "test/cocoa_test_event_utils.mm",
269     ]
270   }
272   if (use_x11) {
273     sources += [
274       "test/events_test_utils_x11.cc",
275       "test/events_test_utils_x11.h",
276     ]
277     deps += [ "//ui/gfx/x" ]
278   }
281 test("events_unittests") {
282   sources = [
283     "android/scroller_unittest.cc",
284     "cocoa/events_mac_unittest.mm",
285     "event_dispatcher_unittest.cc",
286     "event_processor_unittest.cc",
287     "event_rewriter_unittest.cc",
288     "event_unittest.cc",
289     "gesture_detection/bitset_32_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/touch_disposition_gesture_filter_unittest.cc",
295     "gesture_detection/velocity_tracker_unittest.cc",
296     "gestures/fling_curve_unittest.cc",
297     "keycodes/dom4/keycode_converter_unittest.cc",
298     "latency_info_unittest.cc",
299     "platform/platform_event_source_unittest.cc",
300     "x/device_data_manager_x11_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/platform",
315     "//ui/gfx:test_support",
316   ]
318   if (use_x11) {
319     configs += [ "//build/config/linux:x11" ]
320     deps += [ "//ui/gfx/x" ]
321   } else {
322     sources -= [
323       "x/device_data_manager_x11_unittest.cc",
324       "x/events_x_unittest.cc",
325     ]
326   }
328   if (use_ozone) {
329     sources += [
330       "ozone/evdev/key_event_converter_evdev_unittest.cc",
331       "ozone/evdev/touch_event_converter_evdev_unittest.cc",
332     ]
333   }
335   if (use_aura) {
336     sources += [
337       "gestures/gesture_provider_aura_unittest.cc",
338     ]
339   }