Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: printing/backend/print_backend_cups.cc

Issue 5846001: Making CUPS calls non-blocking.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/backend/print_backend_consts.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/backend/print_backend_cups.cc
===================================================================
--- printing/backend/print_backend_cups.cc (revision 69204)
+++ printing/backend/print_backend_cups.cc (working copy)
@@ -19,6 +19,7 @@
#include "base/values.h"
#include "googleurl/src/gurl.h"
#include "printing/backend/cups_helper.h"
+#include "printing/backend/print_backend_consts.h"
#if !defined(OS_MACOSX)
GCRY_THREAD_OPTION_PTHREAD_IMPL;
@@ -76,11 +77,10 @@
static const char kCUPSPrinterInfoOpt[] = "printer-info";
static const char kCUPSPrinterStateOpt[] = "printer-state";
-static const char kCUPSPrintServerURL[] = "print_server_url";
class PrintBackendCUPS : public PrintBackend {
public:
- explicit PrintBackendCUPS(const GURL& print_server_url);
+ PrintBackendCUPS(const GURL& print_server_url, bool blocking);
virtual ~PrintBackendCUPS() {}
// PrintBackend implementation.
@@ -100,10 +100,11 @@
FilePath GetPPD(const char* name);
GURL print_server_url_;
+ bool blocking_;
};
-PrintBackendCUPS::PrintBackendCUPS(const GURL& print_server_url)
- : print_server_url_(print_server_url) {
+PrintBackendCUPS::PrintBackendCUPS(const GURL& print_server_url, bool blocking)
+ : print_server_url_(print_server_url), blocking_(blocking) {
}
void PrintBackendCUPS::EnumeratePrinters(PrinterList* printer_list) {
@@ -194,13 +195,16 @@
g_gcrypt_initializer.Get();
#endif
- std::string print_server_url_str;
+ std::string print_server_url_str, cups_blocking;
if (print_backend_settings) {
print_backend_settings->GetString(kCUPSPrintServerURL,
&print_server_url_str);
+
+ print_backend_settings->GetString(kCUPSBlocking,
+ &cups_blocking);
}
GURL print_server_url(print_server_url_str.c_str());
- return new PrintBackendCUPS(print_server_url);
+ return new PrintBackendCUPS(print_server_url, cups_blocking == kValueTrue);
}
int PrintBackendCUPS::GetDests(cups_dest_t** dests) {
@@ -208,6 +212,7 @@
return cupsGetDests(dests);
} else {
HttpConnectionCUPS http(print_server_url_);
+ http.SetBlocking(blocking_);
return cupsGetDests2(http.http(), dests);
}
}
@@ -233,7 +238,7 @@
// To distinguish error case from the normal return, will check result file
// size agains content length.
HttpConnectionCUPS http(print_server_url_);
- http.SetBlocking(false);
+ http.SetBlocking(blocking_);
ppd_file_path = cupsGetPPD2(http.http(), name);
// Check if the get full PPD, since non-blocking call may simply return
// normally after timeout expired.
« no previous file with comments | « printing/backend/print_backend_consts.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698