Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: printing/printing_context_chromeos.h

Issue 2117713002: Print directly to CUPS using the IPP APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ippRead
Patch Set: Loggin cleaned up Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <cups/cups.h>
9
10 #include <memory>
8 #include <string> 11 #include <string>
12 #include <vector>
9 13
10 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "printing/backend/cups_connection.h"
16 #include "printing/backend/cups_printer.h"
17 #include "printing/backend/print_backend.h"
11 #include "printing/printing_context.h" 18 #include "printing/printing_context.h"
12 19
13 namespace base { 20 namespace base {
14 class DictionaryValue; 21 class DictionaryValue;
15 } 22 }
16 23
17 namespace printing { 24 namespace printing {
18 25
19 class PRINTING_EXPORT PrintingContextNoSystemDialog : public PrintingContext { 26 class PRINTING_EXPORT PrintingContextChromeos : public PrintingContext {
20 public: 27 public:
21 explicit PrintingContextNoSystemDialog(Delegate* delegate); 28 explicit PrintingContextChromeos(Delegate* delegate);
22 ~PrintingContextNoSystemDialog() override; 29 ~PrintingContextChromeos() override;
23 30
24 // PrintingContext implementation. 31 // PrintingContext implementation.
25 void AskUserForSettings(int max_pages, 32 void AskUserForSettings(int max_pages,
26 bool has_selection, 33 bool has_selection,
27 bool is_scripted, 34 bool is_scripted,
28 const PrintSettingsCallback& callback) override; 35 const PrintSettingsCallback& callback) override;
29 Result UseDefaultSettings() override; 36 Result UseDefaultSettings() override;
30 gfx::Size GetPdfPaperSizeDeviceUnits() override; 37 gfx::Size GetPdfPaperSizeDeviceUnits() override;
31 Result UpdatePrinterSettings(bool external_preview, 38 Result UpdatePrinterSettings(bool external_preview,
32 bool show_system_dialog, 39 bool show_system_dialog,
33 int page_count) override; 40 int page_count) override;
34 Result InitWithSettings(const PrintSettings& settings) override; 41 Result InitWithSettings(const PrintSettings& settings) override;
42
43 Result StreamData(char* buffer, int len);
44
35 Result NewDocument(const base::string16& document_name) override; 45 Result NewDocument(const base::string16& document_name) override;
36 Result NewPage() override; 46 Result NewPage() override;
37 Result PageDone() override; 47 Result PageDone() override;
38 Result DocumentDone() override; 48 Result DocumentDone() override;
39 void Cancel() override; 49 void Cancel() override;
40 void ReleaseContext() override; 50 void ReleaseContext() override;
41 gfx::NativeDrawingContext context() const override; 51 gfx::NativeDrawingContext context() const override;
42 52
43 private: 53 private:
44 DISALLOW_COPY_AND_ASSIGN(PrintingContextNoSystemDialog); 54 Result InitializeDevice(const std::string& device);
55
56 int job_id_;
57
58 CupsConnection connection_;
59 std::unique_ptr<CupsPrinter> printer_;
60 std::vector<cups_option_t> options_;
61
62 DISALLOW_COPY_AND_ASSIGN(PrintingContextChromeos);
45 }; 63 };
46 64
47 } // namespace printing 65 } // namespace printing
48 66
49 #endif // PRINTING_PRINTING_CONTEXT_NO_SYSTEM_DIALOG_H_ 67 #endif // PRINTING_PRINTING_CONTEXT_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698