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/features.gni")
6 import("//build/config/ui.gni")
8 import("//build/config/mac/mac_sdk.gni")
11 import("//build/config/android/rules.gni")
14 component("printing") {
16 "backend/print_backend.cc",
17 "backend/print_backend.h",
18 "backend/print_backend_consts.cc",
19 "backend/print_backend_consts.h",
20 "backend/print_backend_dummy.cc",
21 "backend/printing_info_win.cc",
22 "backend/printing_info_win.h",
33 "metafile_skia_wrapper.cc",
34 "metafile_skia_wrapper.h",
41 "page_size_margins.h",
42 "pdf_metafile_cg_mac.cc",
43 "pdf_metafile_cg_mac.h",
44 "pdf_metafile_skia.cc",
45 "pdf_metafile_skia.h",
46 "print_dialog_gtk_interface.h",
47 "print_job_constants.cc",
48 "print_job_constants.h",
51 "print_settings_conversion.cc",
52 "print_settings_conversion.h",
53 "print_settings_initializer_mac.cc",
54 "print_settings_initializer_mac.h",
55 "print_settings_initializer_win.cc",
56 "print_settings_initializer_win.h",
57 "printed_document.cc",
59 "printed_document_linux.cc",
60 "printed_document_mac.cc",
61 "printed_document_win.cc",
64 "printed_pages_source.h",
65 "printing_context.cc",
74 defines = [ "PRINTING_IMPLEMENTATION" ]
79 "//base/third_party/dynamic_annotations",
88 deps += [ "//ui/aura" ]
92 # Mac-Aura does not support printing.
94 sources -= [ "printed_document_mac.cc" ]
97 "printing_context_mac.mm",
98 "printing_context_mac.h",
104 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation of the
105 # print backend and enables a custom implementation instead.
106 defines += [ "PRINT_BACKEND_AVAILABLE" ]
108 "backend/win_helper.cc",
109 "backend/win_helper.h",
110 "backend/print_backend_win.cc",
111 "printing_context_system_dialog_win.cc",
112 "printing_context_system_dialog_win.h",
113 "printing_context_win.cc",
114 "printing_context_win.h",
120 "printing_context_no_system_dialog.cc",
121 "printing_context_no_system_dialog.h",
126 configs += [ ":cups" ]
129 cups_version = exec_script("cups_config_helper.py",
133 if (cups_version == "1.6" || cups_version == "1.7") {
135 # CUPS 1.6 deprecated the PPD APIs, but we will stay with this
136 # API for now as supported Linux and Mac OS'es are still using
137 # older versions of CUPS. More info: crbug.com/226176
138 "-Wno-deprecated-declarations",
139 # CUPS 1.7 deprecates httpConnectEncrypt(), see the mac section
145 if (is_mac && mac_sdk_version == "10.9") {
146 # The 10.9 SDK includes cups 1.7, which deprecates
147 # httpConnectEncrypt() in favor of httpConnect2(). hhttpConnect2()
148 # is new in 1.7, so it doesn't exist on OS X 10.6-10.8 and we
149 # can't use it until 10.9 is our minimum system version.
150 # (cups_version isn't reliable on OS X, so key the check off of
152 cflags += [ "-Wno-deprecated-declarations" ]
155 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
156 # of the print backend and enables a custom implementation instead.
157 defines += [ "PRINT_BACKEND_AVAILABLE" ]
160 "backend/cups_helper.cc",
161 "backend/cups_helper.h",
162 "backend/print_backend_cups.cc",
167 # PRINT_BACKEND_AVAILABLE disables the default dummy implementation
168 # of the print backend and enables a custom implementation instead.
169 defines += [ "PRINT_BACKEND_AVAILABLE" ]
171 sources += [ "backend/print_backend_chromeos.cc" ]
172 } else if (is_linux) { # Non-ChromeOS Linux.
174 "printing_context_linux.cc",
175 "printing_context_linux.h",
181 "printing_context_android.cc",
182 "printing_context_android.h",
185 deps += [ ":printing_jni_headers" ]
189 test("printing_unittests") {
191 "emf_win_unittest.cc",
192 "page_number_unittest.cc",
193 "page_range_unittest.cc",
194 "page_setup_unittest.cc",
195 "pdf_metafile_cg_mac_unittest.cc",
196 "printed_page_unittest.cc",
197 "printing_context_win_unittest.cc",
199 "printing_utils_unittest.cc",
204 configs += [ ":cups" ]
205 sources += [ "backend/cups_helper_unittest.cc" ]
211 "//base/test:run_all_unittests",
212 "//base/test:test_support",
216 "//ui/gfx:test_support",
223 defines = [ "USE_CUPS" ]
226 ldflags = [ "$mac_sdk_path/usr/lib/libcups.dylib" ]
228 libs = exec_script("cups_config_helper.py", [ "--libs-for-gn" ], "value")
234 # GYP: //printing/printing.gyp:printing_jni_headers
235 generate_jni("printing_jni_headers") {
237 "android/java/src/org/chromium/printing/PrintingContext.java",
239 jni_package = "printing"
242 # GYP: //printing/printing.gyp:printing_java
243 android_library("printing_java") {
247 DEPRECATED_java_in_dir = "android/java/src"