1 // Copyright (c) 2011 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.
5 #ifndef PRINTING_PRINTING_CONTEXT_WIN_H_
6 #define PRINTING_PRINTING_CONTEXT_WIN_H_
11 #include "base/macros.h"
12 #include "printing/printing_context.h"
13 #include "ui/gfx/native_widget_types.h"
19 class PRINTING_EXPORT PrintingContextWin : public PrintingContext {
21 explicit PrintingContextWin(Delegate* delegate);
22 ~PrintingContextWin() override;
24 // Initializes with predefined settings.
25 Result InitWithSettingsForTest(const PrintSettings& settings);
27 // PrintingContext implementation.
28 void AskUserForSettings(int max_pages,
31 PrintSettingsCallback callback) override;
32 Result UseDefaultSettings() override;
33 gfx::Size GetPdfPaperSizeDeviceUnits() override;
34 Result UpdatePrinterSettings(bool external_preview,
35 bool show_system_dialog,
36 int page_count) override;
37 Result NewDocument(const base::string16& document_name) override;
38 Result NewPage() override;
39 Result PageDone() override;
40 Result DocumentDone() override;
41 void Cancel() override;
42 void ReleaseContext() override;
43 printing::NativeDrawingContext context() const override;
46 static HWND GetRootWindow(gfx::NativeView view);
48 // Reads the settings from the selected device context. Updates settings_ and
50 virtual Result InitializeSettings(const base::string16& device_name,
53 void set_context(HDC context) { context_ = context; }
56 // Used in response to the user canceling the printing.
57 static BOOL CALLBACK AbortProc(HDC hdc, int nCode);
59 // The selected printer context.
62 DISALLOW_COPY_AND_ASSIGN(PrintingContextWin);
65 } // namespace printing
67 #endif // PRINTING_PRINTING_CONTEXT_WIN_H_