Upstream version 9.38.198.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     "device_data_manager.cc",
20     "device_data_manager.h",
21     "event_constants.h",
22     "event_switches.cc",
23     "event_switches.h",
24     "events_base_export.h",
25     "gesture_event_details.cc",
26     "gesture_event_details.h",
27     "gestures/gesture_configuration.cc",
28     "gestures/gesture_configuration.h",
29     "keycodes/keyboard_code_conversion.cc",
30     "keycodes/keyboard_code_conversion.h",
31     "keycodes/keyboard_code_conversion_android.cc",
32     "keycodes/keyboard_code_conversion_android.h",
33     "keycodes/keyboard_code_conversion_mac.h",
34     "keycodes/keyboard_code_conversion_mac.mm",
35     "keycodes/keyboard_code_conversion_win.cc",
36     "keycodes/keyboard_code_conversion_win.h",
37     "keycodes/keyboard_codes.h",
38     "latency_info.cc",
39     "latency_info.h",
40   ]
41
42   defines = [ "EVENTS_BASE_IMPLEMENTATION" ]
43
44   deps = [
45     ":dom4_keycode_converter",
46     "//base",
47     "//base/third_party/dynamic_annotations",
48     "//skia",
49     "//ui/events/platform",
50     "//ui/gfx",
51     "//ui/gfx/geometry",
52   ]
53
54   forward_dependent_configs_from = [ "//ui/gfx" ]
55
56   if (use_x11) {
57     configs += [ "//build/config/linux:x11" ]
58
59     sources += [
60       "keycodes/keyboard_code_conversion_x.cc",
61       "keycodes/keyboard_code_conversion_x.h",
62       "x/device_data_manager_x11.cc",
63       "x/device_data_manager_x11.h",
64       "x/device_list_cache_x.cc",
65       "x/device_list_cache_x.h",
66       "x/keysym_to_unicode.cc",
67       "x/keysym_to_unicode.h",
68       "x/touch_factory_x11.cc",
69       "x/touch_factory_x11.h",
70     ]
71   }
72 }
73
74 component("events") {
75   deps = [
76     ":dom4_keycode_converter",
77     ":events_base",
78     ":gesture_detection",
79     "//base/third_party/dynamic_annotations",
80     "//skia",
81     "//ui/gfx",
82     "//ui/gfx/geometry",
83   ]
84
85   defines = [ "EVENTS_IMPLEMENTATION" ]
86
87   sources = [
88     "cocoa/cocoa_event_utils.h",
89     "cocoa/cocoa_event_utils.mm",
90     "cocoa/events_mac.mm",
91     "event.cc",
92     "event.h",
93     "event_dispatcher.cc",
94     "event_dispatcher.h",
95     "event_handler.cc",
96     "event_handler.h",
97     "event_processor.cc",
98     "event_processor.h",
99     "event_rewriter.h",
100     "event_source.cc",
101     "event_source.h",
102     "event_target.cc",
103     "event_target.h",
104     "event_target_iterator.h",
105     "event_targeter.cc",
106     "event_targeter.h",
107     "event_utils.cc",
108     "event_utils.h",
109     "events_export.h",
110     "events_stub.cc",
111     "gestures/gesture_point.cc",
112     "gestures/gesture_point.h",
113     "gestures/gesture_recognizer_impl_mac.cc",
114     "gestures/gesture_sequence.cc",
115     "gestures/gesture_sequence.h",
116     "gestures/gesture_types.h",
117     "gestures/unified_gesture_detector_enabled.cc",
118     "gestures/unified_gesture_detector_enabled.h",
119     "gestures/velocity_calculator.cc",
120     "gestures/velocity_calculator.h",
121     "win/events_win.cc",
122     "x/events_x.cc",
123   ]
124
125   if (use_x11) {
126     configs += [
127       "//build/config/linux:glib",
128       "//build/config/linux:x11",
129     ]
130   } else {
131     sources -= [
132       "x/events_x.cc",
133     ]
134   }
135
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   }
144
145   if (use_ozone) {
146     sources += [
147       "ozone/events_ozone.cc",
148     ]
149   }
150
151   if (use_aura) {
152     sources += [
153       "gestures/gesture_provider_aura.cc",
154       "gestures/gesture_provider_aura.h",
155       "gestures/motion_event_aura.cc",
156       "gestures/motion_event_aura.h",
157       "gestures/gesture_recognizer.h",
158       "gestures/gesture_recognizer_impl.cc",
159       "gestures/gesture_recognizer_impl.h",
160     ]
161   }
162
163   if (is_win || is_mac || use_x11 || use_ozone) {
164     sources -= [ "events_stub.cc" ]
165   }
166 }
167
168 component("gesture_detection") {
169   sources = [
170     "gesture_detection/bitset_32.h",
171     "gesture_detection/filtered_gesture_provider.cc",
172     "gesture_detection/filtered_gesture_provider.h",
173     "gesture_detection/gesture_detection_export.h",
174     "gesture_detection/gesture_detector.cc",
175     "gesture_detection/gesture_detector.h",
176     "gesture_detection/gesture_event_data.cc",
177     "gesture_detection/gesture_event_data.h",
178     "gesture_detection/gesture_event_data_packet.cc",
179     "gesture_detection/gesture_event_data_packet.h",
180     "gesture_detection/gesture_config_helper.h",
181     "gesture_detection/gesture_provider.cc",
182     "gesture_detection/gesture_provider.h",
183     "gesture_detection/motion_event.cc",
184     "gesture_detection/motion_event.h",
185     "gesture_detection/motion_event_buffer.cc",
186     "gesture_detection/motion_event_buffer.h",
187     "gesture_detection/motion_event_generic.cc",
188     "gesture_detection/motion_event_generic.h",
189     "gesture_detection/scale_gesture_detector.cc",
190     "gesture_detection/scale_gesture_detector.h",
191     "gesture_detection/snap_scroll_controller.cc",
192     "gesture_detection/snap_scroll_controller.h",
193     "gesture_detection/touch_disposition_gesture_filter.cc",
194     "gesture_detection/touch_disposition_gesture_filter.h",
195     "gesture_detection/velocity_tracker_state.cc",
196     "gesture_detection/velocity_tracker_state.h",
197     "gesture_detection/velocity_tracker.cc",
198     "gesture_detection/velocity_tracker.h",
199   ]
200
201   deps = [
202     ":events_base",
203     "//base",
204     "//ui/gfx",
205     "//ui/gfx/geometry",
206   ]
207
208   defines = [ "GESTURE_DETECTION_IMPLEMENTATION" ]
209
210   if (is_android) {
211     sources += [ "gesture_detection/gesture_config_helper_android.cc" ]
212   } else if (use_aura) {
213     sources += [ "gesture_detection/gesture_config_helper_aura.cc" ]
214   } else {
215     sources += [ "gesture_detection/gesture_config_helper.cc" ]
216   }
217 }
218
219 source_set("test_support") {
220   sources = [
221     "test/cocoa_test_event_utils.h",
222     "test/cocoa_test_event_utils.mm",
223     "test/event_generator.cc",
224     "test/event_generator.h",
225     "test/events_test_utils.cc",
226     "test/events_test_utils.h",
227     "test/events_test_utils_x11.cc",
228     "test/events_test_utils_x11.h",
229     "test/mock_motion_event.cc",
230     "test/mock_motion_event.h",
231     "test/platform_event_waiter.cc",
232     "test/platform_event_waiter.h",
233     "test/test_event_handler.cc",
234     "test/test_event_handler.h",
235     "test/test_event_processor.cc",
236     "test/test_event_processor.h",
237     "test/test_event_target.cc",
238     "test/test_event_target.h",
239   ]
240
241   deps = [
242     "//base",
243     "//skia",
244     "//ui/events/platform",
245     "//ui/gfx/geometry",
246     ":events",
247     ":events_base",
248     ":gesture_detection",
249   ]
250
251   if (is_ios) {
252     sources -= [
253       "test/cocoa_test_event_utils.h",
254       "test/cocoa_test_event_utils.mm",
255     ]
256   }
257
258   if (!use_x11) {
259     sources -= [
260       "test/events_test_utils_x11.cc",
261       "test/events_test_utils_x11.h",
262     ]
263   }
264 }
265
266 test("events_unittests") {
267   sources = [
268     "cocoa/events_mac_unittest.mm",
269     "event_dispatcher_unittest.cc",
270     "event_processor_unittest.cc",
271     "event_rewriter_unittest.cc",
272     "event_unittest.cc",
273     "gestures/velocity_calculator_unittest.cc",
274     "gesture_detection/bitset_32_unittest.cc",
275     "gesture_detection/gesture_event_data_packet_unittest.cc",
276     "gesture_detection/gesture_provider_unittest.cc",
277     "gesture_detection/motion_event_buffer_unittest.cc",
278     "gesture_detection/motion_event_generic_unittest.cc",
279     "gesture_detection/touch_disposition_gesture_filter_unittest.cc",
280     "gesture_detection/velocity_tracker_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   deps = [
288     ":dom4_keycode_converter",
289     ":events",
290     ":events_base",
291     ":gesture_detection",
292     ":test_support",
293     "//base",
294     "//base/test:run_all_unittests",
295     "//skia",
296     "//testing/gtest",
297     "//ui/events/platform",
298     "//ui/gfx:test_support",
299   ]
300
301   if (use_x11) {
302     configs += [ "//build/config/linux:x11" ]
303     deps += [ "//ui/gfx/x" ]
304   } else {
305     sources -= [
306       "x/events_x_unittest.cc",
307     ]
308   }
309
310   if (use_ozone) {
311     sources += [
312       "ozone/evdev/key_event_converter_evdev_unittest.cc",
313       "ozone/evdev/touch_event_converter_evdev_unittest.cc",
314     ]
315   }
316
317   if (use_aura) {
318     sources += [
319       "gestures/gesture_provider_aura_unittest.cc",
320     ]
321   }
322 }