[M120 Migration][VD] Remove accessing oom_score_adj in zygote process
[platform/framework/web/chromium-efl.git] / printing / printing_context_chromeos.h
1 // Copyright 2016 The Chromium Authors
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 "printing/backend/cups_connection.h"
13 #include "printing/backend/cups_ipp_helper.h"
14 #include "printing/backend/cups_printer.h"
15 #include "printing/mojom/print.mojom.h"
16 #include "printing/printing_context.h"
17
18 namespace printing {
19
20 class COMPONENT_EXPORT(PRINTING) PrintingContextChromeos
21     : public PrintingContext {
22  public:
23   static std::unique_ptr<PrintingContextChromeos> CreateForTesting(
24       Delegate* delegate,
25       std::unique_ptr<CupsConnection> connection);
26
27   explicit PrintingContextChromeos(Delegate* delegate);
28   PrintingContextChromeos(const PrintingContextChromeos&) = delete;
29   PrintingContextChromeos& operator=(const PrintingContextChromeos&) = delete;
30   ~PrintingContextChromeos() override;
31
32   // PrintingContext implementation.
33   void AskUserForSettings(int max_pages,
34                           bool has_selection,
35                           bool is_scripted,
36                           PrintSettingsCallback callback) override;
37   mojom::ResultCode UseDefaultSettings() override;
38   gfx::Size GetPdfPaperSizeDeviceUnits() override;
39   mojom::ResultCode UpdatePrinterSettings(
40       const PrinterSettings& printer_settings) override;
41   mojom::ResultCode NewDocument(const std::u16string& document_name) override;
42   mojom::ResultCode PrintDocument(const MetafilePlayer& metafile,
43                                   const PrintSettings& settings,
44                                   uint32_t num_pages) override;
45   mojom::ResultCode DocumentDone() override;
46   void Cancel() override;
47   void ReleaseContext() override;
48   printing::NativeDrawingContext context() const override;
49
50   mojom::ResultCode StreamData(const std::vector<char>& buffer);
51
52  private:
53   // For testing. Use CreateForTesting() to create.
54   PrintingContextChromeos(Delegate* delegate,
55                           std::unique_ptr<CupsConnection> connection);
56
57   // Lazily initializes `printer_`.
58   mojom::ResultCode InitializeDevice(const std::string& device);
59
60   const std::unique_ptr<CupsConnection> connection_;
61   std::unique_ptr<CupsPrinter> printer_;
62   ScopedIppPtr ipp_options_;
63   bool send_user_info_ = false;
64   std::string username_;
65 };
66
67 COMPONENT_EXPORT(PRINTING)
68 ScopedIppPtr SettingsToIPPOptions(const PrintSettings& settings,
69                                   const gfx::Rect& printable_area_um);
70
71 }  // namespace printing
72
73 #endif  // PRINTING_PRINTING_CONTEXT_CHROMEOS_H_