printing_context_system_dialog_win.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // 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. #ifndef PRINTING_PRINTING_CONTEXT_SYSTEM_DIALOG_WIN_H_
  5. #define PRINTING_PRINTING_CONTEXT_SYSTEM_DIALOG_WIN_H_
  6. #include <ocidl.h> // NOLINT(build/include_order)
  7. #include <commdlg.h> // Must come after ocidl.h.
  8. #include <string>
  9. #include "printing/mojom/print.mojom.h"
  10. #include "printing/printing_context_win.h"
  11. #include "ui/gfx/native_widget_types.h"
  12. namespace printing {
  13. class COMPONENT_EXPORT(PRINTING) PrintingContextSystemDialogWin
  14. : public PrintingContextWin {
  15. public:
  16. explicit PrintingContextSystemDialogWin(Delegate* delegate);
  17. PrintingContextSystemDialogWin(const PrintingContextSystemDialogWin&) =
  18. delete;
  19. PrintingContextSystemDialogWin& operator=(
  20. const PrintingContextSystemDialogWin&) = delete;
  21. ~PrintingContextSystemDialogWin() override;
  22. // PrintingContext implementation.
  23. void AskUserForSettings(int max_pages,
  24. bool has_selection,
  25. bool is_scripted,
  26. PrintSettingsCallback callback) override;
  27. private:
  28. friend class MockPrintingContextWin;
  29. HWND GetWindow();
  30. virtual HRESULT ShowPrintDialog(PRINTDLGEX* options);
  31. // Reads the settings from the selected device context. Updates settings_ and
  32. // its margins.
  33. bool InitializeSettingsWithRanges(const DEVMODE& dev_mode,
  34. const std::wstring& new_device_name,
  35. const PRINTPAGERANGE* ranges,
  36. int number_ranges,
  37. bool selection_only);
  38. // Parses the result of a PRINTDLGEX result.
  39. mojom::ResultCode ParseDialogResultEx(const PRINTDLGEX& dialog_options);
  40. };
  41. } // namespace printing
  42. #endif // PRINTING_PRINTING_CONTEXT_SYSTEM_DIALOG_WIN_H_