[M120 Migration][MM] Fix EME AD insert issue
[platform/framework/web/chromium-efl.git] / printing / printing_context_win.h
1 // Copyright 2011 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_WIN_H_
6 #define PRINTING_PRINTING_CONTEXT_WIN_H_
7
8 #include <windows.h>
9
10 #include <memory>
11 #include <string>
12
13 #include "printing/mojom/print.mojom.h"
14 #include "printing/printing_context.h"
15 #include "ui/gfx/native_widget_types.h"
16
17 namespace printing {
18
19 class PrintSettings;
20
21 class COMPONENT_EXPORT(PRINTING) PrintingContextWin : public PrintingContext {
22  public:
23   explicit PrintingContextWin(Delegate* delegate);
24   PrintingContextWin(const PrintingContextWin&) = delete;
25   PrintingContextWin& operator=(const PrintingContextWin&) = delete;
26   ~PrintingContextWin() override;
27
28   // PrintingContext implementation.
29   void AskUserForSettings(int max_pages,
30                           bool has_selection,
31                           bool is_scripted,
32                           PrintSettingsCallback callback) override;
33   mojom::ResultCode UseDefaultSettings() override;
34   gfx::Size GetPdfPaperSizeDeviceUnits() override;
35   mojom::ResultCode UpdatePrinterSettings(
36       const PrinterSettings& printer_settings) override;
37   mojom::ResultCode NewDocument(const std::u16string& document_name) override;
38   mojom::ResultCode RenderPage(const PrintedPage& page,
39                                const PageSetup& page_setup) override;
40   mojom::ResultCode PrintDocument(const MetafilePlayer& metafile,
41                                   const PrintSettings& settings,
42                                   uint32_t num_pages) override;
43   mojom::ResultCode DocumentDone() override;
44   void Cancel() override;
45   void ReleaseContext() override;
46   printing::NativeDrawingContext context() const override;
47   mojom::ResultCode InitWithSettingsForTest(
48       std::unique_ptr<PrintSettings> settings) override;
49
50  protected:
51   static HWND GetRootWindow(gfx::NativeView view);
52
53   // Reads the settings from the selected device context. Updates settings_ and
54   // its margins.
55   virtual mojom::ResultCode InitializeSettings(const std::wstring& device_name,
56                                                DEVMODE* dev_mode);
57
58   // PrintingContext implementation.
59   mojom::ResultCode OnError() override;
60
61   void set_context(HDC context) { context_ = context; }
62
63  private:
64   // Used in response to the user canceling the printing.
65   static BOOL CALLBACK AbortProc(HDC hdc, int nCode);
66
67   // The selected printer context.
68   HDC context_;
69 };
70
71 }  // namespace printing
72
73 #endif  // PRINTING_PRINTING_CONTEXT_WIN_H_