Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PRINTING_PRINTING_CONTEXT_NO_SYSTEM_DIALOG_H_ | 5 #ifndef PRINTING_PRINTING_CONTEXT_CHROMEOS_H_ |
| 6 #define PRINTING_PRINTING_CONTEXT_NO_SYSTEM_DIALOG_H_ | 6 #define PRINTING_PRINTING_CONTEXT_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <memory> | |
| 8 #include <string> | 9 #include <string> |
| 10 #include <vector> | |
| 9 | 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "printing/backend/cups_connection.h" | |
| 14 #include "printing/backend/cups_printer.h" | |
| 11 #include "printing/printing_context.h" | 15 #include "printing/printing_context.h" |
| 12 | 16 |
| 13 namespace base { | 17 namespace base { |
| 14 class DictionaryValue; | 18 class DictionaryValue; |
| 15 } | 19 } |
| 16 | 20 |
| 17 namespace printing { | 21 namespace printing { |
| 18 | 22 |
| 19 class PRINTING_EXPORT PrintingContextNoSystemDialog : public PrintingContext { | 23 class PRINTING_EXPORT PrintingContextChromeos : public PrintingContext { |
| 20 public: | 24 public: |
| 21 explicit PrintingContextNoSystemDialog(Delegate* delegate); | 25 explicit PrintingContextChromeos(Delegate* delegate); |
| 22 ~PrintingContextNoSystemDialog() override; | 26 ~PrintingContextChromeos() override; |
| 23 | 27 |
| 24 // PrintingContext implementation. | 28 // PrintingContext implementation. |
| 25 void AskUserForSettings(int max_pages, | 29 void AskUserForSettings(int max_pages, |
| 26 bool has_selection, | 30 bool has_selection, |
| 27 bool is_scripted, | 31 bool is_scripted, |
| 28 const PrintSettingsCallback& callback) override; | 32 const PrintSettingsCallback& callback) override; |
| 29 Result UseDefaultSettings() override; | 33 Result UseDefaultSettings() override; |
| 30 gfx::Size GetPdfPaperSizeDeviceUnits() override; | 34 gfx::Size GetPdfPaperSizeDeviceUnits() override; |
| 31 Result UpdatePrinterSettings(bool external_preview, | 35 Result UpdatePrinterSettings(bool external_preview, |
| 32 bool show_system_dialog, | 36 bool show_system_dialog, |
| 33 int page_count) override; | 37 int page_count) override; |
| 34 Result InitWithSettings(const PrintSettings& settings) override; | 38 Result InitWithSettings(const PrintSettings& settings) override; |
| 35 Result NewDocument(const base::string16& document_name) override; | 39 Result NewDocument(const base::string16& document_name) override; |
| 36 Result NewPage() override; | 40 Result NewPage() override; |
| 37 Result PageDone() override; | 41 Result PageDone() override; |
| 38 Result DocumentDone() override; | 42 Result DocumentDone() override; |
| 39 void Cancel() override; | 43 void Cancel() override; |
| 40 void ReleaseContext() override; | 44 void ReleaseContext() override; |
| 41 gfx::NativeDrawingContext context() const override; | 45 gfx::NativeDrawingContext context() const override; |
| 42 | 46 |
| 47 Result StreamData(const std::vector<char>& buffer); | |
| 48 | |
| 43 private: | 49 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(PrintingContextNoSystemDialog); | 50 // Lazily initializes |printer_|. |
| 51 Result InitializeDevice(const std::string& device); | |
| 52 | |
| 53 // id for ongoing print job. -1 if no job is active. | |
|
Lei Zhang
2016/07/25 21:06:04
printing_context_chromeos.cc checks for 0, what is
skau
2016/07/27 00:16:47
If the createDestJob fails, job_id is set to 0. I
| |
| 54 int job_id_; | |
| 55 | |
| 56 CupsConnection connection_; | |
| 57 std::unique_ptr<CupsPrinter> printer_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(PrintingContextChromeos); | |
| 45 }; | 60 }; |
| 46 | 61 |
| 47 } // namespace printing | 62 } // namespace printing |
| 48 | 63 |
| 49 #endif // PRINTING_PRINTING_CONTEXT_NO_SYSTEM_DIALOG_H_ | 64 #endif // PRINTING_PRINTING_CONTEXT_CHROMEOS_H_ |
| OLD | NEW |