Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: printing/backend/win_helper.cc

Issue 480303002: Use document from preview for System Dialog printing on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tue Aug 26 01:11:31 PDT 2014 Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/backend/win_helper.h ('k') | printing/print_job_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/backend/win_helper.h" 5 #include "printing/backend/win_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 DWORD flags = (in ? (DM_IN_BUFFER) : 0) | DM_OUT_BUFFER; 481 DWORD flags = (in ? (DM_IN_BUFFER) : 0) | DM_OUT_BUFFER;
482 if (DocumentProperties( 482 if (DocumentProperties(
483 NULL, printer, const_cast<wchar_t*>(L""), out.get(), in, flags) != 483 NULL, printer, const_cast<wchar_t*>(L""), out.get(), in, flags) !=
484 IDOK) { 484 IDOK) {
485 return scoped_ptr<DEVMODE, base::FreeDeleter>(); 485 return scoped_ptr<DEVMODE, base::FreeDeleter>();
486 } 486 }
487 CHECK_GE(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra); 487 CHECK_GE(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra);
488 return out.Pass(); 488 return out.Pass();
489 } 489 }
490 490
491 scoped_ptr<DEVMODE, base::FreeDeleter> PromptDevMode(
492 HANDLE printer,
493 const base::string16& printer_name,
494 DEVMODE* in,
495 HWND window,
496 bool* canceled) {
497 LONG buffer_size =
498 DocumentProperties(window,
499 printer,
500 const_cast<wchar_t*>(printer_name.c_str()),
501 NULL,
502 NULL,
503 0);
504 if (buffer_size < static_cast<int>(sizeof(DEVMODE)))
505 return scoped_ptr<DEVMODE, base::FreeDeleter>();
506 scoped_ptr<DEVMODE, base::FreeDeleter> out(
507 reinterpret_cast<DEVMODE*>(malloc(buffer_size)));
508 DWORD flags = (in ? (DM_IN_BUFFER) : 0) | DM_OUT_BUFFER | DM_IN_PROMPT;
509 LONG result = DocumentProperties(window,
510 printer,
511 const_cast<wchar_t*>(printer_name.c_str()),
512 out.get(),
513 in,
514 flags);
515 if (canceled)
516 *canceled = (result == IDCANCEL);
517 if (result != IDOK)
518 return scoped_ptr<DEVMODE, base::FreeDeleter>();
519 CHECK_GE(buffer_size, out.get()->dmSize + out.get()->dmDriverExtra);
520 return out.Pass();
521 }
522
491 } // namespace printing 523 } // namespace printing
OLDNEW
« no previous file with comments | « printing/backend/win_helper.h ('k') | printing/print_job_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698