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

Side by Side Diff: printing/printing_context_win.cc

Issue 299363002: Cleanup: Get rid of unneeded base::UTF16ToWide() conversions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style Created 6 years, 6 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 | « components/breakpad/app/breakpad_win.cc ('k') | remoting/base/breakpad_win.cc » ('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/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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // See MSDN documentation regarding DocumentProperties. 315 // See MSDN documentation regarding DocumentProperties.
316 scoped_ptr<DEVMODE, base::FreeDeleter> scoped_dev_mode = 316 scoped_ptr<DEVMODE, base::FreeDeleter> scoped_dev_mode =
317 CreateDevModeWithColor(printer, settings_.device_name(), 317 CreateDevModeWithColor(printer, settings_.device_name(),
318 settings_.color() != GRAY); 318 settings_.color() != GRAY);
319 if (!scoped_dev_mode) 319 if (!scoped_dev_mode)
320 return OnError(); 320 return OnError();
321 321
322 { 322 {
323 DEVMODE* dev_mode = scoped_dev_mode.get(); 323 DEVMODE* dev_mode = scoped_dev_mode.get();
324 dev_mode->dmCopies = std::max(settings_.copies(), 1); 324 dev_mode->dmCopies = std::max(settings_.copies(), 1);
325 if (dev_mode->dmCopies > 1) { // do not change unless multiple copies 325 if (dev_mode->dmCopies > 1) { // do not change unless multiple copies
326 dev_mode->dmFields |= DM_COPIES; 326 dev_mode->dmFields |= DM_COPIES;
327 dev_mode->dmCollate = settings_.collate() ? DMCOLLATE_TRUE : 327 dev_mode->dmCollate = settings_.collate() ? DMCOLLATE_TRUE :
328 DMCOLLATE_FALSE; 328 DMCOLLATE_FALSE;
329 } 329 }
330 330
331 switch (settings_.duplex_mode()) { 331 switch (settings_.duplex_mode()) {
332 case LONG_EDGE: 332 case LONG_EDGE:
333 dev_mode->dmFields |= DM_DUPLEX; 333 dev_mode->dmFields |= DM_DUPLEX;
334 dev_mode->dmDuplex = DMDUP_VERTICAL; 334 dev_mode->dmDuplex = DMDUP_VERTICAL;
335 break; 335 break;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 abort_printing_ = false; 398 abort_printing_ = false;
399 399
400 in_print_job_ = true; 400 in_print_job_ = true;
401 401
402 // Register the application's AbortProc function with GDI. 402 // Register the application's AbortProc function with GDI.
403 if (SP_ERROR == SetAbortProc(context_, &AbortProc)) 403 if (SP_ERROR == SetAbortProc(context_, &AbortProc))
404 return OnError(); 404 return OnError();
405 405
406 DCHECK(SimplifyDocumentTitle(document_name) == document_name); 406 DCHECK(SimplifyDocumentTitle(document_name) == document_name);
407 DOCINFO di = { sizeof(DOCINFO) }; 407 DOCINFO di = { sizeof(DOCINFO) };
408 const std::wstring& document_name_wide = base::UTF16ToWide(document_name); 408 di.lpszDocName = document_name.c_str();
409 di.lpszDocName = document_name_wide.c_str();
410 409
411 // Is there a debug dump directory specified? If so, force to print to a file. 410 // Is there a debug dump directory specified? If so, force to print to a file.
412 base::FilePath debug_dump_path = PrintedDocument::debug_dump_path(); 411 base::FilePath debug_dump_path = PrintedDocument::debug_dump_path();
413 if (!debug_dump_path.empty()) { 412 if (!debug_dump_path.empty()) {
414 // Create a filename. 413 // Create a filename.
415 std::wstring filename; 414 std::wstring filename;
416 Time now(Time::Now()); 415 Time now(Time::Now());
417 filename = base::TimeFormatShortDateNumeric(now); 416 filename = base::TimeFormatShortDateNumeric(now);
418 filename += L"_"; 417 filename += L"_";
419 filename += base::TimeFormatTimeOfDay(now); 418 filename += base::TimeFormatTimeOfDay(now);
420 filename += L"_"; 419 filename += L"_";
421 filename += base::UTF16ToWide(document_name); 420 filename += document_name;
422 filename += L"_"; 421 filename += L"_";
423 filename += L"buffer.prn"; 422 filename += L"buffer.prn";
424 file_util::ReplaceIllegalCharactersInPath(&filename, '_'); 423 file_util::ReplaceIllegalCharactersInPath(&filename, '_');
425 debug_dump_path = debug_dump_path.Append(filename); 424 debug_dump_path = debug_dump_path.Append(filename);
426 di.lpszOutput = debug_dump_path.value().c_str(); 425 di.lpszOutput = debug_dump_path.value().c_str();
427 } 426 }
428 427
429 // No message loop running in unit tests. 428 // No message loop running in unit tests.
430 DCHECK(!base::MessageLoop::current() || 429 DCHECK(!base::MessageLoop::current() ||
431 !base::MessageLoop::current()->NestableTasksAllowed()); 430 !base::MessageLoop::current()->NestableTasksAllowed());
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 711
713 if (dialog_options.hDevMode != NULL) 712 if (dialog_options.hDevMode != NULL)
714 GlobalFree(dialog_options.hDevMode); 713 GlobalFree(dialog_options.hDevMode);
715 if (dialog_options.hDevNames != NULL) 714 if (dialog_options.hDevNames != NULL)
716 GlobalFree(dialog_options.hDevNames); 715 GlobalFree(dialog_options.hDevNames);
717 716
718 return context_ ? OK : FAILED; 717 return context_ ? OK : FAILED;
719 } 718 }
720 719
721 } // namespace printing 720 } // namespace printing
OLDNEW
« no previous file with comments | « components/breakpad/app/breakpad_win.cc ('k') | remoting/base/breakpad_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698