blob: 9fbc43d1830f3b1186804406d8b820b9ce17683d [file] [log] [blame]
vitalybukaf9d0c0c2014-09-09 19:53:331// Copyright 2014 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_SYSTEM_DIALOG_WIN_H_
6#define PRINTING_PRINTING_CONTEXT_SYSTEM_DIALOG_WIN_H_
7
8#include <ocidl.h>
9#include <commdlg.h>
10
11#include <string>
12
avi126e93c2015-12-21 21:48:1613#include "base/macros.h"
vitalybukaf9d0c0c2014-09-09 19:53:3314#include "printing/printing_context_win.h"
15#include "ui/gfx/native_widget_types.h"
16
17namespace printing {
18
thestige85e6b62016-08-25 00:00:0619class PRINTING_EXPORT PrintingContextSystemDialogWin
vitalybukaf9d0c0c2014-09-09 19:53:3320 : public PrintingContextWin {
21 public:
thestige85e6b62016-08-25 00:00:0622 explicit PrintingContextSystemDialogWin(Delegate* delegate);
23 ~PrintingContextSystemDialogWin() override;
vitalybukaf9d0c0c2014-09-09 19:53:3324
25 // PrintingContext implementation.
nickbc761612015-04-27 23:30:4626 void AskUserForSettings(
vitalybukaf9d0c0c2014-09-09 19:53:3327 int max_pages,
28 bool has_selection,
dgn4c172eea2014-12-15 21:11:2329 bool is_scripted,
anujk.sharma263c3132014-10-07 07:29:4230 const PrintSettingsCallback& callback) override;
vitalybukaf9d0c0c2014-09-09 19:53:3331
32 private:
33 friend class MockPrintingContextWin;
34
35 virtual HRESULT ShowPrintDialog(PRINTDLGEX* options);
36
37 // Reads the settings from the selected device context. Updates settings_ and
38 // its margins.
mgiuca8ca59182015-07-08 02:10:2139 bool InitializeSettingsWithRanges(const DEVMODE& dev_mode,
40 const std::wstring& new_device_name,
41 const PRINTPAGERANGE* ranges,
42 int number_ranges,
43 bool selection_only);
vitalybukaf9d0c0c2014-09-09 19:53:3344
45 // Parses the result of a PRINTDLGEX result.
46 Result ParseDialogResultEx(const PRINTDLGEX& dialog_options);
vitalybukaf9d0c0c2014-09-09 19:53:3347
thestige85e6b62016-08-25 00:00:0648 DISALLOW_COPY_AND_ASSIGN(PrintingContextSystemDialogWin);
vitalybukaf9d0c0c2014-09-09 19:53:3349};
50
51} // namespace printing
52
53#endif // PRINTING_PRINTING_CONTEXT_SYSTEM_DIALOG_WIN_H_