diff options
author | abodenha@chromium.org <abodenha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 00:01:27 +0000 |
---|---|---|
committer | abodenha@chromium.org <abodenha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 00:01:27 +0000 |
commit | b579afd5e836551367c5a96be8c699df6cba7554 (patch) | |
tree | 82c7d19e53121b21bc914a0fa750ff7451e99c4f /printing | |
parent | 753469d74234fe099fd4ce21178ea1e92b15535e (diff) | |
download | chromium_src-b579afd5e836551367c5a96be8c699df6cba7554.zip chromium_src-b579afd5e836551367c5a96be8c699df6cba7554.tar.gz chromium_src-b579afd5e836551367c5a96be8c699df6cba7554.tar.bz2 |
Initial support for cloudprint in print preview.
To enable in Windows/Mac/Linux pass "--enable-cloud-print --enable-print-preview" on the command line.
To enable in ChromeOS open about:flags and enable print preview.
This first pass extends the print preview UI to retrieve a printer list from cloud print and to allow printing to a cloud print printer.
Limitations/known issues:
Sign in opens a new tab and requires the print preview page to be refreshed after sign in.
Only pulls the first 10 GCP printers.
Job settings are very limited. Only sets color and only for a limited set of printers.
BUG=80004
TEST=
When running with default flags the only visible change should be that "Manage Printers" is now "Manage Local Printers"
With flags set as above there should be new entries in the printer selection dropdown allowing the use of cloud printers. It should be possible to sign in to cloud print, open the management page, and be able to print documents to cloud printers.
Review URL: http://codereview.chromium.org/7038028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r-- | printing/backend/print_backend_chromeos.cc | 60 | ||||
-rw-r--r-- | printing/print_job_constants.cc | 3 | ||||
-rw-r--r-- | printing/print_job_constants.h | 1 | ||||
-rw-r--r-- | printing/printing.gyp | 10 |
4 files changed, 74 insertions, 0 deletions
diff --git a/printing/backend/print_backend_chromeos.cc b/printing/backend/print_backend_chromeos.cc new file mode 100644 index 0000000..c61bc1d --- /dev/null +++ b/printing/backend/print_backend_chromeos.cc @@ -0,0 +1,60 @@ +// Copyright (c) 2011 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/print_backend.h" + +#include "base/logging.h" + +namespace printing { + +// Provides a stubbed out PrintBackend implementation for use on ChromeOS. +class PrintBackendChromeOS : public PrintBackend { + public: + PrintBackendChromeOS(); + virtual ~PrintBackendChromeOS() {} + + // PrintBackend implementation. + virtual bool EnumeratePrinters(PrinterList* printer_list); + + virtual std::string GetDefaultPrinterName(); + + virtual bool GetPrinterCapsAndDefaults(const std::string& printer_name, + PrinterCapsAndDefaults* printer_info); + + virtual bool IsValidPrinter(const std::string& printer_name); + + private: +}; + +PrintBackendChromeOS::PrintBackendChromeOS() {} + +bool PrintBackendChromeOS::EnumeratePrinters(PrinterList* printer_list) { + return true; +} + + + +bool PrintBackendChromeOS::GetPrinterCapsAndDefaults( + const std::string& printer_name, + PrinterCapsAndDefaults* printer_info) { + NOTREACHED(); + return false; +} + +std::string PrintBackendChromeOS::GetDefaultPrinterName() { + return std::string(); +} + +bool PrintBackendChromeOS::IsValidPrinter(const std::string& printer_name) { + NOTREACHED(); + return true; +} + +scoped_refptr<PrintBackend> PrintBackend::CreateInstance( + const base::DictionaryValue* print_backend_settings) { + return new PrintBackendChromeOS(); +} + +} // namespace printing + diff --git a/printing/print_job_constants.cc b/printing/print_job_constants.cc index d8eb0ce..7e2f634 100644 --- a/printing/print_job_constants.cc +++ b/printing/print_job_constants.cc @@ -6,6 +6,9 @@ namespace printing { +// Print using cloud print: true if selected, false if not. +const char kSettingCloudPrintId[] = "cloudPrintID"; + // Print job setting 'collate'. const char kSettingCollate[] = "collate"; diff --git a/printing/print_job_constants.h b/printing/print_job_constants.h index 0f43b7f..40b9231 100644 --- a/printing/print_job_constants.h +++ b/printing/print_job_constants.h @@ -7,6 +7,7 @@ namespace printing { +extern const char kSettingCloudPrintId[]; extern const char kSettingCollate[]; extern const char kSettingColor[]; extern const char kSettingCopies[]; diff --git a/printing/printing.gyp b/printing/printing.gyp index 68465e2..55bc9b5 100644 --- a/printing/printing.gyp +++ b/printing/printing.gyp @@ -147,6 +147,16 @@ 'backend/print_backend_cups.cc', ], }], + ['OS=="linux" and chromeos==1', { + 'defines': [ + # PRINT_BACKEND_AVAILABLE disables the default dummy implementation + # of the print backend and enables a custom implementation instead. + 'PRINT_BACKEND_AVAILABLE', + ], + 'sources': [ + 'backend/print_backend_chromeos.cc', + ], + }], ], }, { |