forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable the cups backend only when --enable-native-cups is specified.
CUPS printers will now be selectable in the print menus. NOTE: This does not enable printing to said printers. BUG=607668 TEST=Launch chrome with --enable-native-cups flag, open print preview, change printers. See that CUPS printers are listed as available printers. Review-Url: https://codereview.chromium.org/1934013002 Cr-Commit-Position: refs/heads/master@{#402654}
- Loading branch information
skau
authored and
Commit bot
committed
Jun 29, 2016
1 parent
709246a
commit 8ffe775
Showing
7 changed files
with
119 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2016 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. | ||
|
||
#ifndef PRINTING_BACKEND_PRINT_BACKEND_CUPS_H_ | ||
#define PRINTING_BACKEND_PRINT_BACKEND_CUPS_H_ | ||
|
||
#include <string> | ||
|
||
#include "base/files/file_util.h" | ||
#include "printing/backend/cups_helper.h" | ||
#include "printing/backend/print_backend.h" | ||
#include "url/gurl.h" | ||
|
||
namespace printing { | ||
|
||
class PrintBackendCUPS : public PrintBackend { | ||
public: | ||
PrintBackendCUPS(const GURL& print_server_url, | ||
http_encryption_t encryption, | ||
bool blocking); | ||
|
||
private: | ||
~PrintBackendCUPS() override {} | ||
|
||
// PrintBackend implementation. | ||
bool EnumeratePrinters(PrinterList* printer_list) override; | ||
std::string GetDefaultPrinterName() override; | ||
bool GetPrinterBasicInfo(const std::string& printer_name, | ||
PrinterBasicInfo* printer_info) override; | ||
bool GetPrinterSemanticCapsAndDefaults( | ||
const std::string& printer_name, | ||
PrinterSemanticCapsAndDefaults* printer_info) override; | ||
bool GetPrinterCapsAndDefaults(const std::string& printer_name, | ||
PrinterCapsAndDefaults* printer_info) override; | ||
std::string GetPrinterDriverInfo(const std::string& printer_name) override; | ||
bool IsValidPrinter(const std::string& printer_name) override; | ||
|
||
// The following functions are wrappers around corresponding CUPS functions. | ||
// <functions>2() are called when print server is specified, and plain version | ||
// in another case. There is an issue specifying CUPS_HTTP_DEFAULT in the | ||
// functions>2(), it does not work in CUPS prior to 1.4. | ||
int GetDests(cups_dest_t** dests); | ||
base::FilePath GetPPD(const char* name); | ||
|
||
// Wrapper around cupsGetNamedDest(). Returned result should be freed with | ||
// cupsFreeDests(). | ||
cups_dest_t* GetNamedDest(const std::string& printer_name); | ||
|
||
GURL print_server_url_; | ||
http_encryption_t cups_encryption_; | ||
bool blocking_; | ||
}; | ||
|
||
} // namespace printing | ||
|
||
#endif // PRINTING_BACKEND_PRINT_BACKEND_CUPS_H_ |