RPM build for ungoogled-chromium
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
6.8 KiB

  1. diff -up chromium-84.0.4147.89/chrome/service/cloud_print/print_system_cups.cc.el7cups chromium-84.0.4147.89/chrome/service/cloud_print/print_system_cups.cc
  2. --- chromium-84.0.4147.89/chrome/service/cloud_print/print_system_cups.cc.el7cups 2020-07-13 14:41:23.000000000 -0400
  3. +++ chromium-84.0.4147.89/chrome/service/cloud_print/print_system_cups.cc 2020-07-15 10:16:30.482337332 -0400
  4. @@ -725,8 +725,9 @@ int PrintSystemCUPS::PrintFile(const GUR
  5. // Use default (local) print server.
  6. if (url.is_empty())
  7. return cupsPrintFile(name, filename, title, num_options, options);
  8. -
  9. - printing::HttpConnectionCUPS http(url, encryption, /*blocking=*/false);
  10. +
  11. + printing::HttpConnectionCUPS http(url, encryption);
  12. + http.SetBlocking(false);
  13. return cupsPrintFile2(http.http(), name, filename, title, num_options,
  14. options);
  15. }
  16. @@ -742,7 +743,8 @@ int PrintSystemCUPS::GetJobs(cups_job_t*
  17. if (url.is_empty())
  18. return cupsGetJobs(jobs, name, myjobs, whichjobs);
  19. - printing::HttpConnectionCUPS http(url, encryption, /*blocking=*/false);
  20. + printing::HttpConnectionCUPS http(url, encryption);
  21. + http.SetBlocking(false);
  22. return cupsGetJobs2(http.http(), jobs, name, myjobs, whichjobs);
  23. }
  24. diff -up chromium-84.0.4147.89/printing/backend/cups_helper.cc.el7cups chromium-84.0.4147.89/printing/backend/cups_helper.cc
  25. --- chromium-84.0.4147.89/printing/backend/cups_helper.cc.el7cups 2020-07-13 14:41:27.000000000 -0400
  26. +++ chromium-84.0.4147.89/printing/backend/cups_helper.cc 2020-07-15 10:17:37.551296816 -0400
  27. @@ -33,18 +33,6 @@ namespace printing {
  28. // This section contains helper code for PPD parsing for semantic capabilities.
  29. namespace {
  30. -// Function availability can be tested by checking whether its address is not
  31. -// nullptr. Weak symbols remove the need for platform specific build flags and
  32. -// allow for appropriate CUPS usage on platforms with non-uniform version
  33. -// support, namely Linux.
  34. -#define WEAK_CUPS_FN(x) extern "C" __attribute__((weak)) decltype(x) x
  35. -
  36. -WEAK_CUPS_FN(httpConnect2);
  37. -
  38. -// Timeout for establishing a CUPS connection. It is expected that cupsd is
  39. -// able to start and respond on all systems within this duration.
  40. -constexpr base::TimeDelta kCupsTimeout = base::TimeDelta::FromSeconds(5);
  41. -
  42. // CUPS default max copies value (parsed from kCupsMaxCopies PPD attribute).
  43. constexpr int32_t kDefaultMaxCopies = 9999;
  44. constexpr char kCupsMaxCopies[] = "cupsMaxCopies";
  45. @@ -552,8 +540,7 @@ const int kDefaultIPPServerPort = 631;
  46. // Helper wrapper around http_t structure, with connection and cleanup
  47. // functionality.
  48. HttpConnectionCUPS::HttpConnectionCUPS(const GURL& print_server_url,
  49. - http_encryption_t encryption,
  50. - bool blocking)
  51. + http_encryption_t encryption)
  52. : http_(nullptr) {
  53. // If we have an empty url, use default print server.
  54. if (print_server_url.is_empty())
  55. @@ -563,17 +550,10 @@ HttpConnectionCUPS::HttpConnectionCUPS(c
  56. if (port == url::PORT_UNSPECIFIED)
  57. port = kDefaultIPPServerPort;
  58. - if (httpConnect2) {
  59. - http_ = httpConnect2(print_server_url.host().c_str(), port,
  60. - /*addrlist=*/nullptr, AF_UNSPEC, encryption,
  61. - blocking ? 1 : 0, kCupsTimeout.InMilliseconds(),
  62. - /*cancel=*/nullptr);
  63. - } else {
  64. - // Continue to use deprecated CUPS calls because because older Linux
  65. - // distribution such as RHEL/CentOS 7 are shipped with CUPS 1.6.
  66. - http_ =
  67. - httpConnectEncrypt(print_server_url.host().c_str(), port, encryption);
  68. - }
  69. + // Continue to use deprecated CUPS calls because because older Linux
  70. + // distribution such as RHEL/CentOS 7 are shipped with CUPS 1.6.
  71. + http_ =
  72. + httpConnectEncrypt(print_server_url.host().c_str(), port, encryption);
  73. if (!http_) {
  74. LOG(ERROR) << "CP_CUPS: Failed connecting to print server: "
  75. @@ -581,8 +561,6 @@ HttpConnectionCUPS::HttpConnectionCUPS(c
  76. return;
  77. }
  78. - if (!httpConnect2)
  79. - httpBlocking(http_, blocking ? 1 : 0);
  80. }
  81. HttpConnectionCUPS::~HttpConnectionCUPS() {
  82. @@ -590,6 +568,10 @@ HttpConnectionCUPS::~HttpConnectionCUPS(
  83. httpClose(http_);
  84. }
  85. +void HttpConnectionCUPS::SetBlocking(bool blocking) {
  86. + httpBlocking(http_, blocking ? 1 : 0);
  87. +}
  88. +
  89. http_t* HttpConnectionCUPS::http() {
  90. return http_;
  91. }
  92. diff -up chromium-84.0.4147.89/printing/backend/cups_helper.h.el7cups chromium-84.0.4147.89/printing/backend/cups_helper.h
  93. --- chromium-84.0.4147.89/printing/backend/cups_helper.h.el7cups 2020-07-13 14:41:27.000000000 -0400
  94. +++ chromium-84.0.4147.89/printing/backend/cups_helper.h 2020-07-15 10:16:30.486337271 -0400
  95. @@ -23,10 +23,11 @@ struct PrinterSemanticCapsAndDefaults;
  96. class PRINTING_EXPORT HttpConnectionCUPS {
  97. public:
  98. HttpConnectionCUPS(const GURL& print_server_url,
  99. - http_encryption_t encryption,
  100. - bool blocking);
  101. + http_encryption_t encryption);
  102. ~HttpConnectionCUPS();
  103. + void SetBlocking(bool blocking);
  104. +
  105. http_t* http();
  106. private:
  107. diff -up chromium-84.0.4147.89/printing/backend/print_backend_cups.cc.el7cups chromium-84.0.4147.89/printing/backend/print_backend_cups.cc
  108. --- chromium-84.0.4147.89/printing/backend/print_backend_cups.cc.el7cups 2020-07-13 14:41:27.000000000 -0400
  109. +++ chromium-84.0.4147.89/printing/backend/print_backend_cups.cc 2020-07-15 10:16:30.487337255 -0400
  110. @@ -250,7 +250,8 @@ int PrintBackendCUPS::GetDests(cups_dest
  111. if (print_server_url_.is_empty())
  112. return cupsGetDests2(CUPS_HTTP_DEFAULT, dests);
  113. - HttpConnectionCUPS http(print_server_url_, cups_encryption_, blocking_);
  114. + HttpConnectionCUPS http(print_server_url_, cups_encryption_);
  115. + http.SetBlocking(blocking_);
  116. // This call must be made in the same scope as |http| because its destructor
  117. // closes the connection.
  118. @@ -276,7 +277,8 @@ base::FilePath PrintBackendCUPS::GetPPD(
  119. // connection will timeout after 10 seconds of no data period. And it will
  120. // return the same way as if data was completely and successfully
  121. // downloaded.
  122. - HttpConnectionCUPS http(print_server_url_, cups_encryption_, blocking_);
  123. + HttpConnectionCUPS http(print_server_url_, cups_encryption_);
  124. + http.SetBlocking(blocking_);
  125. ppd_file_path = cupsGetPPD2(http.http(), name);
  126. // Check if the get full PPD, since non-blocking call may simply return
  127. // normally after timeout expired.
  128. @@ -312,7 +314,8 @@ PrintBackendCUPS::ScopedDestination Prin
  129. // Use default (local) print server.
  130. dest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, printer_name.c_str(), nullptr);
  131. } else {
  132. - HttpConnectionCUPS http(print_server_url_, cups_encryption_, blocking_);
  133. + HttpConnectionCUPS http(print_server_url_, cups_encryption_);
  134. + http.SetBlocking(blocking_);
  135. dest = cupsGetNamedDest(http.http(), printer_name.c_str(), nullptr);
  136. }
  137. return ScopedDestination(dest);