diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-25 20:05:44 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-25 20:05:44 +0000 |
commit | 8e553f499860ac0b3bdea8326b7bc95a7650e250 (patch) | |
tree | 7c28ec6cbfae93e10038d97507a936a6e918aa2b /printing/backend/print_backend.h | |
parent | 992848f4eb2e39e73b0bc2932253e9396eaf0369 (diff) | |
download | chromium_src-8e553f499860ac0b3bdea8326b7bc95a7650e250.zip chromium_src-8e553f499860ac0b3bdea8326b7bc95a7650e250.tar.gz chromium_src-8e553f499860ac0b3bdea8326b7bc95a7650e250.tar.bz2 |
Move useful printing backend code from chrome/service/cloud_print to printing/backend.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3945003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63772 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/backend/print_backend.h')
-rw-r--r-- | printing/backend/print_backend.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/printing/backend/print_backend.h b/printing/backend/print_backend.h new file mode 100644 index 0000000..3b55268 --- /dev/null +++ b/printing/backend/print_backend.h @@ -0,0 +1,70 @@ +// 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. + +#ifndef PRINTING_BACKEND_PRINT_BACKEND_H_ +#define PRINTING_BACKEND_PRINT_BACKEND_H_ +#pragma once + +#include <map> +#include <string> +#include <vector> + +#include "base/ref_counted.h" + +class DictionaryValue; + +// This is the interface for platform-specific code for a print backend +namespace printing { + +struct PrinterBasicInfo { + PrinterBasicInfo(); + ~PrinterBasicInfo(); + + std::string printer_name; + std::string printer_description; + int printer_status; + std::map<std::string, std::string> options; +}; + +typedef std::vector<PrinterBasicInfo> PrinterList; + +struct PrinterCapsAndDefaults { + std::string printer_capabilities; + std::string caps_mime_type; + std::string printer_defaults; + std::string defaults_mime_type; +}; + +// PrintBackend class will provide interface for different print backends +// (Windows, CUPS) to implement. User will call CreateInstance() to +// obtain available print backend. +// Please note, that PrintBackend is not platform specific, but rather +// print system specific. For example, CUPS is available on both Linux and Mac, +// but not available on ChromeOS, etc. This design allows us to add more +// functionality on some platforms, while reusing core (CUPS) functions. +class PrintBackend : public base::RefCountedThreadSafe<PrintBackend> { + public: + virtual ~PrintBackend(); + + // Enumerates the list of installed local and network printers. + virtual void EnumeratePrinters(PrinterList* printer_list) = 0; + + // Gets the capabilities and defaults for a specific printer. + virtual bool GetPrinterCapsAndDefaults( + const std::string& printer_name, + PrinterCapsAndDefaults* printer_info) = 0; + + // Returns true if printer_name points to a valid printer. + virtual bool IsValidPrinter(const std::string& printer_name) = 0; + + // Allocate a print backend. If |print_backend_settings| is NULL, default + // settings will be used. + // Return NULL if no print backend available. + static scoped_refptr<PrintBackend> CreateInstance( + const DictionaryValue* print_backend_settings); +}; + +} // namespace printing + +#endif // PRINTING_BACKEND_PRINT_BACKEND_H_ |