1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This is dummy implementation for all configurations where there is no
6 // print backend.
7 #if !defined(PRINT_BACKEND_AVAILABLE)
8
9 #include "printing/backend/print_backend.h"
10
11 #include "base/values.h"
12
13 namespace printing {
14
15 class DummyPrintBackend : public PrintBackend {
16 public:
DummyPrintBackend(const std::string & locale)17 explicit DummyPrintBackend(const std::string& locale)
18 : PrintBackend(locale) {}
19 DummyPrintBackend(const DummyPrintBackend&) = delete;
20 DummyPrintBackend& operator=(const DummyPrintBackend&) = delete;
21
EnumeratePrinters(PrinterList * printer_list)22 bool EnumeratePrinters(PrinterList* printer_list) override { return false; }
23
GetDefaultPrinterName()24 std::string GetDefaultPrinterName() override { return std::string(); }
25
GetPrinterBasicInfo(const std::string & printer_name,PrinterBasicInfo * printer_info)26 bool GetPrinterBasicInfo(const std::string& printer_name,
27 PrinterBasicInfo* printer_info) override {
28 return false;
29 }
30
GetPrinterSemanticCapsAndDefaults(const std::string & printer_name,PrinterSemanticCapsAndDefaults * printer_info)31 bool GetPrinterSemanticCapsAndDefaults(
32 const std::string& printer_name,
33 PrinterSemanticCapsAndDefaults* printer_info) override {
34 return false;
35 }
36
GetPrinterCapsAndDefaults(const std::string & printer_name,PrinterCapsAndDefaults * printer_info)37 bool GetPrinterCapsAndDefaults(
38 const std::string& printer_name,
39 PrinterCapsAndDefaults* printer_info) override {
40 return false;
41 }
42
GetPrinterDriverInfo(const std::string & printer_name)43 std::string GetPrinterDriverInfo(const std::string& printer_name) override {
44 return std::string();
45 }
46
IsValidPrinter(const std::string & printer_name)47 bool IsValidPrinter(const std::string& printer_name) override {
48 return false;
49 }
50
51 private:
52 ~DummyPrintBackend() override = default;
53 };
54
55 // static
CreateInstanceImpl(const base::DictionaryValue * print_backend_settings,const std::string & locale,bool)56 scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl(
57 const base::DictionaryValue* print_backend_settings,
58 const std::string& locale,
59 bool /*for_cloud_print*/) {
60 return base::MakeRefCounted<DummyPrintBackend>(locale);
61 }
62
63 } // namespace printing
64
65 #endif // PRINT_BACKEND_AVAILABLE
66