Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / base / 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 if (is_android) {
8   import("//build/config/android/config.gni")
9 }
10
11 component("ui_base") {
12   sources = [
13     "accelerators/accelerator.cc",
14     "accelerators/accelerator.h",
15     "accelerators/accelerator_manager.cc",
16     "accelerators/accelerator_manager.h",
17     "accelerators/menu_label_accelerator_util_linux.cc",
18     "accelerators/menu_label_accelerator_util_linux.h",
19     "accelerators/platform_accelerator.h",
20     "accelerators/platform_accelerator_cocoa.h",
21     "accelerators/platform_accelerator_cocoa.mm",
22     "android/ui_base_jni_registrar.cc",
23     "android/ui_base_jni_registrar.h",
24     "android/view_android.cc",
25     "android/view_android.h",
26     "android/window_android.cc",
27     "android/window_android.h",
28     "android/window_android_compositor.h",
29     "android/window_android_observer.h",
30     "base_window.cc",
31     "base_window.h",
32     "clipboard/clipboard.cc",
33     "clipboard/clipboard.h",
34     "clipboard/clipboard_android.cc",
35     "clipboard/clipboard_android_initialization.h",
36     "clipboard/clipboard_aura.cc",
37     "clipboard/clipboard_aurax11.cc",
38     "clipboard/clipboard_constants.cc",
39     "clipboard/clipboard_mac.mm",
40     "clipboard/clipboard_types.h",
41     "clipboard/clipboard_util_win.cc",
42     "clipboard/clipboard_util_win.h",
43     "clipboard/clipboard_win.cc",
44     "clipboard/custom_data_helper.cc",
45     "clipboard/custom_data_helper.h",
46     "clipboard/custom_data_helper_linux.cc",
47     "clipboard/custom_data_helper_mac.mm",
48     "clipboard/scoped_clipboard_writer.cc",
49     "clipboard/scoped_clipboard_writer.h",
50     "cocoa/animation_utils.h",
51     "cocoa/appkit_utils.h",
52     "cocoa/appkit_utils.mm",
53     "cocoa/base_view.h",
54     "cocoa/base_view.mm",
55     "cocoa/cocoa_base_utils.h",
56     "cocoa/cocoa_base_utils.mm",
57     "cocoa/controls/blue_label_button.h",
58     "cocoa/controls/blue_label_button.mm",
59     "cocoa/controls/hover_image_menu_button.h",
60     "cocoa/controls/hover_image_menu_button.mm",
61     "cocoa/controls/hover_image_menu_button_cell.h",
62     "cocoa/controls/hover_image_menu_button_cell.mm",
63     "cocoa/controls/hyperlink_button_cell.h",
64     "cocoa/controls/hyperlink_button_cell.mm",
65     "cocoa/find_pasteboard.h",
66     "cocoa/find_pasteboard.mm",
67     "cocoa/flipped_view.h",
68     "cocoa/flipped_view.mm",
69     "cocoa/focus_tracker.h",
70     "cocoa/focus_tracker.mm",
71     "cocoa/focus_window_set.h",
72     "cocoa/focus_window_set.mm",
73     "cocoa/fullscreen_window_manager.h",
74     "cocoa/fullscreen_window_manager.mm",
75     "cocoa/hover_button.h",
76     "cocoa/hover_button.mm",
77     "cocoa/hover_image_button.h",
78     "cocoa/hover_image_button.mm",
79     "cocoa/menu_controller.h",
80     "cocoa/menu_controller.mm",
81     "cocoa/nib_loading.h",
82     "cocoa/nib_loading.mm",
83     "cocoa/nsgraphics_context_additions.h",
84     "cocoa/nsgraphics_context_additions.mm",
85     "cocoa/tracking_area.h",
86     "cocoa/tracking_area.mm",
87     "cocoa/underlay_opengl_hosting_window.h",
88     "cocoa/underlay_opengl_hosting_window.mm",
89     "cocoa/view_description.h",
90     "cocoa/view_description.mm",
91     "cocoa/window_size_constants.h",
92     "cocoa/window_size_constants.mm",
93     "cursor/cursor.cc",
94     "cursor/cursor.h",
95     "cursor/cursor_android.cc",
96     "cursor/cursor_loader.h",
97     "cursor/cursor_loader_win.cc",
98     "cursor/cursor_loader_win.h",
99     "cursor/cursor_loader_x11.cc",
100     "cursor/cursor_loader_x11.h",
101     "cursor/cursor_mac.mm",
102     "cursor/cursor_util.cc",
103     "cursor/cursor_util.h",
104     "cursor/cursor_win.cc",
105     "cursor/cursor_x11.cc",
106     "cursor/cursors_aura.cc",
107     "cursor/cursors_aura.h",
108     "default_theme_provider.cc",
109     "default_theme_provider.h",
110     "default_theme_provider_mac.mm",
111     "device_form_factor_android.cc",
112     "device_form_factor_android.h",
113     "device_form_factor_desktop.cc",
114     "device_form_factor_ios.mm",
115     "device_form_factor.h",
116     "dragdrop/cocoa_dnd_util.h",
117     "dragdrop/cocoa_dnd_util.mm",
118     "dragdrop/drag_drop_types.h",
119     "dragdrop/drag_drop_types.h",
120     "dragdrop/drag_drop_types_win.cc",
121     "dragdrop/drag_source_win.cc",
122     "dragdrop/drag_source_win.h",
123     "dragdrop/drag_utils.cc",
124     "dragdrop/drag_utils.h",
125     "dragdrop/drag_utils_aura.cc",
126     "dragdrop/drag_utils_win.cc",
127     "dragdrop/drop_target_event.cc",
128     "dragdrop/drop_target_event.h",
129     "dragdrop/drop_target_win.cc",
130     "dragdrop/drop_target_win.h",
131     "dragdrop/file_info.cc",
132     "dragdrop/file_info.h",
133     "dragdrop/os_exchange_data.cc",
134     "dragdrop/os_exchange_data.h",
135     "dragdrop/os_exchange_data_provider_aura.cc",
136     "dragdrop/os_exchange_data_provider_aura.h",
137     "dragdrop/os_exchange_data_provider_aurax11.cc",
138     "dragdrop/os_exchange_data_provider_aurax11.h",
139     "dragdrop/os_exchange_data_provider_win.cc",
140     "dragdrop/os_exchange_data_provider_win.h",
141     "hit_test.h",
142     "l10n/formatter.cc",
143     "l10n/formatter.h",
144     "l10n/l10n_font_util.cc",
145     "l10n/l10n_font_util.h",
146     "l10n/l10n_util.cc",
147     "l10n/l10n_util.h",
148     "l10n/l10n_util_android.cc",
149     "l10n/l10n_util_android.h",
150     "l10n/l10n_util_collator.h",
151     "l10n/l10n_util_mac.h",
152     "l10n/l10n_util_mac.mm",
153     "l10n/l10n_util_plurals.cc",
154     "l10n/l10n_util_plurals.h",
155     "l10n/l10n_util_posix.cc",
156     "l10n/l10n_util_win.cc",
157     "l10n/l10n_util_win.h",
158     "l10n/time_format.cc",
159     "l10n/time_format.h",
160     "layout.cc",
161     "layout.h",
162     "layout_mac.mm",
163     "models/button_menu_item_model.cc",
164     "models/button_menu_item_model.h",
165     "models/combobox_model.cc",
166     "models/combobox_model.h",
167     "models/combobox_model_observer.h",
168     "models/dialog_model.cc",
169     "models/dialog_model.h",
170     "models/list_model.h",
171     "models/list_model_observer.h",
172     "models/list_selection_model.cc",
173     "models/list_selection_model.h",
174     "models/menu_model.cc",
175     "models/menu_model.h",
176     "models/menu_model_delegate.h",
177     "models/menu_separator_types.h",
178     "models/simple_menu_model.cc",
179     "models/simple_menu_model.h",
180     "models/table_model.cc",
181     "models/table_model.h",
182     "models/table_model_observer.h",
183     "models/tree_model.cc",
184     "models/tree_model.h",
185     "models/tree_node_iterator.h",
186     "models/tree_node_model.h",
187     "nine_image_painter_factory.cc",
188     "nine_image_painter_factory.h",
189     "resource/data_pack.cc",
190     "resource/data_pack.h",
191     "resource/resource_bundle.cc",
192     "resource/resource_bundle.h",
193     "resource/resource_bundle_android.cc",
194     "resource/resource_bundle_auralinux.cc",
195     "resource/resource_bundle_ios.mm",
196     "resource/resource_bundle_mac.mm",
197     "resource/resource_bundle_win.cc",
198     "resource/resource_bundle_win.h",
199     "resource/resource_data_dll_win.cc",
200     "resource/resource_data_dll_win.h",
201     "resource/resource_handle.h",
202     "text/bytes_formatting.cc",
203     "text/bytes_formatting.h",
204     "theme_provider.cc",
205     "theme_provider.h",
206     "touch/touch_device.cc",
207     "touch/touch_device.h",
208     "touch/touch_device_android.cc",
209     "touch/touch_device_aurax11.cc",
210     "touch/touch_device_ozone.cc",
211     "touch/touch_device_win.cc",
212     "touch/touch_editing_controller.cc",
213     "touch/touch_editing_controller.h",
214     "touch/touch_enabled.cc",
215     "touch/touch_enabled.h",
216     "ui_base_exports.cc",
217     "ui_base_paths.cc",
218     "ui_base_paths.h",
219     "ui_base_switches.cc",
220     "ui_base_switches.h",
221     "ui_base_switches_util.cc",
222     "ui_base_switches_util.h",
223     "ui_base_types.cc",
224     "ui_base_types.h",
225     "ui_base_export.h",
226     "view_prop.cc",
227     "view_prop.h",
228     # TODO(tfarina): Uncomment these when http://crbug.com/367591 is fixed.
229     #"webui/jstemplate_builder.cc",
230     #"webui/jstemplate_builder.h",
231     #"webui/web_ui_util.cc",
232     #"webui/web_ui_util.h",
233     "win/accessibility_ids_win.h",
234     "win/accessibility_misc_utils.cc",
235     "win/accessibility_misc_utils.h",
236     "win/atl_module.h",
237     "win/dpi_setup.cc",
238     "win/dpi_setup.h",
239     "win/foreground_helper.cc",
240     "win/foreground_helper.h",
241     "win/hidden_window.cc",
242     "win/hidden_window.h",
243     "win/hwnd_subclass.cc",
244     "win/hwnd_subclass.h",
245     "win/internal_constants.cc",
246     "win/internal_constants.h",
247     "win/lock_state.cc",
248     "win/lock_state.h",
249     "win/message_box_win.cc",
250     "win/message_box_win.h",
251     "win/mouse_wheel_util.cc",
252     "win/mouse_wheel_util.h",
253     "win/scoped_ole_initializer.cc",
254     "win/scoped_ole_initializer.h",
255     "win/shell.cc",
256     "win/shell.h",
257     "win/touch_input.cc",
258     "win/touch_input.h",
259     "win/window_event_target.cc",
260     "win/window_event_target.h",
261     "window_open_disposition.cc",
262     "window_open_disposition.h",
263     "work_area_watcher_observer.h",
264     "x/selection_owner.cc",
265     "x/selection_owner.h",
266     "x/selection_requestor.cc",
267     "x/selection_requestor.h",
268     "x/selection_utils.cc",
269     "x/selection_utils.h",
270     "x/x11_menu_list.cc",
271     "x/x11_menu_list.h",
272     "x/x11_util.cc",
273     "x/x11_util.h",
274     "x/x11_util_internal.h",
275   ]
276
277   defines = [ "UI_BASE_IMPLEMENTATION" ]
278
279   deps = [
280     "//base",
281     "//base/third_party/dynamic_annotations",
282     "//base:base_static",
283     "//base:i18n",
284     "//net",
285     "//skia",
286     "//third_party/icu",
287     "//ui/base/strings",
288     "//ui/resources",
289     "//url",
290   ]
291
292   if (is_ios) {
293     sources += [
294       "l10n/l10n_util_mac.h",
295       "l10n/l10n_util_mac.mm",
296     ]
297   }
298
299   if (toolkit_views) {
300     deps += [
301       "//ui/events",
302     ]
303   }
304
305   if (use_aura) {
306     deps += [
307       "//ui/events",
308     ]
309   } else {
310     sources -= [
311       "cursor/cursor.cc",
312       "cursor/cursor.h",
313       "cursor/cursor_loader_x11.cc",
314       "cursor/cursor_loader_x11.h",
315       "cursor/cursor_mac.mm",
316       "cursor/cursor_x11.cc",
317       "x/selection_owner.cc",
318       "x/selection_owner.h",
319       "x/selection_requestor.cc",
320       "x/selection_requestor.h",
321       "x/selection_utils.cc",
322       "x/selection_utils.h",
323     ]
324   }
325
326   if (!use_aura || !is_linux) {
327     sources -= [
328       "resource/resource_bundle_auralinux.cc",
329     ]
330   }
331
332   if (use_aura && is_win) {
333     sources -= [
334       "dragdrop/drag_utils_aura.cc",
335     ]
336   }
337
338   if (is_linux) {
339     configs += [
340       "//build/config/linux:fontconfig",
341       "//build/config/linux:glib",
342     ]
343   }
344
345   if ((is_linux && !is_chromeos) || is_chromeos) {
346     if (!toolkit_views && !use_aura) {
347       sources -= [
348         "dragdrop/drag_utils.cc",
349         "dragdrop/drag_utils.h",
350       ]
351     }
352   }
353
354   if (use_pango) {
355     configs += [
356       "//build/config/linux:pangocairo",
357     ]
358   }
359   if (is_win || use_clipboard_aurax11) {
360     sources -= [
361       "clipboard/clipboard_aura.cc",
362     ]
363   } else {
364     sources -= [
365       "clipboard/clipboard_aurax11.cc",
366     ]
367   }
368
369   if (is_chromeos || (use_aura && is_linux && !use_x11)) {
370     sources -= [
371       "dragdrop/os_exchange_data_provider_aurax11.cc",
372       "touch/touch_device.cc",
373     ]
374   } else {
375     sources -= [
376       "dragdrop/os_exchange_data_provider_aura.cc",
377       "dragdrop/os_exchange_data_provider_aura.h",
378       "touch/touch_device_aurax11.cc",
379     ]
380   }
381
382   libs = []
383   if (is_win) {
384     deps += [
385       "//third_party/wtl",
386     ]
387     sources -= [
388       "touch/touch_device.cc",
389     ]
390     cflags = [
391       "/wd4267",  # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int.
392       "/wd4324",  # Structure was padded due to __declspec(align()), which is
393                   # uninteresting.
394     ]
395     ldflags = [
396       "/DELAYLOAD:d2d1.dll",
397       "/DELAYLOAD:d3d10_1.dll",
398       "/DELAYLOAD:dwmapi.dll",
399     ]
400     libs += [
401       "d2d1.lib",
402       "d3d10_1.lib",
403       "dwmapi.lib",
404       "imm32.lib",
405       "d2d1.lib",
406       "dwmapi.lib",
407       "oleacc.lib",
408     ]
409   } else {
410     if (!use_aura) {
411       sources -= [
412         "view_prop.cc",
413         "view_prop.h",
414       ]
415     }
416   }
417
418   if (is_mac) {
419     deps += [
420       #TODO(tfarina): port this third_party component to GN.
421       #"//third_party/mozilla",
422     ]
423
424     sources -= [
425       "dragdrop/drag_utils.cc",
426       "dragdrop/drag_utils.h",
427     ]
428
429     libs += [
430       "Accelerate.framework",
431       "AudioUnit.framework",
432       "CoreView.framework",
433     ]
434   }
435
436   if (use_x11) {
437     #'all_dependent_settings': {
438       #'ldflags': [
439         #'-L<(PRODUCT_DIR)',
440       #],
441     #},
442     configs += [
443       "//build/config/linux:x11"
444     ]
445   }
446
447   if (!toolkit_views) {
448     sources -= [
449       "dragdrop/drag_drop_types.h",
450       "dragdrop/drop_target_event.cc",
451       "dragdrop/drop_target_event.h",
452       "dragdrop/os_exchange_data.cc",
453       "dragdrop/os_exchange_data.h",
454       "nine_image_painter_factory.cc",
455       "nine_image_painter_factory.h",
456     ]
457   }
458
459   if (is_android) {
460     sources -= [
461       "default_theme_provider.cc",
462       "dragdrop/drag_utils.cc",
463       "dragdrop/drag_utils.h",
464       "l10n/l10n_font_util.cc",
465       "models/button_menu_item_model.cc",
466       "models/dialog_model.cc",
467       "theme_provider.cc",
468       "touch/touch_device.cc",
469       "touch/touch_editing_controller.cc",
470       "ui_base_types.cc",
471     ]
472
473     deps += [
474       #":ui_base_jni_headers",
475     ]
476
477     libs += [
478       "jnigraphics",
479     ]
480   }
481
482   if (is_android && is_android_webview_build) {
483     deps += [
484       #TODO(GYP): port this component to GN.
485       #"//ui/android:ui_java",
486     ]
487   }
488
489   if (is_android && !use_aura) {
490     sources -= [
491       "cursor/cursor_android.cc",
492     ]
493   }
494
495   if (is_android && use_aura) {
496     sources -= [
497       "clipboard/clipboard_aura.cc",
498     ]
499   }
500
501   if (is_android || is_ios) {
502     sources -= [
503       "device_form_factor_desktop.cc",
504     ]
505   }
506
507   # TODO(GYP): Port this to GN.
508   #if (use_system_icu) {
509     # When using the system icu, the icu targets generate shim headers
510     # which are included by public headers in the ui target, so we need
511     # ui to be a hard dependency for all its users.
512     #'hard_dependency': 1,
513   #}
514 }
515
516 source_set("ui_base_test_support") {
517   sources = [
518     "test/ui_controls.h",
519     "test/ui_controls_aura.cc",
520     "test/ui_controls_internal_win.cc",
521     "test/ui_controls_internal_win.h",
522     "test/ui_controls_mac.mm",
523     "test/ui_controls_win.cc",
524   ]
525
526   deps = [
527     "//base",
528     "//skia",
529     "//testing/gtest",
530     "//ui/gfx",
531     "//ui/gfx/geometry",
532   ]
533
534   if (!is_ios) {
535     sources += [
536       "ime/dummy_input_method.cc",
537       "ime/dummy_input_method.h",
538       "ime/dummy_text_input_client.cc",
539       "ime/dummy_text_input_client.h",
540     ]
541   }
542 }