Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / events / BUILD.gn
blob21981fd65a43cb2df9d63b9bdd438cf5fded36e0
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     "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   ]
42   defines = [ "EVENTS_BASE_IMPLEMENTATION" ]
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   ]
54   forward_dependent_configs_from = [ "//ui/gfx" ]
56   if (use_x11) {
57     configs += [ "//build/config/linux:x11" ]
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   }
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   ]
85   defines = [ "EVENTS_IMPLEMENTATION" ]
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_recognizer_impl_mac.cc",
112     "gestures/gesture_types.h",
113     "win/events_win.cc",
114     "x/events_x.cc",
115   ]
117   if (use_x11) {
118     configs += [
119       "//build/config/linux:glib",
120       "//build/config/linux:x11",
121     ]
122   } else {
123     sources -= [
124       "x/events_x.cc",
125     ]
126   }
128   if (!is_chromeos && is_linux) {
129     sources += [
130       "linux/text_edit_command_auralinux.cc",
131       "linux/text_edit_command_auralinux.h",
132       "linux/text_edit_key_bindings_delegate_auralinux.cc",
133       "linux/text_edit_key_bindings_delegate_auralinux.h",
134     ]
135   }
137   if (use_ozone) {
138     sources += [
139       "ozone/events_ozone.cc",
140     ]
141   }
143   if (use_aura) {
144     sources += [
145       "gestures/gesture_provider_aura.cc",
146       "gestures/gesture_provider_aura.h",
147       "gestures/motion_event_aura.cc",
148       "gestures/motion_event_aura.h",
149       "gestures/gesture_recognizer.h",
150       "gestures/gesture_recognizer_impl.cc",
151       "gestures/gesture_recognizer_impl.h",
152     ]
153   }
155   if (is_win || is_mac || use_x11 || use_ozone) {
156     sources -= [ "events_stub.cc" ]
157   }
160 component("gesture_detection") {
161   sources = [
162     "gesture_detection/bitset_32.h",
163     "gesture_detection/filtered_gesture_provider.cc",
164     "gesture_detection/filtered_gesture_provider.h",
165     "gesture_detection/gesture_detection_export.h",
166     "gesture_detection/gesture_detector.cc",
167     "gesture_detection/gesture_detector.h",
168     "gesture_detection/gesture_event_data.cc",
169     "gesture_detection/gesture_event_data.h",
170     "gesture_detection/gesture_event_data_packet.cc",
171     "gesture_detection/gesture_event_data_packet.h",
172     "gesture_detection/gesture_config_helper.h",
173     "gesture_detection/gesture_provider.cc",
174     "gesture_detection/gesture_provider.h",
175     "gesture_detection/motion_event.cc",
176     "gesture_detection/motion_event.h",
177     "gesture_detection/motion_event_buffer.cc",
178     "gesture_detection/motion_event_buffer.h",
179     "gesture_detection/motion_event_generic.cc",
180     "gesture_detection/motion_event_generic.h",
181     "gesture_detection/scale_gesture_detector.cc",
182     "gesture_detection/scale_gesture_detector.h",
183     "gesture_detection/snap_scroll_controller.cc",
184     "gesture_detection/snap_scroll_controller.h",
185     "gesture_detection/touch_disposition_gesture_filter.cc",
186     "gesture_detection/touch_disposition_gesture_filter.h",
187     "gesture_detection/velocity_tracker_state.cc",
188     "gesture_detection/velocity_tracker_state.h",
189     "gesture_detection/velocity_tracker.cc",
190     "gesture_detection/velocity_tracker.h",
191   ]
193   deps = [
194     ":events_base",
195     "//base",
196     "//ui/gfx",
197     "//ui/gfx/geometry",
198   ]
200   defines = [ "GESTURE_DETECTION_IMPLEMENTATION" ]
202   if (is_android) {
203     sources += [ "gesture_detection/gesture_config_helper_android.cc" ]
204   } else if (use_aura) {
205     sources += [ "gesture_detection/gesture_config_helper_aura.cc" ]
206   } else {
207     sources += [ "gesture_detection/gesture_config_helper.cc" ]
208   }
211 source_set("test_support") {
212   sources = [
213     "test/cocoa_test_event_utils.h",
214     "test/cocoa_test_event_utils.mm",
215     "test/event_generator.cc",
216     "test/event_generator.h",
217     "test/events_test_utils.cc",
218     "test/events_test_utils.h",
219     "test/events_test_utils_x11.cc",
220     "test/events_test_utils_x11.h",
221     "test/mock_motion_event.cc",
222     "test/mock_motion_event.h",
223     "test/platform_event_waiter.cc",
224     "test/platform_event_waiter.h",
225     "test/test_event_handler.cc",
226     "test/test_event_handler.h",
227     "test/test_event_processor.cc",
228     "test/test_event_processor.h",
229     "test/test_event_target.cc",
230     "test/test_event_target.h",
231   ]
233   deps = [
234     "//base",
235     "//skia",
236     "//ui/events/platform",
237     "//ui/gfx/geometry",
238     ":events",
239     ":events_base",
240     ":gesture_detection",
241   ]
243   if (is_ios) {
244     sources -= [
245       "test/cocoa_test_event_utils.h",
246       "test/cocoa_test_event_utils.mm",
247     ]
248   }
250   if (!use_x11) {
251     sources -= [
252       "test/events_test_utils_x11.cc",
253       "test/events_test_utils_x11.h",
254     ]
255   }
258 test("events_unittests") {
259   sources = [
260     "cocoa/events_mac_unittest.mm",
261     "event_dispatcher_unittest.cc",
262     "event_processor_unittest.cc",
263     "event_rewriter_unittest.cc",
264     "event_unittest.cc",
265     "gesture_detection/bitset_32_unittest.cc",
266     "gesture_detection/gesture_event_data_packet_unittest.cc",
267     "gesture_detection/gesture_provider_unittest.cc",
268     "gesture_detection/motion_event_buffer_unittest.cc",
269     "gesture_detection/motion_event_generic_unittest.cc",
270     "gesture_detection/touch_disposition_gesture_filter_unittest.cc",
271     "gesture_detection/velocity_tracker_unittest.cc",
272     "keycodes/dom4/keycode_converter_unittest.cc",
273     "latency_info_unittest.cc",
274     "platform/platform_event_source_unittest.cc",
275     "x/events_x_unittest.cc",
276   ]
278   deps = [
279     ":dom4_keycode_converter",
280     ":events",
281     ":events_base",
282     ":gesture_detection",
283     ":test_support",
284     "//base",
285     "//base/test:run_all_unittests",
286     "//skia",
287     "//testing/gtest",
288     "//ui/events/platform",
289     "//ui/gfx:test_support",
290   ]
292   if (use_x11) {
293     configs += [ "//build/config/linux:x11" ]
294     deps += [ "//ui/gfx/x" ]
295   } else {
296     sources -= [
297       "x/events_x_unittest.cc",
298     ]
299   }
301   if (use_ozone) {
302     sources += [
303       "ozone/evdev/key_event_converter_evdev_unittest.cc",
304       "ozone/evdev/touch_event_converter_evdev_unittest.cc",
305     ]
306   }
308   if (use_aura) {
309     sources += [
310       "gestures/gesture_provider_aura_unittest.cc",
311     ]
312   }