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.
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")
17 import("//build/config/ios/bundle_data_from_filelist.gni")
20 # Generate a buildflag header for compile-time checking of PDF support.
21 buildflag_header("buildflags") {
22 header = "buildflags.h"
24 "ENABLE_INK=$enable_ink",
25 "ENABLE_PDF=$enable_pdf",
31 configs = [ "//build/config/compiler:wexit_time_destructors" ]
34 config("pdfium_includes") {
35 include_dirs = [ "//third_party/pdfium" ]
38 static_library("pdf") {
39 sources = [ "pdf.cc" ]
41 configs += [ ":strict" ]
49 "//build:chromeos_buildflags",
54 source_set("features") {
55 sources = [ "pdf_features.cc" ]
57 configs += [ ":strict" ]
59 public = [ "pdf_features.h" ]
63 "//build:chromeos_buildflags",
67 source_set("internal") {
73 "document_attachment_info.cc",
74 "document_attachment_info.h",
77 "document_metadata.cc",
78 "document_metadata.h",
79 "draw_utils/coordinates.cc",
80 "draw_utils/coordinates.h",
81 "draw_utils/shadow.cc",
82 "draw_utils/shadow.h",
87 "page_orientation.cc",
89 "paint_aggregator.cc",
93 "paint_ready_rect.cc",
102 "pdf_utils/dates.cc",
104 "pdfium/pdfium_api_string_buffer_adapter.cc",
105 "pdfium/pdfium_api_string_buffer_adapter.h",
106 "pdfium/pdfium_document.cc",
107 "pdfium/pdfium_document.h",
108 "pdfium/pdfium_engine.cc",
109 "pdfium/pdfium_engine.h",
110 "pdfium/pdfium_engine_exports.cc",
111 "pdfium/pdfium_engine_exports.h",
112 "pdfium/pdfium_form_filler.cc",
113 "pdfium/pdfium_form_filler.h",
114 "pdfium/pdfium_mem_buffer_file_write.cc",
115 "pdfium/pdfium_mem_buffer_file_write.h",
116 "pdfium/pdfium_page.cc",
117 "pdfium/pdfium_page.h",
118 "pdfium/pdfium_permissions.cc",
119 "pdfium/pdfium_permissions.h",
120 "pdfium/pdfium_print.cc",
121 "pdfium/pdfium_print.h",
122 "pdfium/pdfium_range.cc",
123 "pdfium/pdfium_range.h",
124 "pdfium/pdfium_unsupported_features.cc",
125 "pdfium/pdfium_unsupported_features.h",
126 "preview_mode_client.cc",
127 "preview_mode_client.h",
128 "ui/document_properties.cc",
129 "ui/document_properties.h",
136 public_configs = [ ":pdfium_includes" ]
138 configs += [ ":strict" ]
149 ":content_restriction",
153 "//build:chromeos_buildflags",
154 "//components/strings",
157 "//third_party/blink/public:blink_headers",
158 "//third_party/blink/public/common:headers",
160 "//third_party/pdfium",
162 "//ui/base/cursor/mojom:cursor_type",
163 "//ui/events:events_base",
169 if (enable_basic_printing) {
170 deps += [ "//printing" ]
173 if (is_linux || is_chromeos || is_tizen) {
175 "pdfium/pdfium_font_linux.cc",
176 "pdfium/pdfium_font_linux.h",
181 "//components/services/font/public/cpp",
186 source_set("assert_enums") {
187 visibility = [ ":*" ]
191 sources = [ "pdfium/pdfium_assert_matching_enums.cc" ]
195 ":content_restriction",
198 "//third_party/blink/public/common:headers",
199 "//third_party/pdfium",
204 source_set("content_restriction") {
205 # Exists separately to expose this header for testing.
206 public = [ "content_restriction.h" ]
209 source_set("accessibility") {
212 "//components:components_browsertests${exec_target_suffix}",
213 "//components/pdf/renderer",
214 "//components/pdf/renderer:unit_tests",
218 "accessibility_helper.cc",
219 "accessibility_helper.h",
220 "accessibility_structs.cc",
221 "accessibility_structs.h",
222 "pdf_accessibility_action_handler.h",
223 "pdf_accessibility_data_handler.h",
224 "pdf_accessibility_image_fetcher.h",
227 configs += [ ":strict" ]
236 static_library("pdf_view_web_plugin") {
237 assert(enable_plugins, "The PDF viewer relies on plugin infrastructure")
241 "//components/pdf/renderer",
245 "pdf_view_web_plugin.cc",
246 "post_message_receiver.cc",
247 "post_message_receiver.h",
248 "v8_value_converter.h",
251 configs += [ ":strict" ]
253 public = [ "pdf_view_web_plugin.h" ]
255 public_deps = [ "//pdf/mojom" ]
260 ":content_restriction",
269 "//services/network/public/mojom:url_loader_base",
271 "//third_party/blink/public:blink_headers",
272 "//third_party/blink/public/common:headers",
274 "//ui/base/cursor/mojom:cursor_type",
280 if (enable_basic_printing) {
281 deps += [ "//printing" ]
285 source_set("pdf_test_utils") {
286 visibility = [ "//pdf/*" ]
291 "test/mock_web_associated_url_loader.cc",
292 "test/mock_web_associated_url_loader.h",
293 "test/test_client.cc",
294 "test/test_client.h",
295 "test/test_document_loader.cc",
296 "test/test_document_loader.h",
297 "test/test_helpers.cc",
298 "test/test_helpers.h",
299 "test/test_pdfium_engine.cc",
300 "test/test_pdfium_engine.h",
310 "//third_party/blink/public:blink",
312 "//ui/latency:latency",
316 if (is_linux || is_chromeos || is_tizen) {
317 # TODO(crbug.com/702990): After PPAPI deprecation, there will only be one
318 # caller left. Move inside the file with the caller.
319 static_library("font_table_linux") {
320 sources = [ "font_table_linux.cc" ]
322 configs += [ ":strict" ]
324 public = [ "font_table_linux.h" ]
330 test("pdf_unittests") {
334 "document_layout_unittest.cc",
335 "draw_utils/coordinates_unittest.cc",
336 "file_extension_unittest.cc",
337 "page_orientation_unittest.cc",
338 "paint_manager_unittest.cc",
339 "parsed_params_unittest.cc",
340 "pdf_transform_unittest.cc",
341 "pdf_utils/dates_unittest.cc",
342 "pdf_view_web_plugin_unittest.cc",
343 "pdfium/accessibility_unittest.cc",
344 "pdfium/findtext_unittest.cc",
345 "pdfium/pdfium_engine_exports_unittest.cc",
346 "pdfium/pdfium_engine_unittest.cc",
347 "pdfium/pdfium_form_filler_unittest.cc",
348 "pdfium/pdfium_page_unittest.cc",
349 "pdfium/pdfium_permissions_unittest.cc",
350 "pdfium/pdfium_print_unittest.cc",
351 "pdfium/pdfium_range_unittest.cc",
352 "pdfium/pdfium_test_base.cc",
353 "pdfium/pdfium_test_base.h",
354 "test/run_all_unittests.cc",
355 "ui/document_properties_unittest.cc",
356 "ui/file_name_unittest.cc",
357 "ui/thumbnail_unittest.cc",
360 data = [ "test/data/" ]
366 ":content_restriction",
371 ":pdf_view_web_plugin",
374 "//base/test:test_support",
377 "//mojo/core/embedder",
378 "//mojo/public/cpp/bindings",
381 "//pdf/loader:unit_tests",
385 "//third_party/blink/public:blink",
386 "//third_party/blink/public:test_support",
387 "//third_party/blink/public/common:headers",
388 "//third_party/pdfium",
389 "//tools/v8_context_snapshot:buildflags",
392 "//ui/events/blink:blink",
393 "//ui/gfx:test_support",
399 if (enable_basic_printing) {
400 deps += [ "//printing" ]
403 if (v8_use_external_startup_data) {
405 "//tools/v8_context_snapshot",
406 "//tools/v8_context_snapshot:buildflags",
408 configs += [ "//v8:external_startup_data" ]
412 ":pdf_unittests_pak",
413 "//ui/resources:ui_test_pak_data",
422 repack("pdf_unittests_pak") {
424 [ "$root_gen_dir/components/strings/components_strings_en-US.pak" ]
425 output = "$root_out_dir/pdf_tests_resources.pak"
426 deps = [ "//components/strings" ]
429 fuzzer_test("pdf_dates_fuzzer") {
430 sources = [ "pdf_utils/dates_fuzzer.cc" ]
438 # Dummy groups when PDF support is disabled so targets can unconditionally
447 bundle_data_from_filelist("pdf_test_bundle_data") {
449 filelist_name = "test/pdf_test_bundle_data.filelist"