Enable content shell on Tizen(TM1/TV) profile
[platform/framework/web/chromium-efl.git] / pdf / BUILD.gn
1 # Copyright 2014 The Chromium Authors
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/buildflag_header.gni")
6 import("//build/config/features.gni")
7 import("//pdf/features.gni")
8 import("//ppapi/buildflags/buildflags.gni")
9 import("//printing/buildflags/buildflags.gni")
10 import("//testing/libfuzzer/fuzzer_test.gni")
11 import("//testing/test.gni")
12 import("//third_party/pdfium/pdfium.gni")
13 import("//tools/grit/repack.gni")
14 import("//v8/gni/v8.gni")
15
16 # Generate a buildflag header for compile-time checking of PDF support.
17 buildflag_header("buildflags") {
18   header = "buildflags.h"
19   flags = [
20     "ENABLE_INK=$enable_ink",
21     "ENABLE_PDF=$enable_pdf",
22   ]
23 }
24
25 if (enable_pdf) {
26   config("strict") {
27     configs = [ "//build/config/compiler:wexit_time_destructors" ]
28   }
29
30   config("pdfium_includes") {
31     include_dirs = [ "//third_party/pdfium" ]
32   }
33
34   static_library("pdf") {
35     sources = [ "pdf.cc" ]
36
37     configs += [ ":strict" ]
38
39     public = [ "pdf.h" ]
40
41     deps = [
42       ":internal",
43       "//base",
44       "//build:chromeos_buildflags",
45       "//ui/gfx/geometry",
46     ]
47   }
48
49   source_set("features") {
50     sources = [ "pdf_features.cc" ]
51
52     configs += [ ":strict" ]
53
54     public = [ "pdf_features.h" ]
55
56     deps = [
57       "//base",
58       "//build:chromeos_buildflags",
59     ]
60   }
61
62   source_set("internal") {
63     visibility = [ ":*" ]
64
65     sources = [
66       "accessibility.cc",
67       "accessibility.h",
68       "document_attachment_info.cc",
69       "document_attachment_info.h",
70       "document_layout.cc",
71       "document_layout.h",
72       "document_metadata.cc",
73       "document_metadata.h",
74       "draw_utils/coordinates.cc",
75       "draw_utils/coordinates.h",
76       "draw_utils/shadow.cc",
77       "draw_utils/shadow.h",
78       "file_extension.cc",
79       "file_extension.h",
80       "metrics_handler.cc",
81       "metrics_handler.h",
82       "page_orientation.cc",
83       "page_orientation.h",
84       "paint_aggregator.cc",
85       "paint_aggregator.h",
86       "paint_manager.cc",
87       "paint_manager.h",
88       "paint_ready_rect.cc",
89       "paint_ready_rect.h",
90       "parsed_params.cc",
91       "parsed_params.h",
92       "pdf_engine.h",
93       "pdf_init.cc",
94       "pdf_init.h",
95       "pdf_transform.cc",
96       "pdf_transform.h",
97       "pdf_utils/dates.cc",
98       "pdf_utils/dates.h",
99       "pdf_view_plugin_base.cc",
100       "pdf_view_plugin_base.h",
101       "pdfium/pdfium_api_string_buffer_adapter.cc",
102       "pdfium/pdfium_api_string_buffer_adapter.h",
103       "pdfium/pdfium_document.cc",
104       "pdfium/pdfium_document.h",
105       "pdfium/pdfium_engine.cc",
106       "pdfium/pdfium_engine.h",
107       "pdfium/pdfium_engine_exports.cc",
108       "pdfium/pdfium_engine_exports.h",
109       "pdfium/pdfium_form_filler.cc",
110       "pdfium/pdfium_form_filler.h",
111       "pdfium/pdfium_mem_buffer_file_write.cc",
112       "pdfium/pdfium_mem_buffer_file_write.h",
113       "pdfium/pdfium_page.cc",
114       "pdfium/pdfium_page.h",
115       "pdfium/pdfium_permissions.cc",
116       "pdfium/pdfium_permissions.h",
117       "pdfium/pdfium_print.cc",
118       "pdfium/pdfium_print.h",
119       "pdfium/pdfium_range.cc",
120       "pdfium/pdfium_range.h",
121       "pdfium/pdfium_unsupported_features.cc",
122       "pdfium/pdfium_unsupported_features.h",
123       "preview_mode_client.cc",
124       "preview_mode_client.h",
125       "ui/document_properties.cc",
126       "ui/document_properties.h",
127       "ui/file_name.cc",
128       "ui/file_name.h",
129       "ui/thumbnail.cc",
130       "ui/thumbnail.h",
131     ]
132
133     public_configs = [ ":pdfium_includes" ]
134
135     configs += [ ":strict" ]
136
137     public_deps = [
138       "//printing/mojom",
139       "//skia",
140       "//v8",
141     ]
142
143     deps = [
144       ":accessibility",
145       ":buildflags",
146       ":content_restriction",
147       ":features",
148       "//base",
149       "//base:i18n",
150       "//build:chromeos_buildflags",
151       "//components/strings",
152       "//gin",
153       "//pdf/loader",
154       "//third_party/blink/public:blink_headers",
155       "//third_party/blink/public/common:headers",
156       "//third_party/icu",
157       "//third_party/pdfium",
158       "//ui/base",
159       "//ui/base/cursor/mojom:cursor_type",
160       "//ui/events:events_base",
161       "//ui/events/blink",
162       "//ui/gfx/codec",
163       "//ui/gfx/range",
164     ]
165
166     if (enable_basic_printing) {
167       deps += [ "//printing" ]
168     }
169
170     if (is_linux || is_chromeos) {
171       sources += [
172         "pdfium/pdfium_font_linux.cc",
173         "pdfium/pdfium_font_linux.h",
174       ]
175
176       deps += [
177         ":font_table_linux",
178         "//components/services/font/public/cpp",
179       ]
180     }
181   }
182
183   source_set("assert_enums") {
184     visibility = [ ":*" ]
185
186     testonly = true
187
188     sources = [ "pdfium/pdfium_assert_matching_enums.cc" ]
189
190     deps = [
191       ":accessibility",
192       ":content_restriction",
193       ":internal",
194       ":pdf",
195       "//third_party/blink/public/common:headers",
196       "//third_party/pdfium",
197       "//ui/base",
198     ]
199   }
200
201   source_set("content_restriction") {
202     # Exists separately to expose this header for testing.
203     public = [ "content_restriction.h" ]
204   }
205
206   source_set("accessibility") {
207     visibility = [
208       ":*",
209       "//components:components_browsertests${exec_target_suffix}",
210       "//components/pdf/renderer",
211       "//components/pdf/renderer:unit_tests",
212     ]
213
214     sources = [
215       "accessibility_helper.cc",
216       "accessibility_helper.h",
217       "accessibility_structs.cc",
218       "accessibility_structs.h",
219       "pdf_accessibility_action_handler.h",
220       "pdf_accessibility_data_handler.h",
221     ]
222
223     configs += [ ":strict" ]
224
225     deps = [
226       "//base",
227       "//skia",
228       "//ui/gfx/geometry",
229     ]
230   }
231
232   static_library("pdf_view_web_plugin") {
233     assert(enable_plugins, "The PDF viewer relies on plugin infrastructure")
234
235     visibility = [
236       ":*",
237       "//components/pdf/renderer",
238     ]
239
240     sources = [
241       "pdf_view_web_plugin.cc",
242       "post_message_receiver.cc",
243       "post_message_receiver.h",
244       "v8_value_converter.h",
245     ]
246
247     configs += [ ":strict" ]
248
249     public = [ "pdf_view_web_plugin.h" ]
250
251     public_deps = [ "//pdf/mojom" ]
252
253     deps = [
254       ":accessibility",
255       ":buildflags",
256       ":content_restriction",
257       ":internal",
258       "//base",
259       "//base:i18n",
260       "//cc/paint",
261       "//gin",
262       "//net",
263       "//pdf/loader",
264       "//services/network/public/mojom:url_loader_base",
265       "//skia",
266       "//third_party/blink/public:blink_headers",
267       "//third_party/blink/public/common:headers",
268       "//ui/base/cursor",
269       "//ui/base/cursor/mojom:cursor_type",
270       "//ui/events/blink",
271       "//ui/gfx/range",
272       "//v8",
273     ]
274
275     if (enable_basic_printing) {
276       deps += [ "//printing" ]
277     }
278   }
279
280   source_set("pdf_test_utils") {
281     visibility = [ "//pdf/*" ]
282
283     testonly = true
284
285     sources = [
286       "test/mock_web_associated_url_loader.cc",
287       "test/mock_web_associated_url_loader.h",
288       "test/test_client.cc",
289       "test/test_client.h",
290       "test/test_document_loader.cc",
291       "test/test_document_loader.h",
292       "test/test_helpers.cc",
293       "test/test_helpers.h",
294       "test/test_pdfium_engine.cc",
295       "test/test_pdfium_engine.h",
296     ]
297
298     deps = [
299       ":internal",
300       "//base",
301       "//cc:test_support",
302       "//pdf/loader",
303       "//testing/gmock",
304       "//testing/gtest",
305       "//third_party/blink/public:blink",
306       "//ui/gfx/range",
307       "//ui/latency:latency",
308     ]
309   }
310
311   if (is_linux || is_chromeos) {
312     # TODO(crbug.com/1302059): After PPAPI deprecation, there will only be one
313     # caller left. Move inside the file with the caller.
314     static_library("font_table_linux") {
315       sources = [ "font_table_linux.cc" ]
316
317       configs += [ ":strict" ]
318
319       public = [ "font_table_linux.h" ]
320
321       deps = [ "//base" ]
322     }
323   }
324
325   test("pdf_unittests") {
326     testonly = true
327
328     sources = [
329       "document_layout_unittest.cc",
330       "draw_utils/coordinates_unittest.cc",
331       "file_extension_unittest.cc",
332       "page_orientation_unittest.cc",
333       "paint_manager_unittest.cc",
334       "parsed_params_unittest.cc",
335       "pdf_transform_unittest.cc",
336       "pdf_utils/dates_unittest.cc",
337       "pdf_view_web_plugin_unittest.cc",
338       "pdfium/accessibility_unittest.cc",
339       "pdfium/findtext_unittest.cc",
340       "pdfium/pdfium_engine_exports_unittest.cc",
341       "pdfium/pdfium_engine_unittest.cc",
342       "pdfium/pdfium_form_filler_unittest.cc",
343       "pdfium/pdfium_page_unittest.cc",
344       "pdfium/pdfium_permissions_unittest.cc",
345       "pdfium/pdfium_print_unittest.cc",
346       "pdfium/pdfium_range_unittest.cc",
347       "pdfium/pdfium_test_base.cc",
348       "pdfium/pdfium_test_base.h",
349       "test/run_all_unittests.cc",
350       "ui/document_properties_unittest.cc",
351       "ui/file_name_unittest.cc",
352       "ui/thumbnail_unittest.cc",
353     ]
354
355     data = [ "test/data/" ]
356
357     deps = [
358       ":accessibility",
359       ":assert_enums",
360       ":buildflags",
361       ":content_restriction",
362       ":features",
363       ":internal",
364       ":pdf",
365       ":pdf_test_utils",
366       ":pdf_view_web_plugin",
367       "//base",
368       "//base:i18n",
369       "//base/test:test_support",
370       "//cc:test_support",
371       "//gin",
372       "//mojo/core/embedder",
373       "//mojo/public/cpp/bindings",
374       "//net",
375       "//pdf/loader",
376       "//pdf/loader:unit_tests",
377       "//skia",
378       "//testing/gmock",
379       "//testing/gtest",
380       "//third_party/blink/public:blink",
381       "//third_party/blink/public:test_support",
382       "//third_party/blink/public/common:headers",
383       "//third_party/pdfium",
384       "//ui/base",
385       "//ui/base/cursor",
386       "//ui/events/blink:blink",
387       "//ui/gfx:test_support",
388       "//ui/gfx/geometry",
389       "//ui/gfx/range",
390       "//v8",
391     ]
392
393     if (enable_basic_printing) {
394       deps += [ "//printing" ]
395     }
396
397     if (v8_use_external_startup_data) {
398       deps += [ "//tools/v8_context_snapshot" ]
399       configs += [
400         "//tools/v8_context_snapshot:use_v8_context_snapshot",
401         "//v8:external_startup_data",
402       ]
403     }
404
405     data_deps = [
406       ":pdf_unittests_pak",
407       "//ui/resources:ui_test_pak_data",
408     ]
409
410     assert_no_deps = [
411       "//ppapi/c/*",
412       "//ppapi/cpp/*",
413     ]
414   }
415
416   repack("pdf_unittests_pak") {
417     sources =
418         [ "$root_gen_dir/components/strings/components_strings_en-US.pak" ]
419     output = "$root_out_dir/pdf_tests_resources.pak"
420     deps = [ "//components/strings" ]
421   }
422
423   fuzzer_test("pdf_dates_fuzzer") {
424     sources = [ "pdf_utils/dates_fuzzer.cc" ]
425
426     deps = [
427       ":internal",
428       "//base",
429     ]
430   }
431 } else {
432   # Dummy groups when PDF support is disabled so targets can unconditionally
433   # depend on it.
434   group("features") {
435   }
436   group("pdf") {
437   }
438 }