blob: bc427a0bc713279b47800411488f2b245146d997 [file] [log] [blame]
[email protected]7868ecab2011-03-05 00:12:531// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]51e8d9352010-10-06 22:21:172// 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
dchengc3df9ba2016-04-07 23:09:328#include <memory>
[email protected]51e8d9352010-10-06 22:21:179#include <string>
10
avi126e93c2015-12-21 21:48:1611#include "base/macros.h"
[email protected]51e8d9352010-10-06 22:21:1712#include "printing/printing_context.h"
[email protected]08397d52011-02-05 01:53:3813#include "ui/gfx/native_widget_types.h"
[email protected]51e8d9352010-10-06 22:21:1714
15namespace printing {
16
vitalybukaf9d0c0c2014-09-09 19:53:3317class PrintSettings;
18
[email protected]f487ac22014-02-13 17:04:3119class PRINTING_EXPORT PrintingContextWin : public PrintingContext {
[email protected]51e8d9352010-10-06 22:21:1720 public:
Vitaly Bukabd7c9812014-08-26 08:57:5421 explicit PrintingContextWin(Delegate* delegate);
nickbc761612015-04-27 23:30:4622 ~PrintingContextWin() override;
[email protected]51e8d9352010-10-06 22:21:1723
thestig5f683912016-09-30 22:42:1624 // Initializes with predefined settings.
25 Result InitWithSettingsForTest(const PrintSettings& settings);
26
[email protected]51e8d9352010-10-06 22:21:1727 // PrintingContext implementation.
Vladislav Kuzkokov48ceab22018-02-14 16:29:2828 void AskUserForSettings(int max_pages,
29 bool has_selection,
30 bool is_scripted,
31 PrintSettingsCallback callback) override;
nickbc761612015-04-27 23:30:4632 Result UseDefaultSettings() override;
33 gfx::Size GetPdfPaperSizeDeviceUnits() override;
34 Result UpdatePrinterSettings(bool external_preview,
vitalybuka95fa3c92015-05-05 03:03:3235 bool show_system_dialog,
36 int page_count) override;
nickbc761612015-04-27 23:30:4637 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;
Nico Weber8e559562017-10-03 01:25:2643 printing::NativeDrawingContext context() const override;
[email protected]51e8d9352010-10-06 22:21:1744
[email protected]97a80632014-03-27 17:50:3945 protected:
vitalybukaf9d0c0c2014-09-09 19:53:3346 static HWND GetRootWindow(gfx::NativeView view);
[email protected]51e8d9352010-10-06 22:21:1747
48 // Reads the settings from the selected device context. Updates settings_ and
49 // its margins.
vitalybuka92ab8ce2014-08-26 23:41:4550 virtual Result InitializeSettings(const base::string16& device_name,
51 DEVMODE* dev_mode);
[email protected]51e8d9352010-10-06 22:21:1752
vitalybukaf9d0c0c2014-09-09 19:53:3353 void set_context(HDC context) { context_ = context; }
54
55 private:
vitalybukaf9d0c0c2014-09-09 19:53:3356 // Used in response to the user canceling the printing.
57 static BOOL CALLBACK AbortProc(HDC hdc, int nCode);
58
[email protected]51e8d9352010-10-06 22:21:1759 // The selected printer context.
60 HDC context_;
61
[email protected]51e8d9352010-10-06 22:21:1762 DISALLOW_COPY_AND_ASSIGN(PrintingContextWin);
63};
64
65} // namespace printing
66
67#endif // PRINTING_PRINTING_CONTEXT_WIN_H_