Chromecast on Android buildfix: don't try to create a RendererFactory.
[chromium-blink-merge.git] / ui / events / BUILD.gn
blob805392e9a1a6775df294a053b476dbb7e987f127
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/dom3/dom_code.h",
10     "keycodes/dom3/dom_key.h",
11     "keycodes/dom3/dom_key_data.h",
12     "keycodes/dom4/keycode_converter.cc",
13     "keycodes/dom4/keycode_converter.h",
14     "keycodes/dom4/keycode_converter_data.h",
15   ]
17   deps = [
18     "//base",
19   ]
22 component("events_base") {
23   sources = [
24     "android/scroller.cc",
25     "android/scroller.h",
26     "event_constants.h",
27     "event_switches.cc",
28     "event_switches.h",
29     "events_base_export.h",
30     "gesture_curve.h",
31     "gesture_event_details.cc",
32     "gesture_event_details.h",
33     "gestures/fling_curve.cc",
34     "gestures/fling_curve.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   ]
48   defines = [ "EVENTS_BASE_IMPLEMENTATION" ]
50   deps = [
51     ":dom4_keycode_converter",
52     "//base/third_party/dynamic_annotations",
53     "//skia",
54   ]
56   public_deps = [
57     "//base",
58     "//ui/events/platform",
59     "//ui/gfx",
60     "//ui/gfx/geometry",
61   ]
63   if (use_x11) {
64     configs += [ "//build/config/linux:x11" ]
66     sources += [
67       "keycodes/keyboard_code_conversion_x.cc",
68       "keycodes/keyboard_code_conversion_x.h",
69       "x/keysym_to_unicode.cc",
70       "x/keysym_to_unicode.h",
71     ]
73     deps += [ "//ui/gfx/x" ]
74   }
77 component("events") {
78   sources = [
79     "cocoa/cocoa_event_utils.h",
80     "cocoa/cocoa_event_utils.mm",
81     "cocoa/events_mac.mm",
82     "event.cc",
83     "event.h",
84     "event_dispatcher.cc",
85     "event_dispatcher.h",
86     "event_handler.cc",
87     "event_handler.h",
88     "event_processor.cc",
89     "event_processor.h",
90     "event_rewriter.h",
91     "event_source.cc",
92     "event_source.h",
93     "event_target.cc",
94     "event_target.h",
95     "event_target_iterator.h",
96     "event_targeter.cc",
97     "event_targeter.h",
98     "event_utils.cc",
99     "event_utils.h",
100     "events_export.h",
101     "events_stub.cc",
102     "gestures/gesture_recognizer_impl_mac.cc",
103     "gestures/gesture_types.h",
104     "win/events_win.cc",
105   ]
107   defines = [ "EVENTS_IMPLEMENTATION" ]
109   public_deps = [
110     ":events_base",
111   ]
112   deps = [
113     ":dom4_keycode_converter",
114     ":gesture_detection",
115     "//base/third_party/dynamic_annotations",
116     "//skia",
117     "//ui/gfx",
118     "//ui/gfx/geometry",
119   ]
121   if (use_x11) {
122     sources += [ "x/events_x.cc" ]
123     configs += [
124       "//build/config/linux:glib",
125       "//build/config/linux:x11",
126     ]
127     deps += [
128       "//ui/events/devices",
129       "//ui/gfx/x",
130     ]
131   }
133   if (!is_chromeos && is_linux) {
134     sources += [
135       "linux/text_edit_command_auralinux.cc",
136       "linux/text_edit_command_auralinux.h",
137       "linux/text_edit_key_bindings_delegate_auralinux.cc",
138       "linux/text_edit_key_bindings_delegate_auralinux.h",
139     ]
140   }
142   if (use_ozone) {
143     sources += [ "ozone/events_ozone.cc" ]
144     deps += [ "//ui/events/ozone:events_ozone_layout" ]
145   }
147   if (use_aura) {
148     sources += [
149       "gestures/gesture_provider_aura.cc",
150       "gestures/gesture_provider_aura.h",
151       "gestures/motion_event_aura.cc",
152       "gestures/motion_event_aura.h",
153       "gestures/gesture_recognizer.h",
154       "gestures/gesture_recognizer_impl.cc",
155       "gestures/gesture_recognizer_impl.h",
156     ]
157   }
159   if (is_win || is_mac || use_x11 || use_ozone) {
160     sources -= [ "events_stub.cc" ]
161   }
164 component("gesture_detection") {
165   sources = [
166     "gesture_detection/bitset_32.h",
167     "gesture_detection/filtered_gesture_provider.cc",
168     "gesture_detection/filtered_gesture_provider.h",
169     "gesture_detection/gesture_configuration.cc",
170     "gesture_detection/gesture_configuration.h",
171     "gesture_detection/gesture_detection_export.h",
172     "gesture_detection/gesture_detector.cc",
173     "gesture_detection/gesture_detector.h",
174     "gesture_detection/gesture_event_data.cc",
175     "gesture_detection/gesture_event_data.h",
176     "gesture_detection/gesture_event_data_packet.cc",
177     "gesture_detection/gesture_event_data_packet.h",
178     "gesture_detection/gesture_listeners.cc",
179     "gesture_detection/gesture_listeners.h",
180     "gesture_detection/gesture_provider.cc",
181     "gesture_detection/gesture_provider.h",
182     "gesture_detection/gesture_provider_config_helper.cc",
183     "gesture_detection/gesture_provider_config_helper.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/scale_gesture_listeners.cc",
195     "gesture_detection/scale_gesture_listeners.h",
196     "gesture_detection/snap_scroll_controller.cc",
197     "gesture_detection/snap_scroll_controller.h",
198     "gesture_detection/touch_disposition_gesture_filter.cc",
199     "gesture_detection/touch_disposition_gesture_filter.h",
200     "gesture_detection/velocity_tracker_state.cc",
201     "gesture_detection/velocity_tracker_state.h",
202     "gesture_detection/velocity_tracker.cc",
203     "gesture_detection/velocity_tracker.h",
204   ]
206   deps = [
207     ":events_base",
208     "//base",
209     "//base/third_party/dynamic_annotations",
210     "//ui/gfx",
211     "//ui/gfx/geometry",
212   ]
214   defines = [ "GESTURE_DETECTION_IMPLEMENTATION" ]
216   if (is_android) {
217     sources += [ "gesture_detection/gesture_configuration_android.cc" ]
218   } else if (use_aura) {
219     sources += [ "gesture_detection/gesture_configuration_aura.cc" ]
220   } else {
221     sources += [ "gesture_detection/gesture_configuration_default.cc" ]
222   }
225 source_set("test_support") {
226   sources = [
227     "test/cocoa_test_event_utils.h",
228     "test/cocoa_test_event_utils.mm",
229     "test/event_generator.cc",
230     "test/event_generator.h",
231     "test/events_test_utils.cc",
232     "test/events_test_utils.h",
233     "test/motion_event_test_utils.cc",
234     "test/motion_event_test_utils.h",
235     "test/platform_event_waiter.cc",
236     "test/platform_event_waiter.h",
237     "test/test_event_handler.cc",
238     "test/test_event_handler.h",
239     "test/test_event_processor.cc",
240     "test/test_event_processor.h",
241     "test/test_event_target.cc",
242     "test/test_event_target.h",
243   ]
245   public_deps = [
246     ":events",
247     ":events_base",
248     ":gesture_detection",
249   ]
250   deps = [
251     "//base",
252     "//skia",
253     "//ui/events/platform",
254     "//ui/gfx/geometry",
255   ]
257   if (is_ios) {
258     sources -= [
259       "test/cocoa_test_event_utils.h",
260       "test/cocoa_test_event_utils.mm",
261     ]
262   }
264   if (use_x11) {
265     sources += [
266       "test/events_test_utils_x11.cc",
267       "test/events_test_utils_x11.h",
268     ]
269     deps += [
270       "//ui/events/devices",
271       "//ui/gfx/x",
272     ]
273   }
276 test("events_unittests") {
277   sources = [
278     "android/scroller_unittest.cc",
279     "cocoa/events_mac_unittest.mm",
280     "devices/x11/device_data_manager_x11_unittest.cc",
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/filtered_gesture_provider_unittest.cc",
287     "gesture_detection/gesture_event_data_packet_unittest.cc",
288     "gesture_detection/gesture_provider_unittest.cc",
289     "gesture_detection/motion_event_buffer_unittest.cc",
290     "gesture_detection/motion_event_generic_unittest.cc",
291     "gesture_detection/snap_scroll_controller_unittest.cc",
292     "gesture_detection/touch_disposition_gesture_filter_unittest.cc",
293     "gesture_detection/velocity_tracker_unittest.cc",
294     "gestures/fling_curve_unittest.cc",
295     "keycodes/dom4/keycode_converter_unittest.cc",
296     "latency_info_unittest.cc",
297     "platform/platform_event_source_unittest.cc",
298     "x/events_x_unittest.cc",
299   ]
301   deps = [
302     ":dom4_keycode_converter",
303     ":events",
304     ":events_base",
305     ":gesture_detection",
306     ":test_support",
307     "//base",
308     "//base/test:run_all_unittests",
309     "//skia",
310     "//testing/gtest",
311     "//ui/events/devices",
312     "//ui/events/platform",
313     "//ui/gfx:test_support",
314   ]
316   include_dirs = [ "//testing/gmock/include" ]
318   if (use_x11) {
319     configs += [ "//build/config/linux:x11" ]
320     deps += [ "//ui/gfx/x" ]
321   } else {
322     sources -= [
323       "devices/x11/device_data_manager_x11_unittest.cc",
324       "x/events_x_unittest.cc",
325     ]
326   }
328   if (use_ozone) {
329     sources += [
330       "ozone/chromeos/cursor_controller_unittest.cc",
331       "ozone/evdev/event_converter_evdev_impl_unittest.cc",
332       "ozone/evdev/input_injector_evdev_unittest.cc",
333       "ozone/evdev/tablet_event_converter_evdev_unittest.cc",
334       "ozone/evdev/touch_event_converter_evdev_unittest.cc",
335       "ozone/layout/xkb/xkb_keyboard_layout_engine_unittest.cc",
336     ]
337     deps += [
338       "//ui/events/ozone:events_ozone",
339       "//ui/events/ozone:events_ozone_evdev",
340       "//ui/events/ozone:events_ozone_layout",
341     ]
342   }
344   if (use_aura) {
345     sources += [ "gestures/gesture_provider_aura_unittest.cc" ]
346   }