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 #include "printing/printing_context_win.h" | 5 #include "printing/printing_context_win.h" |
6 | 6 |
7 #include <winspool.h> | 7 #include <winspool.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 PrintingContextWin::~PrintingContextWin() { | 196 PrintingContextWin::~PrintingContextWin() { |
197 ReleaseContext(); | 197 ReleaseContext(); |
198 } | 198 } |
199 | 199 |
200 void PrintingContextWin::AskUserForSettings(gfx::NativeView view, | 200 void PrintingContextWin::AskUserForSettings(gfx::NativeView view, |
201 int max_pages, | 201 int max_pages, |
202 bool has_selection, | 202 bool has_selection, |
203 PrintSettingsCallback* callback) { | 203 PrintSettingsCallback* callback) { |
| 204 #if !defined(USE_AURA) |
204 DCHECK(!in_print_job_); | 205 DCHECK(!in_print_job_); |
205 dialog_box_dismissed_ = false; | 206 dialog_box_dismissed_ = false; |
206 | 207 |
207 HWND window; | 208 HWND window; |
208 if (!view || !IsWindow(view)) { | 209 if (!view || !IsWindow(view)) { |
209 // TODO(maruel): bug 1214347 Get the right browser window instead. | 210 // TODO(maruel): bug 1214347 Get the right browser window instead. |
210 window = GetDesktopWindow(); | 211 window = GetDesktopWindow(); |
211 } else { | 212 } else { |
212 window = GetAncestor(view, GA_ROOTOWNER); | 213 window = GetAncestor(view, GA_ROOTOWNER); |
213 } | 214 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 dialog_options.Flags |= PD_NOPAGENUMS; | 249 dialog_options.Flags |= PD_NOPAGENUMS; |
249 } | 250 } |
250 | 251 |
251 if ((*print_dialog_func_)(&dialog_options) != S_OK) { | 252 if ((*print_dialog_func_)(&dialog_options) != S_OK) { |
252 ResetSettings(); | 253 ResetSettings(); |
253 callback->Run(FAILED); | 254 callback->Run(FAILED); |
254 } | 255 } |
255 | 256 |
256 // TODO(maruel): Support PD_PRINTTOFILE. | 257 // TODO(maruel): Support PD_PRINTTOFILE. |
257 callback->Run(ParseDialogResultEx(dialog_options)); | 258 callback->Run(ParseDialogResultEx(dialog_options)); |
| 259 #endif |
258 } | 260 } |
259 | 261 |
260 PrintingContext::Result PrintingContextWin::UseDefaultSettings() { | 262 PrintingContext::Result PrintingContextWin::UseDefaultSettings() { |
261 DCHECK(!in_print_job_); | 263 DCHECK(!in_print_job_); |
262 | 264 |
263 PRINTDLG dialog_options = { sizeof(PRINTDLG) }; | 265 PRINTDLG dialog_options = { sizeof(PRINTDLG) }; |
264 dialog_options.Flags = PD_RETURNDC | PD_RETURNDEFAULT; | 266 dialog_options.Flags = PD_RETURNDC | PD_RETURNDEFAULT; |
265 if (PrintDlg(&dialog_options)) | 267 if (PrintDlg(&dialog_options)) |
266 return ParseDialogResult(dialog_options); | 268 return ParseDialogResult(dialog_options); |
267 | 269 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 if (buf_size) { | 762 if (buf_size) { |
761 buffer->reset(new uint8[buf_size]); | 763 buffer->reset(new uint8[buf_size]); |
762 memset(buffer->get(), 0, buf_size); | 764 memset(buffer->get(), 0, buf_size); |
763 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 765 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
764 buffer->reset(); | 766 buffer->reset(); |
765 } | 767 } |
766 } | 768 } |
767 } | 769 } |
768 | 770 |
769 } // namespace printing | 771 } // namespace printing |
OLD | NEW |