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

Unified Diff: printing/backend/cups_helper.cc

Issue 3945003: Move useful printing backend code from chrome/service/cloud_print to printing... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: resolve merge conflict Created 10 years, 2 months 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/cups_helper.h ('k') | printing/backend/print_backend.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/backend/cups_helper.cc
===================================================================
--- printing/backend/cups_helper.cc (revision 0)
+++ printing/backend/cups_helper.cc (revision 0)
@@ -0,0 +1,44 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "printing/backend/cups_helper.h"
+
+#include "base/logging.h"
+#include "googleurl/src/gurl.h"
+
+namespace printing {
+
+// Default port for IPP print servers.
+static const int kDefaultIPPServerPort = 631;
+
+// Helper wrapper around http_t structure, with connection and cleanup
+// functionality.
+HttpConnectionCUPS::HttpConnectionCUPS(const GURL& print_server_url)
+ : http_(NULL) {
+ // If we have an empty url, use default print server.
+ if (print_server_url.is_empty())
+ return;
+
+ int port = print_server_url.IntPort();
+ if (port == url_parse::PORT_UNSPECIFIED)
+ port = kDefaultIPPServerPort;
+
+ http_ = httpConnectEncrypt(print_server_url.host().c_str(), port,
+ HTTP_ENCRYPT_NEVER);
+ if (http_ == NULL) {
+ LOG(ERROR) << "CP_CUPS: Failed connecting to print server: " <<
+ print_server_url;
+ }
+}
+
+HttpConnectionCUPS::~HttpConnectionCUPS() {
+ if (http_ != NULL)
+ httpClose(http_);
+}
+
+http_t* HttpConnectionCUPS::http() {
+ return http_;
+}
+
+} // namespace printing
Property changes on: printing/backend/cups_helper.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « printing/backend/cups_helper.h ('k') | printing/backend/print_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698