GoogleURLTrackerInfoBarDelegate: Initialize uninitialized member in constructor.
[chromium-blink-merge.git] / ui / gfx / BUILD.gn
blob798644f6854765364aaa3f515630d0842c2a10d6
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 if (is_android) {
8   import("//build/config/android/config.gni")
9   import("//build/config/android/rules.gni")
11 if (use_ozone) {
12   import("//ui/ozone/ozone.gni")
15 # Several targets want to include this header file, and some of them are
16 # child dependencies of "gfx". Therefore, we separate it out here so multiple
17 # targets can all have a dependency for header checking purposes without
18 # creating circular dependencies.
19 source_set("gfx_export") {
20   sources = [
21     "gfx_export.h",
22   ]
25 component("gfx") {
26   sources = [
27     "android/device_display_info.cc",
28     "android/device_display_info.h",
29     "android/gfx_jni_registrar.cc",
30     "android/gfx_jni_registrar.h",
31     "android/java_bitmap.cc",
32     "android/java_bitmap.h",
33     "android/scroller.cc",
34     "android/scroller.h",
35     "android/shared_device_display_info.cc",
36     "android/shared_device_display_info.h",
37     "android/view_configuration.cc",
38     "android/view_configuration.h",
39     "animation/animation.cc",
40     "animation/animation.h",
41     "animation/animation_container.cc",
42     "animation/animation_container.h",
43     "animation/animation_container_element.h",
44     "animation/animation_container_observer.h",
45     "animation/animation_delegate.h",
46     "animation/linear_animation.cc",
47     "animation/linear_animation.h",
48     "animation/multi_animation.cc",
49     "animation/multi_animation.h",
50     "animation/slide_animation.cc",
51     "animation/slide_animation.h",
52     "animation/throb_animation.cc",
53     "animation/throb_animation.h",
54     "animation/tween.cc",
55     "animation/tween.h",
56     "blit.cc",
57     "blit.h",
58     "break_list.h",
59     "canvas.cc",
60     "canvas.h",
61     "canvas_android.cc",
62     "canvas_paint_mac.h",
63     "canvas_paint_mac.mm",
64     "canvas_paint_win.cc",
65     "canvas_paint_win.h",
66     "canvas_skia.cc",
67     "canvas_skia_paint.h",
68     "codec/jpeg_codec.cc",
69     "codec/jpeg_codec.h",
70     "codec/png_codec.cc",
71     "codec/png_codec.h",
72     "color_analysis.cc",
73     "color_analysis.h",
74     "color_profile.cc",
75     "color_profile.h",
76     "color_profile_mac.mm",
77     "color_profile_win.cc",
78     "color_utils.cc",
79     "color_utils.h",
80     "display.cc",
81     "display.h",
82     "display_observer.cc",
83     "display_observer.h",
84     "favicon_size.cc",
85     "favicon_size.h",
86     "font.cc",
87     "font.h",
88     "font_fallback_win.cc",
89     "font_fallback_win.h",
90     "font_list.cc",
91     "font_list.h",
92     "font_list_impl.cc",
93     "font_list_impl.h",
94     "font_render_params_android.cc",
95     "font_render_params_linux.cc",
96     "font_render_params_linux.h",
97     "font_smoothing_win.cc",
98     "font_smoothing_win.h",
99     "frame_time.h",
100     "gdi_util.cc",
101     "gdi_util.h",
102     "gfx_paths.cc",
103     "gfx_paths.h",
104     "gpu_memory_buffer.cc",
105     "gpu_memory_buffer.h",
106     "icon_util.cc",
107     "icon_util.h",
108     "image/canvas_image_source.cc",
109     "image/canvas_image_source.h",
110     "image/image.cc",
111     "image/image.h",
112     "image/image_family.cc",
113     "image/image_family.h",
114     "image/image_ios.mm",
115     "image/image_mac.mm",
116     "image/image_png_rep.cc",
117     "image/image_png_rep.h",
118     "image/image_skia.cc",
119     "image/image_skia.h",
120     "image/image_skia_operations.cc",
121     "image/image_skia_operations.h",
122     "image/image_skia_rep.cc",
123     "image/image_skia_rep.h",
124     "image/image_skia_source.h",
125     "image/image_skia_util_ios.h",
126     "image/image_skia_util_ios.mm",
127     "image/image_skia_util_mac.h",
128     "image/image_skia_util_mac.mm",
129     "image/image_util.cc",
130     "image/image_util.h",
131     "image/image_util_ios.mm",
132     "interpolated_transform.cc",
133     "interpolated_transform.h",
134     "linux_font_delegate.cc",
135     "linux_font_delegate.h",
136     "mac/scoped_ns_disable_screen_updates.h",
137     "native_widget_types.h",
138     "nine_image_painter.cc",
139     "nine_image_painter.h",
140     "path.cc",
141     "path.h",
142     "path_aura.cc",
143     "path_win.cc",
144     "path_win.h",
145     "path_x11.cc",
146     "path_x11.h",
147     "platform_font.h",
148     "platform_font_android.cc",
149     "platform_font_ios.h",
150     "platform_font_ios.mm",
151     "platform_font_mac.h",
152     "platform_font_mac.mm",
153     "platform_font_win.cc",
154     "platform_font_win.h",
155     "range/range.cc",
156     "range/range.h",
157     "range/range_mac.mm",
158     "range/range_win.cc",
159     "scoped_canvas.h",
160     "scoped_cg_context_save_gstate_mac.h",
161     "scoped_ns_graphics_context_save_gstate_mac.h",
162     "scoped_ns_graphics_context_save_gstate_mac.mm",
163     "scoped_ui_graphics_push_context_ios.h",
164     "scoped_ui_graphics_push_context_ios.mm",
165     "screen.cc",
166     "screen.h",
167     "screen_android.cc",
168     "screen_aura.cc",
169     "screen_ios.mm",
170     "screen_mac.mm",
171     "screen_win.cc",
172     "screen_win.h",
173     "scrollbar_size.cc",
174     "scrollbar_size.h",
175     "selection_model.cc",
176     "selection_model.h",
177     "sequential_id_generator.cc",
178     "sequential_id_generator.h",
179     "shadow_value.cc",
180     "shadow_value.h",
181     "skbitmap_operations.cc",
182     "skbitmap_operations.h",
183     "skia_util.cc",
184     "skia_util.h",
185     "switches.cc",
186     "switches.h",
187     "sys_color_change_listener.cc",
188     "sys_color_change_listener.h",
189     "text_constants.h",
190     "text_elider.cc",
191     "text_elider.h",
192     "text_utils.cc",
193     "text_utils.h",
194     "text_utils_android.cc",
195     "text_utils_ios.mm",
196     "transform.cc",
197     "transform.h",
198     "transform_util.cc",
199     "transform_util.h",
200     "ui_gfx_exports.cc",
201     "utf16_indexing.cc",
202     "utf16_indexing.h",
203     "vsync_provider.h",
204     "win/dpi.cc",
205     "win/dpi.h",
206     "win/hwnd_util.cc",
207     "win/hwnd_util.h",
208     "win/scoped_set_map_mode.h",
209     "win/singleton_hwnd.cc",
210     "win/singleton_hwnd.h",
211     "win/window_impl.cc",
212     "win/window_impl.h",
213   ]
215   defines = [ "GFX_IMPLEMENTATION" ]
217   deps = [
218     ":gfx_export",
219     "//base",
220     "//base:i18n",
221     "//base:base_static",
222     "//base/third_party/dynamic_annotations",
223     "//skia",
224     "//third_party/harfbuzz-ng",
225     "//third_party/icu:icui18n",
226     "//third_party/icu:icuuc",
227     "//third_party/libpng",
228     "//third_party/zlib",
229     "//ui/gfx/geometry",
230   ]
232   # Text rendering conditions (complicated so separated out).
233   if (is_android || is_ios) {
234     # We don't support RenderText on these platforms.
235   } else {
236     # These text rendering files are supported everywhere text rendering is.
237     sources += [
238       "render_text.cc",
239       "render_text.h",
240       "render_text_harfbuzz.cc",
241       "render_text_harfbuzz.h",
242       "text_utils_skia.cc",
243     ]
244     # These are the "native" rendering routines, only one should apply.
245     if (is_win) {
246       sources += [ "render_text_win.cc" ]
247     } else if (is_mac) {
248       sources += [ "render_text_mac.cc" ]
249     } else if (use_pango) {
250       sources += [ "render_text_pango.cc" ]
251     } else if (use_ozone) {
252       sources += [ "render_text_ozone.cc" ]
253     }
254   }
255   
256   # iOS.
257   if (is_ios) {
258     sources -= [
259       "codec/jpeg_codec.cc",
260       "codec/jpeg_codec.h",
261     ]
262   } else {
263     deps += [ "//third_party:jpeg" ]
264   }
266   # Android.
267   if (is_android) {
268     sources -= [
269       "animation/throb_animation.cc",
270       "canvas_skia.cc",
271       "display_observer.cc",
272       "selection_model.cc",
273     ]
275     if (use_aura) {
276       sources -= [ "screen_android.cc" ]
277     } else {
278       sources -= [ "path.cc" ]
279     }
281     # TODO(GYP) re-enable when base_java exists.
282     #if (!is_android_webview_build) {
283     #  deps += [ "//base:base_java" ]
284     #}
286     deps += [ ":gfx_jni_headers" ]
287     libs = [
288       "android",
289       "jnigraphics",
290     ]
291   }
293   # Windows.
294   if (is_win) {
295     cflags = [
296       "/wd4267",  # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int.
297       "/wd4324",  # Structure was padded due to __declspec(align()), which is
298                   # uninteresting.
299     ]
300   } else {
301     sources -= [
302       "gdi_util.cc",
303       "gdi_util.h",
304       "icon_util.cc",
305       "icon_util.h",
306     ]
307   }
309   # Linux.
310   if (is_linux) {
311     configs += [ "//build/config/linux:fontconfig" ]
312   }
314   # Ozone stuff.
315   if (use_ozone) {
316     sources += [
317       "platform_font_ozone.cc",
318       "ozone/impl/file_surface_factory.cc",
319       "ozone/impl/file_surface_factory.h",
320       "ozone/surface_factory_ozone.cc",
321       "ozone/surface_factory_ozone.h",
322       "ozone/surface_ozone.h",
323       "ozone/overlay_candidates_ozone.cc",
324       "ozone/overlay_candidates_ozone.h",
325     ]
326   }
327   if (use_ozone && ozone_platform_dri) {
328     sources += [
329       "ozone/dri/dri_skbitmap.cc",
330       "ozone/dri/dri_skbitmap.h",
331       "ozone/dri/dri_surface.cc",
332       "ozone/dri/dri_surface.h",
333       "ozone/dri/dri_surface_factory.cc",
334       "ozone/dri/dri_surface_factory.h",
335       "ozone/dri/dri_vsync_provider.cc",
336       "ozone/dri/dri_vsync_provider.h",
337       "ozone/dri/dri_wrapper.cc",
338       "ozone/dri/dri_wrapper.h",
339       "ozone/dri/hardware_display_controller.cc",
340       "ozone/dri/hardware_display_controller.h",
341     ]
342     configs += [ "//build/config/linux:dridrm" ]
343   }
345   if (!use_aura) {
346     sources -= [
347       "nine_image_painter.cc",
348       "nine_image_painter.h",
349       "path_aura.cc",
350       "screen_aura.cc",
351     ]
352   }
354   if (use_x11) {
355     deps += [
356       ":gfx_x11",
357     ]
358   } else {
359     sources -= [
360       "path_x11.cc",
361     ]
362   }
364   if (use_pango) {
365     sources += [
366       "pango_util.cc",
367       "pango_util.h",
368       "platform_font_pango.cc",
369       "platform_font_pango.h",
370     ]
371     configs += [ "//build/config/linux:pangocairo" ]
372   }
375 # Looking for gfx_geometry? It's //ui/gfx/geometry:geometry
377 source_set("gfx_test_support") {
378   sources = [
379     "test/gfx_util.cc",
380     "test/gfx_util.h",
381     "test/ui_cocoa_test_helper.h",
382     "test/ui_cocoa_test_helper.mm",
383   ]
385   deps = [
386     "//base",
387     "//base/test:test_support",
388     "//skia",
389     "//testing/gtest",
390   ]
392   if (is_ios) {
393     # The cocoa files don't apply to iOS.
394     sources -= [
395       "test/ui_cocoa_test_helper.h",
396       "test/ui_cocoa_test_helper.mm",
397     ]
398   }
401 test("gfx_unittests") {
402   sources = [
403     "geometry/box_unittest.cc",
404     "geometry/cubic_bezier_unittest.cc",
405     "geometry/insets_unittest.cc",
406     "geometry/matrix3_unittest.cc",
407     "geometry/point_unittest.cc",
408     "geometry/point3_unittest.cc",
409     "geometry/quad_unittest.cc",
410     "geometry/rect_unittest.cc",
411     "geometry/safe_integer_conversions_unittest.cc",
412     "geometry/size_unittest.cc",
413     "geometry/vector2d_unittest.cc",
414     "geometry/vector3d_unittest.cc",
415     "range/range_unittest.cc",
416   ]
418   deps = [
419     ":gfx",
420     "//base",
421     "//base/test:run_all_unittests",
422     "//base/test:run_all_unittests",
423     "//testing/gtest",
424     "//ui/gfx/geometry",
425   ]
428 if (is_android) {
429   generate_jni("gfx_jni_headers") {
430     sources = [
431       "../android/java/src/org/chromium/ui/gfx/BitmapHelper.java",
432       "../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java",
433       "../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java",
434     ]
435     jni_package = "gfx"
436   }
439 if (use_x11) {
440   component("gfx_x11") {
441     sources = [
442       "x/x11_atom_cache.cc",
443       "x/x11_atom_cache.h",
444       "x/x11_connection.cc",
445       "x/x11_connection.h",
446       "x/x11_error_tracker.cc",
447       "x/x11_error_tracker.h",
448       "x/x11_switches.cc",
449       "x/x11_switches.h",
450       "x/x11_types.cc",
451       "x/x11_types.h",
452     ]
454     defines = [ "GFX_IMPLEMENTATION" ]
455     configs += [ "//build/config/linux:x11" ]
457     deps = [
458       ":gfx_export",
459       "//base"
460     ]
461   }