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

Side by Side Diff: printing/printing_context_win.cc

Issue 766823004: Switch back to PrintDlgEx instead of DocumentProperties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mon Dec 8 10:05:14 PST 2014 Created 6 years 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
« no previous file with comments | « no previous file | no next file » | 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/printing_context_win.h" 5 #include "printing/printing_context_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h"
9 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
11 #include "printing/backend/print_backend.h" 12 #include "printing/backend/print_backend.h"
12 #include "printing/backend/win_helper.h" 13 #include "printing/backend/win_helper.h"
13 #include "printing/print_settings_initializer_win.h" 14 #include "printing/print_settings_initializer_win.h"
14 #include "printing/printed_document.h" 15 #include "printing/printed_document.h"
15 #include "printing/printing_context_system_dialog_win.h" 16 #include "printing/printing_context_system_dialog_win.h"
16 #include "printing/printing_utils.h" 17 #include "printing/printing_utils.h"
17 #include "printing/units.h" 18 #include "printing/units.h"
18 #include "skia/ext/platform_device.h" 19 #include "skia/ext/platform_device.h"
19 20
20 #if defined(USE_AURA) 21 #if defined(USE_AURA)
21 #include "ui/aura/remote_window_tree_host_win.h" 22 #include "ui/aura/remote_window_tree_host_win.h"
22 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
23 #endif 24 #endif
24 25
25 namespace printing { 26 namespace printing {
26 27
28 namespace {
29
30 void AssingResult(PrintingContext::Result* out, PrintingContext::Result in) {
31 *out = in;
32 }
33
34 } // namespace
35
27 // static 36 // static
28 scoped_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) { 37 scoped_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) {
29 #if defined(ENABLE_BASIC_PRINTING) 38 #if defined(ENABLE_BASIC_PRINTING)
30 return make_scoped_ptr<PrintingContext>( 39 return make_scoped_ptr<PrintingContext>(
31 new PrintingContextSytemDialogWin(delegate)); 40 new PrintingContextSytemDialogWin(delegate));
32 #else // ENABLE_BASIC_PRINTING 41 #else // ENABLE_BASIC_PRINTING
33 return make_scoped_ptr<PrintingContext>(new PrintingContextWin(delegate)); 42 return make_scoped_ptr<PrintingContext>(new PrintingContextWin(delegate));
34 #endif // EENABLE_BASIC_PRINTING 43 #endif // EENABLE_BASIC_PRINTING
35 } 44 }
36 45
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } else if (width > 0 && height > 0) { 200 } else if (width > 0 && height > 0) {
192 dev_mode->dmFields |= DM_PAPERWIDTH; 201 dev_mode->dmFields |= DM_PAPERWIDTH;
193 dev_mode->dmPaperWidth = width; 202 dev_mode->dmPaperWidth = width;
194 dev_mode->dmFields |= DM_PAPERLENGTH; 203 dev_mode->dmFields |= DM_PAPERLENGTH;
195 dev_mode->dmPaperLength = height; 204 dev_mode->dmPaperLength = height;
196 } 205 }
197 } 206 }
198 207
199 // Update data using DocumentProperties. 208 // Update data using DocumentProperties.
200 if (show_system_dialog) { 209 if (show_system_dialog) {
201 scoped_dev_mode = ShowPrintDialog( 210 PrintingContext::Result result = PrintingContext::FAILED;
202 printer.Get(), delegate_->GetParentView(), scoped_dev_mode.get()); 211 AskUserForSettings(0, false, base::Bind(&AssingResult, &result));
212 return result;
203 } else { 213 } else {
204 scoped_dev_mode = CreateDevMode(printer.Get(), scoped_dev_mode.get()); 214 scoped_dev_mode = CreateDevMode(printer.Get(), scoped_dev_mode.get());
205 } 215 }
206 // Set printer then refresh printer settings. 216 // Set printer then refresh printer settings.
207 return InitializeSettings(settings_.device_name(), scoped_dev_mode.get()); 217 return InitializeSettings(settings_.device_name(), scoped_dev_mode.get());
208 } 218 }
209 219
210 PrintingContext::Result PrintingContextWin::InitWithSettings( 220 PrintingContext::Result PrintingContextWin::InitWithSettings(
211 const PrintSettings& settings) { 221 const PrintSettings& settings) {
212 DCHECK(!in_print_job_); 222 DCHECK(!in_print_job_);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 399
390 if (canceled) { 400 if (canceled) {
391 result.reset(); 401 result.reset();
392 abort_printing_ = true; 402 abort_printing_ = true;
393 } 403 }
394 404
395 return result.Pass(); 405 return result.Pass();
396 } 406 }
397 407
398 } // namespace printing 408 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698