Upstream version 8.37.180.0
[platform/framework/web/crosswalk.git] / src / ui / events / BUILD.gn
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
5 import("//build/config/ui.gni")
6
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   ]
13
14   deps = [ "//base" ]
15 }
16
17 component("events_base") {
18   sources = [
19     "event_constants.h",
20     "event_switches.cc",
21     "event_switches.h",
22     "events_base_export.h",
23     "gesture_event_details.cc",
24     "gesture_event_details.h",
25     "gestures/gesture_configuration.cc",
26     "gestures/gesture_configuration.h",
27     "keycodes/keyboard_code_conversion.cc",
28     "keycodes/keyboard_code_conversion.h",
29     "keycodes/keyboard_code_conversion_android.cc",
30     "keycodes/keyboard_code_conversion_android.h",
31     "keycodes/keyboard_code_conversion_mac.h",
32     "keycodes/keyboard_code_conversion_mac.mm",
33     "keycodes/keyboard_code_conversion_win.cc",
34     "keycodes/keyboard_code_conversion_win.h",
35     "keycodes/keyboard_codes.h",
36     "latency_info.cc",
37     "latency_info.h",
38   ]
39
40   defines = [ "EVENTS_BASE_IMPLEMENTATION" ]
41
42   deps = [
43     ":dom4_keycode_converter",
44     "//base",
45     "//base/third_party/dynamic_annotations",
46     "//skia",
47     "//ui/events/platform",
48     "//ui/gfx",
49     "//ui/gfx/geometry",
50   ]
51
52   if (use_x11) {
53     configs += [ "//build/config/linux:x11" ]
54
55     sources += [
56       "keycodes/keyboard_code_conversion_x.cc",
57       "keycodes/keyboard_code_conversion_x.h",
58       "x/device_data_manager.cc",
59       "x/device_data_manager.h",
60       "x/device_list_cache_x.cc",
61       "x/device_list_cache_x.h",
62       "x/touch_factory_x11.cc",
63       "x/touch_factory_x11.h",
64     ]
65   }
66 }
67
68 component("events") {
69   deps = [
70     ":dom4_keycode_converter",
71     ":events_base",
72     ":gesture_detection",
73     "//skia",
74     "//ui/gfx",
75     "//ui/gfx/geometry",
76   ]
77
78   defines = [ "EVENTS_IMPLEMENTATION" ]
79
80   sources = [
81     "cocoa/cocoa_event_utils.h",
82     "cocoa/cocoa_event_utils.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_point.cc",
104     "gestures/gesture_point.h",
105     "gestures/gesture_recognizer.h",
106     "gestures/gesture_recognizer_impl.cc",
107     "gestures/gesture_recognizer_impl.h",
108     "gestures/gesture_recognizer_impl_mac.cc",
109     "gestures/gesture_sequence.cc",
110     "gestures/gesture_sequence.h",
111     "gestures/gesture_types.h",
112     "gestures/unified_gesture_detector_enabled.cc",
113     "gestures/unified_gesture_detector_enabled.h",
114     "gestures/velocity_calculator.cc",
115     "gestures/velocity_calculator.h",
116     "platform/x11/x11_event_source.cc",
117     "platform/x11/x11_event_source.h",
118     "win/events_win.cc",
119     "x/events_x.cc",
120   ]
121
122   if (use_x11) {
123     configs += [
124       "//build/config/linux:glib",
125       "//build/config/linux:x11",
126     ]
127   } else {
128     sources -= [
129       "platform/x11/x11_event_source.cc",
130       "platform/x11/x11_event_source.h",
131       "x/events_x.cc",
132     ]
133   }
134
135   if (!is_chromeos && is_linux) {
136     sources += [
137       "linux/text_edit_command_auralinux.cc",
138       "linux/text_edit_command_auralinux.h",
139       "linux/text_edit_key_bindings_delegate_auralinux.cc",
140       "linux/text_edit_key_bindings_delegate_auralinux.h",
141     ]
142   }
143
144   if (use_ozone) {
145     sources += [
146       "ozone/device/udev/device_manager_udev.cc",
147       "ozone/device/udev/device_manager_udev.h",
148       "ozone/evdev/event_converter_evdev.cc",
149       "ozone/evdev/event_converter_evdev.h",
150       "ozone/evdev/event_device_info.cc",
151       "ozone/evdev/event_device_info.h",
152       "ozone/evdev/event_factory_evdev.cc",
153       "ozone/evdev/event_factory_evdev.h",
154       "ozone/evdev/event_modifiers_evdev.cc",
155       "ozone/evdev/event_modifiers_evdev.h",
156       "ozone/evdev/key_event_converter_evdev.cc",
157       "ozone/evdev/key_event_converter_evdev.h",
158       "ozone/evdev/touch_event_converter_evdev.cc",
159       "ozone/evdev/touch_event_converter_evdev.h",
160       "ozone/event_factory_ozone.cc",
161       "ozone/event_factory_ozone.h",
162       "ozone/events_ozone.cc",
163     ]
164   }
165
166   if (use_aura) {
167     sources += [
168       "gestures/gesture_provider_aura.cc",
169       "gestures/gesture_provider_aura.h",
170       "gestures/motion_event_aura.cc",
171       "gestures/motion_event_aura.h",
172     ]
173   }
174
175   if (is_win || use_x11 || use_ozone) {
176     sources -= [ "events_stub.cc" ]
177   }
178 }
179
180 component("gesture_detection") {
181   sources = [
182     "gesture_detection/bitset_32.h",
183     "gesture_detection/filtered_gesture_provider.cc",
184     "gesture_detection/filtered_gesture_provider.h",
185     "gesture_detection/gesture_detection_export.h",
186     "gesture_detection/gesture_detector.cc",
187     "gesture_detection/gesture_detector.h",
188     "gesture_detection/gesture_event_data.cc",
189     "gesture_detection/gesture_event_data.h",
190     "gesture_detection/gesture_event_data_packet.cc",
191     "gesture_detection/gesture_event_data_packet.h",
192     "gesture_detection/gesture_config_helper.h",
193     "gesture_detection/gesture_provider.cc",
194     "gesture_detection/gesture_provider.h",
195     "gesture_detection/motion_event.h",
196     "gesture_detection/scale_gesture_detector.cc",
197     "gesture_detection/scale_gesture_detector.h",
198     "gesture_detection/snap_scroll_controller.cc",
199     "gesture_detection/snap_scroll_controller.h",
200     "gesture_detection/touch_disposition_gesture_filter.cc",
201     "gesture_detection/touch_disposition_gesture_filter.h",
202     "gesture_detection/velocity_tracker_state.cc",
203     "gesture_detection/velocity_tracker_state.h",
204     "gesture_detection/velocity_tracker.cc",
205     "gesture_detection/velocity_tracker.h",
206   ]
207
208   deps = [
209     ":events_base",
210     "//base",
211     "//ui/gfx",
212     "//ui/gfx/geometry",
213   ]
214
215   defines = [ "GESTURE_DETECTION_IMPLEMENTATION" ]
216
217   if (is_android) {
218     sources += [ "gesture_detection/gesture_config_helper_android.cc" ]
219   } else if (use_aura) {
220     sources += [ "gesture_detection/gesture_config_helper_aura.cc" ]
221   } else {
222     sources += [ "gesture_detection/gesture_config_helper.cc" ]
223   }
224 }
225
226 source_set("events_test_support") {
227   sources = [
228     "test/cocoa_test_event_utils.h",
229     "test/cocoa_test_event_utils.mm",
230     "test/events_test_utils.cc",
231     "test/events_test_utils.h",
232     "test/events_test_utils_x11.cc",
233     "test/events_test_utils_x11.h",
234     "test/platform_event_waiter.cc",
235     "test/platform_event_waiter.h",
236     "test/test_event_handler.cc",
237     "test/test_event_handler.h",
238     "test/test_event_processor.cc",
239     "test/test_event_processor.h",
240     "test/test_event_target.cc",
241     "test/test_event_target.h",
242   ]
243
244   deps = [
245     "//skia",
246     ":events_base",
247     ":events",
248   ]
249
250   if (is_ios) {
251     sources -= [
252       "test/cocoa_test_event_utils.h",
253       "test/cocoa_test_event_utils.mm",
254     ]
255   }
256
257   if (use_x11) {
258     configs += [ "//build/config/linux:x11" ]
259   } else {
260     sources -= [
261       "test/events_test_utils_x11.cc",
262       "test/events_test_utils_x11.h",
263     ]
264   }
265 }
266
267 test("events_unittests") {
268   sources = [
269     "cocoa/events_mac_unittest.mm",
270     "event_dispatcher_unittest.cc",
271     "event_processor_unittest.cc",
272     "event_rewriter_unittest.cc",
273     "event_unittest.cc",
274     "gestures/velocity_calculator_unittest.cc",
275     "gesture_detection/bitset_32_unittest.cc",
276     "gesture_detection/gesture_provider_unittest.cc",
277     "gesture_detection/mock_motion_event.h",
278     "gesture_detection/mock_motion_event.cc",
279     "gesture_detection/velocity_tracker_unittest.cc",
280     "gesture_detection/touch_disposition_gesture_filter_unittest.cc",
281     "keycodes/dom4/keycode_converter_unittest.cc",
282     "latency_info_unittest.cc",
283     "platform/platform_event_source_unittest.cc",
284     "x/events_x_unittest.cc",
285   ]
286
287   if (!use_x11) {
288     sources -= [
289       "x/events_x_unittest.cc",
290     ]
291   }
292
293   if (use_ozone) {
294     sources += [
295       "ozone/evdev/key_event_converter_evdev_unittest.cc",
296       "ozone/evdev/touch_event_converter_evdev_unittest.cc",
297     ]
298   }
299
300   deps = [
301     ":events",
302     ":events_base",
303     ":events_test_support",
304     ":gesture_detection",
305     "//base",
306     "//base/test:run_all_unittests",
307     "//skia",
308     "//testing/gtest",
309     "//ui/gfx:gfx_test_support",
310   ]
311 }