diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 19:15:46 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 19:15:46 +0000 |
commit | d825462fe6672a5c69a62b4827b6eca1059bb984 (patch) | |
tree | b90040d6eb399e6e5a3dcaf1bf63b6a2e52508b1 /printing/printing_context.h | |
parent | e485920367d9a6a576a788ac84568ee474f5396a (diff) | |
download | chromium_src-d825462fe6672a5c69a62b4827b6eca1059bb984.zip chromium_src-d825462fe6672a5c69a62b4827b6eca1059bb984.tar.gz chromium_src-d825462fe6672a5c69a62b4827b6eca1059bb984.tar.bz2 |
Win32: Print the right number of pages.
BUG=48392
TEST=included.
Review URL: http://codereview.chromium.org/3113012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56063 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/printing_context.h')
-rw-r--r-- | printing/printing_context.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/printing/printing_context.h b/printing/printing_context.h index ec8a7d8..8996fa9 100644 --- a/printing/printing_context.h +++ b/printing/printing_context.h @@ -16,6 +16,7 @@ #include "base/basictypes.h" #include "base/logging.h" +#include "base/scoped_ptr.h" #include "gfx/native_widget_types.h" #include "printing/print_settings.h" @@ -50,6 +51,24 @@ class PrintingContext { Result AskUserForSettings(gfx::NativeView parent_view, int max_pages, bool has_selection); +#if defined(OS_WIN) && defined(UNIT_TEST) + // Sets a fake PrintDlgEx function pointer in tests. + void SetPrintDialog(HRESULT (__stdcall *print_dialog_func)(LPPRINTDLGEX)) { + print_dialog_func_ = print_dialog_func; + } +#endif + +#if defined(OS_WIN) + // Allocates the HDC for a specific DEVMODE. + static bool AllocateContext(const std::wstring& printer_name, + const DEVMODE* dev_mode, + gfx::NativeDrawingContext* context); + + // Retrieves the content of a GetPrinter call. + static void GetPrinterHelper(HANDLE printer, int level, + scoped_array<uint8>* buffer); +#endif + // Selects the user's default printer and format. Updates the context with the // default device settings. Result UseDefaultSettings(); @@ -127,14 +146,9 @@ class PrintingContext { bool GetPrinterSettings(HANDLE printer, const std::wstring& device_name); - // Allocates the HDC for a specific DEVMODE. - bool AllocateContext(const std::wstring& printer_name, - const DEVMODE* dev_mode); - // Parses the result of a PRINTDLGEX result. Result ParseDialogResultEx(const PRINTDLGEX& dialog_options); Result ParseDialogResult(const PRINTDLG& dialog_options); - #elif defined(OS_MACOSX) // Read the settings from the given NSPrintInfo (and cache it for later use). void ParsePrintInfo(NSPrintInfo* print_info); @@ -161,6 +175,10 @@ class PrintingContext { #if defined(OS_WIN) // The dialog box for the time it is shown. volatile HWND dialog_box_; + + // Function pointer that defaults to PrintDlgEx. It can be changed using + // SetPrintDialog() in tests. + HRESULT (__stdcall *print_dialog_func_)(LPPRINTDLGEX); #endif // The dialog box has been dismissed. |