Upload upstream chromium 73.0.3683.0
[platform/framework/web/chromium-efl.git] / printing / printing_context_chromeos.h
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
3 // found in the LICENSE file.
4
5 #ifndef PRINTING_PRINTING_CONTEXT_CHROMEOS_H_
6 #define PRINTING_PRINTING_CONTEXT_CHROMEOS_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/macros.h"
13 #include "printing/backend/cups_connection.h"
14 #include "printing/backend/cups_printer.h"
15 #include "printing/printing_context.h"
16
17 namespace printing {
18
19 class PRINTING_EXPORT PrintingContextChromeos : public PrintingContext {
20  public:
21   explicit PrintingContextChromeos(Delegate* delegate);
22   ~PrintingContextChromeos() override;
23
24   // PrintingContext implementation.
25   void AskUserForSettings(int max_pages,
26                           bool has_selection,
27                           bool is_scripted,
28                           PrintSettingsCallback callback) override;
29   Result UseDefaultSettings() override;
30   gfx::Size GetPdfPaperSizeDeviceUnits() override;
31   Result UpdatePrinterSettings(bool external_preview,
32                                bool show_system_dialog,
33                                int page_count) override;
34   Result NewDocument(const base::string16& document_name) override;
35   Result NewPage() override;
36   Result PageDone() override;
37   Result DocumentDone() override;
38   void Cancel() override;
39   void ReleaseContext() override;
40   printing::NativeDrawingContext context() const override;
41
42   Result StreamData(const std::vector<char>& buffer);
43
44  private:
45   // Lazily initializes |printer_|.
46   Result InitializeDevice(const std::string& device);
47
48   CupsConnection connection_;
49   std::unique_ptr<CupsPrinter> printer_;
50
51   DISALLOW_COPY_AND_ASSIGN(PrintingContextChromeos);
52 };
53
54 }  // namespace printing
55
56 #endif  // PRINTING_PRINTING_CONTEXT_CHROMEOS_H_