[Android WebView] Put AndroidStreamReaderURLRequestJob into a namespace
[chromium-blink-merge.git] / ui / gfx / BUILD.gn
blobf97ff610c4854104368508fc8331d3b816d4fb44
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")
6 import("//testing/test.gni")
8 if (is_android) {
9   import("//build/config/android/config.gni")
10   import("//build/config/android/rules.gni")
13 # Several targets want to include this header file, and some of them are
14 # child dependencies of "gfx". Therefore, we separate it out here so multiple
15 # targets can all have a dependency for header checking purposes without
16 # creating circular dependencies.
17 source_set("gfx_export") {
18   sources = [
19     "gfx_export.h",
20   ]
23 vector_icons_cc_file = "$target_gen_dir/vector_icons.cc"
24 vector_icons_h_file = "$target_gen_dir/vector_icons.h"
26 component("gfx") {
27   sources = [
28     "android/device_display_info.cc",
29     "android/device_display_info.h",
30     "android/gfx_jni_registrar.cc",
31     "android/gfx_jni_registrar.h",
32     "android/java_bitmap.cc",
33     "android/java_bitmap.h",
34     "android/shared_device_display_info.cc",
35     "android/shared_device_display_info.h",
36     "android/view_configuration.cc",
37     "android/view_configuration.h",
38     "animation/animation.cc",
39     "animation/animation.h",
40     "animation/animation_container.cc",
41     "animation/animation_container.h",
42     "animation/animation_container_element.h",
43     "animation/animation_container_observer.h",
44     "animation/animation_delegate.h",
45     "animation/linear_animation.cc",
46     "animation/linear_animation.h",
47     "animation/multi_animation.cc",
48     "animation/multi_animation.h",
49     "animation/slide_animation.cc",
50     "animation/slide_animation.h",
51     "animation/throb_animation.cc",
52     "animation/throb_animation.h",
53     "animation/tween.cc",
54     "animation/tween.h",
55     "break_list.h",
56     "buffer_format_util.cc",
57     "buffer_format_util.h",
58     "codec/jpeg_codec.cc",
59     "codec/jpeg_codec.h",
60     "codec/png_codec.cc",
61     "codec/png_codec.h",
62     "color_analysis.cc",
63     "color_analysis.h",
64     "color_profile.cc",
65     "color_profile.h",
66     "color_profile_mac.mm",
67     "color_profile_win.cc",
68     "color_utils.cc",
69     "color_utils.h",
70     "display.cc",
71     "display.h",
72     "display_change_notifier.cc",
73     "display_change_notifier.h",
74     "display_observer.cc",
75     "display_observer.h",
76     "favicon_size.cc",
77     "favicon_size.h",
78     "font.cc",
79     "font.h",
80     "font_fallback.h",
81     "font_fallback_linux.cc",
82     "font_fallback_mac.mm",
83     "font_fallback_win.cc",
84     "font_fallback_win.h",
85     "font_list.cc",
86     "font_list.h",
87     "font_list_impl.cc",
88     "font_list_impl.h",
89     "font_render_params.cc",
90     "font_render_params.h",
91     "font_render_params_android.cc",
92     "font_render_params_linux.cc",
93     "font_render_params_mac.cc",
94     "font_render_params_win.cc",
95     "gdi_util.cc",
96     "gdi_util.h",
97     "generic_shared_memory_id.cc",
98     "generic_shared_memory_id.h",
99     "gfx_paths.cc",
100     "gfx_paths.h",
101     "hud_font.cc",
102     "hud_font.h",
103     "icon_util.cc",
104     "icon_util.h",
105     "image/image.cc",
106     "image/image.h",
107     "image/image_family.cc",
108     "image/image_family.h",
109     "image/image_ios.mm",
110     "image/image_mac.mm",
111     "image/image_png_rep.cc",
112     "image/image_png_rep.h",
113     "image/image_skia.cc",
114     "image/image_skia.h",
115     "image/image_skia_rep.cc",
116     "image/image_skia_rep.h",
117     "image/image_skia_source.h",
118     "image/image_skia_util_ios.h",
119     "image/image_skia_util_ios.mm",
120     "image/image_skia_util_mac.h",
121     "image/image_skia_util_mac.mm",
122     "image/image_util.cc",
123     "image/image_util.h",
124     "image/image_util_ios.mm",
125     "interpolated_transform.cc",
126     "interpolated_transform.h",
127     "linux_font_delegate.cc",
128     "linux_font_delegate.h",
129     "mac/coordinate_conversion.h",
130     "mac/coordinate_conversion.mm",
131     "mac/nswindow_frame_controls.h",
132     "mac/nswindow_frame_controls.mm",
133     "mac/scoped_cocoa_disable_screen_updates.h",
134     "native_widget_types.h",
135     "nine_image_painter.cc",
136     "nine_image_painter.h",
137     "path.cc",
138     "path.h",
139     "path_win.cc",
140     "path_win.h",
141     "path_x11.cc",
142     "path_x11.h",
143     "platform_font.h",
144     "platform_font_android.cc",
145     "platform_font_ios.h",
146     "platform_font_ios.mm",
147     "platform_font_linux.cc",
148     "platform_font_linux.h",
149     "platform_font_mac.h",
150     "platform_font_mac.mm",
151     "platform_font_win.cc",
152     "platform_font_win.h",
153     "range/range.cc",
154     "range/range.h",
155     "range/range_f.cc",
156     "range/range_f.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/direct_manipulation.cc",
205     "win/direct_manipulation.h",
206     "win/direct_write.cc",
207     "win/direct_write.h",
208     "win/dpi.cc",
209     "win/dpi.h",
210     "win/hwnd_util.cc",
211     "win/hwnd_util.h",
212     "win/metro_mode.cc",
213     "win/metro_mode.h",
214     "win/scoped_set_map_mode.h",
215     "win/singleton_hwnd.cc",
216     "win/singleton_hwnd.h",
217     "win/singleton_hwnd_observer.cc",
218     "win/singleton_hwnd_observer.h",
219     "win/window_impl.cc",
220     "win/window_impl.h",
221   ]
222   if (!is_ios) {
223     sources += [
224       "blit.cc",
225       "blit.h",
226       "canvas.cc",
227       "canvas.h",
228       "canvas_notimplemented.cc",
229       "canvas_paint_mac.h",
230       "canvas_paint_mac.mm",
231       "canvas_skia.cc",
232       "canvas_skia_paint.h",
233       "gpu_memory_buffer.cc",
234       "gpu_memory_buffer.h",
235       "image/canvas_image_source.cc",
236       "image/canvas_image_source.h",
237       "image/image_skia_operations.cc",
238       "image/image_skia_operations.h",
239       "paint_throbber.cc",
240       "paint_throbber.h",
241     ]
242   }
244   configs += [
245     "//build/config:precompiled_headers",
247     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
248     "//build/config/compiler:no_size_t_to_int_warning",
249   ]
251   defines = [ "GFX_IMPLEMENTATION" ]
253   deps = [
254     ":gfx_export",
255     "//base",
256     "//base:i18n",
257     "//base:base_static",
258     "//base/third_party/dynamic_annotations",
259     "//skia",
260     "//third_party/harfbuzz-ng",
261     "//third_party/libpng",
262     "//third_party/zlib",
263     "//ui/gfx/geometry",
264   ]
265   public_deps = [
266     "//base",
267     "//skia",
268     "//third_party/icu",
269   ]
271   # Text rendering conditions (complicated so separated out).
272   if (use_aura || is_mac) {
273     # Mac doesn't use RenderTextHarfBuzz by default yet.
274     sources += [
275       "harfbuzz_font_skia.cc",
276       "harfbuzz_font_skia.h",
277       "render_text_harfbuzz.cc",
278       "render_text_harfbuzz.h",
279       "render_text_mac.cc",
280       "render_text_mac.h",
281       "text_utils_skia.cc",
282     ]
284     if (!is_ios) {
285       sources += [
286         "render_text.cc",
287         "render_text.h",
288       ]
289     }
290   } else {
291     # We don't support RenderText on these platforms.
292   }
294   if (is_android && use_aura) {
295     sources -= [
296       "platform_font_android.cc",
297       "text_utils_android.cc",
298     ]
299     set_sources_assignment_filter([])
300     sources += [ "platform_font_linux.cc" ]
301     set_sources_assignment_filter(sources_assignment_filter)
302   }
304   # iOS.
305   if (is_ios) {
306     sources -= [
307       "codec/jpeg_codec.cc",
308       "codec/jpeg_codec.h",
309     ]
310   } else {
311     deps += [ "//third_party:jpeg" ]
312   }
314   # Android.
315   if (is_android) {
316     if (use_aura) {
317       sources -= [
318         "canvas_notimplemented.cc",
319         "screen_android.cc",
320       ]
321       sources += [ "font_fallback_android.cc" ]
322     } else {
323       sources -= [
324         "animation/throb_animation.cc",
325         "canvas_skia.cc",
326         "path.cc",
327         "selection_model.cc",
328       ]
329     }
331     if (!is_debug) {
332       configs -= [ "//build/config/compiler:default_optimization" ]
333       configs += [ "//build/config/compiler:optimize_max" ]
334     }
336     deps += [
337       ":gfx_jni_headers",
338       "//base:base_java",
339     ]
340     libs = [
341       "android",
342       "jnigraphics",
343     ]
344   } else if (!is_ios) {
345     sources -= [ "canvas_notimplemented.cc" ]
346   }
348   # Desktop only.
349   if (use_aura || (!is_ios && !is_android)) {
350     sources += [
351       "paint_vector_icon.cc",
352       "paint_vector_icon.h",
353       "vector_icon_types.h",
354       "vector_icons_public.h",
355       vector_icons_cc_file,
356       vector_icons_h_file,
357     ]
358     deps += [ ":aggregate_vector_icons" ]
359   }
361   # Windows.
362   if (is_win) {
363     cflags = [ "/wd4324" ]  # Structure was padded due to __declspec(align()), which is
364                             # uninteresting.
365   } else {
366     sources -= [
367       "gdi_util.cc",
368       "gdi_util.h",
369       "icon_util.cc",
370       "icon_util.h",
371       "sys_color_change_listener.cc",
372       "sys_color_change_listener.h",
373     ]
374   }
376   # Linux.
377   if (is_linux) {
378     configs += [ "//build/config/linux:fontconfig" ]
379   }
381   # Chrome OS
382   if (is_chromeos) {
383     # Robust JPEG decoding for the login screen.
384     sources += [
385       "chromeos/codec/jpeg_codec_robust_slow.cc",
386       "chromeos/codec/jpeg_codec_robust_slow.h",
387     ]
388     deps += [ "//third_party/libjpeg" ]
389   }
391   if (!use_aura) {
392     sources -= [ "screen_aura.cc" ]
393     if (!toolkit_views) {
394       sources -= [
395         "nine_image_painter.cc",
396         "nine_image_painter.h",
397       ]
398     }
399   }
401   if (use_x11) {
402     deps += [ "//ui/gfx/x" ]
403     configs += [ "//build/config/linux:x11" ]
404   } else {
405     sources -= [ "path_x11.cc" ]
406   }
408   if (use_ozone) {
409     sources += [ "native_pixmap_handle_ozone.h" ]
410   }
412   if (use_cairo) {
413     configs += [ "//build/config/linux:pangocairo" ]
414   }
417 # GYP version: ui/gfx/gfx.gyp:aggregate_vector_icons
418 action("aggregate_vector_icons") {
419   script = "vector_icons/aggregate_vector_icons.py"
420   sources = [
421     "vector_icon_types.h",
422     "vector_icons/account_box.icon",
423     "vector_icons/account_child_invert.icon",
424     "vector_icons/apps.icon",
425     "vector_icons/autofill.icon",
426     "vector_icons/bar_close.1x.icon",
427     "vector_icons/bar_close.icon",
428     "vector_icons/blocked_badge.icon",
429     "vector_icons/check_circle.icon",
430     "vector_icons/code.icon",
431     "vector_icons/cookie.icon",
432     "vector_icons/crashed_tab.icon",
433     "vector_icons/extension.icon",
434     "vector_icons/file_download.icon",
435     "vector_icons/file_download_shelf.icon",
436     "vector_icons/find_next.1x.icon",
437     "vector_icons/find_next.icon",
438     "vector_icons/find_prev.1x.icon",
439     "vector_icons/find_prev.icon",
440     "vector_icons/folder.icon",
441     "vector_icons/folder_managed.icon",
442     "vector_icons/folder_supervised.icon",
443     "vector_icons/fullscreen.icon",
444     "vector_icons/globe.icon",
445     "vector_icons/help_outline.icon",
446     "vector_icons/image.icon",
447     "vector_icons/laptop.icon",
448     "vector_icons/location_on.icon",
449     "vector_icons/midi.icon",
450     "vector_icons/mixed_content.icon",
451     "vector_icons/mode_edit.icon",
452     "vector_icons/my_location.icon",
453     "vector_icons/notifications.icon",
454     "vector_icons/paintbrush.icon",
455     "vector_icons/photo_camera.icon",
456     "vector_icons/protocol_handler.icon",
457     "vector_icons/remove_box.icon",
458     "vector_icons/sad_tab.icon",
459     "vector_icons/smartphone.icon",
460     "vector_icons/star.icon",
461     "vector_icons/star_border.icon",
462     "vector_icons/supervisor_account.icon",
463     "vector_icons/tab.icon",
464     "vector_icons/tab_audio.1x.icon",
465     "vector_icons/tab_audio.icon",
466     "vector_icons/tab_audio_muting.1x.icon",
467     "vector_icons/tab_audio_muting.icon",
468     "vector_icons/tablet.icon",
469     "vector_icons/translate.icon",
470     "vector_icons/warning.icon",
471     "vector_icons/warning_badge.icon",
472     "vector_icons/web.icon",
473   ]
474   outputs = [
475     vector_icons_cc_file,
476     vector_icons_h_file,
477   ]
479   args = [
480     "--working_directory=" + rebase_path("vector_icons/"),
481     "--output_cc=" + rebase_path(vector_icons_cc_file, root_build_dir),
482     "--output_h=" + rebase_path(vector_icons_h_file, root_build_dir),
483   ]
486 # Looking for gfx_geometry? It's //ui/gfx/geometry:geometry
488 source_set("test_support") {
489   testonly = true
490   sources = [
491     "image/image_unittest_util.cc",
492     "image/image_unittest_util.h",
493     "image/image_unittest_util_ios.mm",
494     "image/image_unittest_util_mac.mm",
495     "test/fontconfig_util_linux.cc",
496     "test/fontconfig_util_linux.h",
497     "test/gfx_util.cc",
498     "test/gfx_util.h",
499     "test/test_screen.cc",
500     "test/test_screen.h",
501     "test/ui_cocoa_test_helper.h",
502     "test/ui_cocoa_test_helper.mm",
503   ]
505   public_deps = [
506     ":gfx",
507   ]
509   deps = [
510     "//base",
511     "//base/test:test_support",
512     "//skia",
513     "//testing/gtest",
514     "//ui/gfx/geometry",
515   ]
517   if (is_ios) {
518     # The cocoa files don't apply to iOS.
519     sources -= [
520       "test/ui_cocoa_test_helper.h",
521       "test/ui_cocoa_test_helper.mm",
522     ]
523   }
524   if (is_linux) {
525     configs += [ "//build/config/linux:fontconfig" ]
526   }
529 # TODO(GYP): Delete this after we've converted everything to GN.
530 # The _run targets exist only for compatibility w/ GYP.
531 group("gfx_unittests_run") {
532   testonly = true
533   deps = [
534     ":gfx_unittests",
535   ]
538 test("gfx_unittests") {
539   sources = [
540     "font_render_params_linux_unittest.cc",
541     "font_unittest.cc",
542     "image/image_family_unittest.cc",
543     "image/image_ios_unittest.mm",
544     "image/image_skia_unittest.cc",
545     "image/image_unittest.cc",
546     "platform_font_linux_unittest.cc",
547     "screen_unittest.cc",
548     "test/run_all_unittests.cc",
549     "text_elider_unittest.cc",
550     "text_utils_unittest.cc",
551   ]
553   data = [
554     "test/data/",
555     "$root_out_dir/ui_test.pak",
556   ]
558   if (!is_ios) {
559     sources += [
560       "animation/animation_container_unittest.cc",
561       "animation/animation_unittest.cc",
562       "animation/multi_animation_unittest.cc",
563       "animation/slide_animation_unittest.cc",
564       "animation/tween_unittest.cc",
565       "blit_unittest.cc",
566       "break_list_unittest.cc",
567       "canvas_unittest.cc",
568       "canvas_unittest_mac.mm",
569       "codec/jpeg_codec_unittest.cc",
570       "codec/png_codec_unittest.cc",
571       "color_analysis_unittest.cc",
572       "color_profile_mac_unittest.mm",
573       "color_utils_unittest.cc",
574       "display_change_notifier_unittest.cc",
575       "display_unittest.cc",
576       "font_fallback_mac_unittest.cc",
577       "font_list_unittest.cc",
578       "geometry/box_unittest.cc",
579       "geometry/cubic_bezier_unittest.cc",
580       "geometry/insets_unittest.cc",
581       "geometry/matrix3_unittest.cc",
582       "geometry/point3_unittest.cc",
583       "geometry/point_unittest.cc",
584       "geometry/quad_unittest.cc",
585       "geometry/rect_unittest.cc",
586       "geometry/safe_integer_conversions_unittest.cc",
587       "geometry/scroll_offset_unittest.cc",
588       "geometry/size_unittest.cc",
589       "geometry/vector2d_unittest.cc",
590       "geometry/vector3d_unittest.cc",
591       "image/image_mac_unittest.mm",
592       "image/image_util_unittest.cc",
593       "mac/coordinate_conversion_unittest.mm",
594       "nine_image_painter_unittest.cc",
595       "platform_font_mac_unittest.mm",
596       "range/range_mac_unittest.mm",
597       "range/range_unittest.cc",
598       "range/range_win_unittest.cc",
599       "sequential_id_generator_unittest.cc",
600       "shadow_value_unittest.cc",
601       "skbitmap_operations_unittest.cc",
602       "skrect_conversion_unittest.cc",
603       "transform_util_unittest.cc",
604       "utf16_indexing_unittest.cc",
605     ]
606   }
608   if (!is_android && !is_ios) {
609     sources += [ "render_text_unittest.cc" ]
610   }
612   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
613   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
615   deps = [
616     ":gfx",
617     ":test_support",
618     "//base",
619     "//base/test:test_support",
620     "//skia",
621     "//third_party/icu:icuuc",
622     "//third_party/libpng",
623     "//third_party/zlib",
624     "//testing/gtest",
625     "//ui/base",
626     "//ui/gfx/geometry",
627     "//ui/resources:ui_test_pak",
628   ]
630   data_deps = [ "//ui/resources:ui_test_pak" ]
632   if (!is_mac && !is_ios) {
633     sources += [
634       "interpolated_transform_unittest.cc",
635       "transform_unittest.cc",
636     ]
637   }
639   if (is_android) {
640     sources -= [
641       # Do not run display_change_notifier_unittest.cc on Android because it
642       # does not compile display_observer.cc
643       "display_change_notifier_unittest.cc",
644     ]
645   }
647   if (use_aura) {
648     sources -= [ "screen_unittest.cc" ]
649   } else if (!is_ios) {
650     sources -= [ "nine_image_painter_unittest.cc" ]
651   }
653   if (is_chromeos) {
654     sources += [ "chromeos/codec/jpeg_codec_robust_slow_unittest.cc" ]
655   }
657   if (is_win) {
658     sources += [
659       "color_profile_win_unittest.cc",
660       "font_fallback_win_unittest.cc",
661       "icon_util_unittest.cc",
662       "icon_util_unittests.rc",
663       "path_win_unittest.cc",
664       "platform_font_win_unittest.cc",
665     ]
667     ldflags = [
668       "/DELAYLOAD:d2d1.dll",
669       "/DELAYLOAD:d3d10_1.dll",
670     ]
672     libs = [
673       "d2d1.lib",
674       "d3d10_1.lib",
675       "imm32.lib",
676       "oleacc.lib",
677     ]
678   }
681 if (is_android) {
682   generate_jni("gfx_jni_headers") {
683     sources = [
684       "../android/java/src/org/chromium/ui/gfx/BitmapHelper.java",
685       "../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java",
686       "../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java",
687     ]
688     jni_package = "gfx"
689   }