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 import("//build/config/mac/mac_sdk.gni")
10 import("//build/config/android/rules.gni")
13 use_cups = ((is_linux && !is_chromeos) || is_mac)
15 component("printing") {
17 "backend/print_backend.cc",
18 "backend/print_backend.h",
19 "backend/print_backend_consts.cc",
20 "backend/print_backend_consts.h",
21 "backend/print_backend_dummy.cc",
22 "backend/printing_info_win.cc",
23 "backend/printing_info_win.h",
34 "metafile_skia_wrapper.cc",
35 "metafile_skia_wrapper.h",
42 "page_size_margins.h",
43 "pdf_metafile_cg_mac.cc",
44 "pdf_metafile_cg_mac.h",
45 "pdf_metafile_skia.cc",
46 "pdf_metafile_skia.h",
47 "print_destination_interface.h",
48 "print_destination_none.cc",
49 "print_dialog_gtk_interface.h",
50 "print_job_constants.cc",
51 "print_job_constants.h",
54 "print_settings_conversion.cc",
55 "print_settings_conversion.h",
56 "print_settings_initializer_mac.cc",
57 "print_settings_initializer_mac.h",
58 "print_settings_initializer_win.cc",
59 "print_settings_initializer_win.h",
60 "printed_document.cc",
62 "printed_document_linux.cc",
63 "printed_document_mac.cc",
64 "printed_document_win.cc",
67 "printed_pages_source.h",
68 "printing_context.cc",
77 defines = [ "PRINTING_IMPLEMENTATION" ]
82 "//base/third_party/dynamic_annotations",
91 # deps += [ "//ui/aura" ] TODO(GYP)
95 # Mac-Aura does not support printing.
98 "printed_document_mac.cc",
102 "printing_context_mac.mm",
103 "printing_context_mac.h",
109 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation of the
110 # print backend and enables a custom implementation instead.
111 defines += [ "PRINT_BACKEND_AVAILABLE" ]
113 "backend/win_helper.cc",
114 "backend/win_helper.h",
115 "backend/print_backend_win.cc",
116 "printing_context_win.cc",
117 "printing_context_win.h",
123 "printing_context_no_system_dialog.cc",
124 "printing_context_no_system_dialog.h",
129 cups_version = exec_script("cups_config_helper.py", [ "--api-version" ],
132 configs += [ ":cups" ]
135 if (cups_version == "1.6" || cups_version == "1.7") {
137 # CUPS 1.6 deprecated the PPD APIs, but we will stay with this
138 # API for now as supported Linux and Mac OS'es are still using
139 # older versions of CUPS. More info: crbug.com/226176
140 "-Wno-deprecated-declarations",
141 # CUPS 1.7 deprecates httpConnectEncrypt(), see the mac section
147 if (is_mac && mac_sdk_version == "10.9") {
148 # The 10.9 SDK includes cups 1.7, which deprecates
149 # httpConnectEncrypt() in favor of httpConnect2(). hhttpConnect2()
150 # is new in 1.7, so it doesn't exist on OS X 10.6-10.8 and we
151 # can't use it until 10.9 is our minimum system version.
152 # (cups_version isn't reliable on OS X, so key the check off of
154 cflags += [ "-Wno-deprecated-declarations" ]
157 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
158 # of the print backend and enables a custom implementation instead.
159 defines += [ "PRINT_BACKEND_AVAILABLE" ]
162 "backend/cups_helper.cc",
163 "backend/cups_helper.h",
164 "backend/print_backend_cups.cc",
169 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
170 # of the print backend and enables a custom implementation instead.
171 defines += [ "PRINT_BACKEND_AVAILABLE" ]
174 "backend/print_backend_chromeos.cc",
176 } else if (is_linux) { # Non-ChromeOS Linux.
178 "printing_context_linux.cc",
179 "printing_context_linux.h",
185 "printing_context_android.cc",
186 "printing_context_android.h",
189 deps += [ ":printing_jni_headers" ]
193 test("printing_unittests") {
195 "emf_win_unittest.cc",
196 "page_number_unittest.cc",
197 "page_range_unittest.cc",
198 "page_setup_unittest.cc",
199 "pdf_metafile_cg_mac_unittest.cc",
200 "printed_page_unittest.cc",
201 "printing_context_win_unittest.cc",
203 "printing_utils_unittest.cc",
208 configs += [ ":cups" ]
209 sources += [ "backend/cups_helper_unittest.cc" ]
215 "//base/test:run_all_unittests",
216 "//base/test:test_support",
226 defines = [ "USE_CUPS" ]
229 libs = [ "libcups.dylib" ]
231 libs = exec_script("cups_config_helper.py", [ "--libs-for-gn" ], "value")
237 generate_jni("printing_jni_headers") {
239 "android/java/src/org/chromium/printing/PrintingContext.java",
241 jni_package = "printing"
246 # 'target_name': 'printing_java',
249 # 'java_in_dir': '../printing/android/java',
252 # '../base/base.gyp:base_java',
254 # 'includes': [ '../build/java.gypi' ],