Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PRINTING_PRINTING_CONTEXT_WIN_H_ | 5 #ifndef PRINTING_PRINTING_CONTEXT_WIN_H_ |
| 6 #define PRINTING_PRINTING_CONTEXT_WIN_H_ | 6 #define PRINTING_PRINTING_CONTEXT_WIN_H_ |
| 7 | 7 |
| 8 #include <ocidl.h> | 8 #include <ocidl.h> |
| 9 #include <commdlg.h> | 9 #include <commdlg.h> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 bool show_system_dialog) OVERRIDE; | 33 bool show_system_dialog) OVERRIDE; |
| 34 virtual Result InitWithSettings(const PrintSettings& settings) OVERRIDE; | 34 virtual Result InitWithSettings(const PrintSettings& settings) OVERRIDE; |
| 35 virtual Result NewDocument(const base::string16& document_name) OVERRIDE; | 35 virtual Result NewDocument(const base::string16& document_name) OVERRIDE; |
| 36 virtual Result NewPage() OVERRIDE; | 36 virtual Result NewPage() OVERRIDE; |
| 37 virtual Result PageDone() OVERRIDE; | 37 virtual Result PageDone() OVERRIDE; |
| 38 virtual Result DocumentDone() OVERRIDE; | 38 virtual Result DocumentDone() OVERRIDE; |
| 39 virtual void Cancel() OVERRIDE; | 39 virtual void Cancel() OVERRIDE; |
| 40 virtual void ReleaseContext() OVERRIDE; | 40 virtual void ReleaseContext() OVERRIDE; |
| 41 virtual gfx::NativeDrawingContext context() const OVERRIDE; | 41 virtual gfx::NativeDrawingContext context() const OVERRIDE; |
| 42 | 42 |
| 43 // Allocates the HDC for a specific DEVMODE. | |
| 44 static bool AllocateContext(const std::wstring& printer_name, | |
|
Vitaly Buka (NO REVIEWS)
2014/09/08 09:43:59
I'll restore this under !DISABLE_BASIC_PRINTING wh
| |
| 45 const DEVMODE* dev_mode, | |
| 46 gfx::NativeDrawingContext* context); | |
| 47 | |
| 43 protected: | 48 protected: |
| 44 virtual scoped_ptr<DEVMODE, base::FreeDeleter> ShowPrintDialog( | 49 virtual HRESULT ShowPrintDialog(PRINTDLGEX* options); |
| 45 HANDLE printer, | |
| 46 gfx::NativeView parent_view, | |
| 47 DEVMODE* dev_mode); | |
| 48 | 50 |
| 49 private: | 51 private: |
| 52 // Class that manages the PrintDlgEx() callbacks. This is meant to be a | |
| 53 // temporary object used during the Print... dialog display. | |
| 54 class CallbackHandler; | |
| 55 | |
| 50 // Used in response to the user canceling the printing. | 56 // Used in response to the user canceling the printing. |
| 51 static BOOL CALLBACK AbortProc(HDC hdc, int nCode); | 57 static BOOL CALLBACK AbortProc(HDC hdc, int nCode); |
| 52 | 58 |
| 53 // Reads the settings from the selected device context. Updates settings_ and | 59 // Reads the settings from the selected device context. Updates settings_ and |
| 54 // its margins. | 60 // its margins. |
| 55 virtual Result InitializeSettings(const base::string16& device_name, | 61 bool InitializeSettings(const DEVMODE& dev_mode, |
| 56 DEVMODE* dev_mode); | 62 const std::wstring& new_device_name, |
| 63 const PRINTPAGERANGE* ranges, | |
| 64 int number_ranges, | |
| 65 bool selection_only); | |
| 66 | |
| 67 // Retrieves the printer's default low-level settings. On Windows, context_ is | |
| 68 // allocated with this call. | |
| 69 bool GetPrinterSettings(HANDLE printer, | |
| 70 const std::wstring& device_name); | |
| 71 | |
| 72 // Parses the result of a PRINTDLGEX result. | |
| 73 Result ParseDialogResultEx(const PRINTDLGEX& dialog_options); | |
| 74 Result ParseDialogResult(const PRINTDLG& dialog_options); | |
| 57 | 75 |
| 58 // The selected printer context. | 76 // The selected printer context. |
| 59 HDC context_; | 77 HDC context_; |
| 60 | 78 |
| 79 // The dialog box for the time it is shown. | |
| 80 volatile HWND dialog_box_; | |
| 81 | |
| 61 DISALLOW_COPY_AND_ASSIGN(PrintingContextWin); | 82 DISALLOW_COPY_AND_ASSIGN(PrintingContextWin); |
| 62 }; | 83 }; |
| 63 | 84 |
| 64 } // namespace printing | 85 } // namespace printing |
| 65 | 86 |
| 66 #endif // PRINTING_PRINTING_CONTEXT_WIN_H_ | 87 #endif // PRINTING_PRINTING_CONTEXT_WIN_H_ |
| OLD | NEW |