diff options
author | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-11 00:49:49 +0000 |
---|---|---|
committer | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-11 00:49:49 +0000 |
commit | 2b364bebf11285aaf97e3f4e97c46e96aeaf91f5 (patch) | |
tree | f399e636f8d2636e1c3905197a0ca740c870a7ac /chrome/service | |
parent | 5f34923604562a6b0043106bde992fc25a64cfba (diff) | |
download | chromium_src-2b364bebf11285aaf97e3f4e97c46e96aeaf91f5.zip chromium_src-2b364bebf11285aaf97e3f4e97c46e96aeaf91f5.tar.gz chromium_src-2b364bebf11285aaf97e3f4e97c46e96aeaf91f5.tar.bz2 |
scoped_ptr<DEVMODE[]> replaced with scoped_ptr<DEVMODE, base::FreeDeleter>.
NOTRY=true
Review URL: https://codereview.chromium.org/191913002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r-- | chrome/service/cloud_print/cdd_conversion_win.cc | 26 | ||||
-rw-r--r-- | chrome/service/cloud_print/cdd_conversion_win.h | 5 | ||||
-rw-r--r-- | chrome/service/cloud_print/print_system_win.cc | 2 |
3 files changed, 17 insertions, 16 deletions
diff --git a/chrome/service/cloud_print/cdd_conversion_win.cc b/chrome/service/cloud_print/cdd_conversion_win.cc index f71ed64..93fd836 100644 --- a/chrome/service/cloud_print/cdd_conversion_win.cc +++ b/chrome/service/cloud_print/cdd_conversion_win.cc @@ -15,32 +15,32 @@ bool IsValidCjt(const std::string& print_ticket_data) { return description.InitFromString(print_ticket_data); } -scoped_ptr<DEVMODE[]> CjtToDevMode(const base::string16& printer_name, - const std::string& print_ticket) { - using namespace cloud_devices::printer; +scoped_ptr<DEVMODE, base::FreeDeleter> CjtToDevMode( + const base::string16& printer_name, + const std::string& print_ticket) { + scoped_ptr<DEVMODE, base::FreeDeleter> dev_mode; + cloud_devices::CloudDeviceDescription description; if (!description.InitFromString(print_ticket)) - return scoped_ptr<DEVMODE[]>(); + return dev_mode.Pass(); + using namespace cloud_devices::printer; printing::ScopedPrinterHandle printer; if (!printer.OpenPrinter(printer_name.c_str())) - return scoped_ptr<DEVMODE[]>(); + return dev_mode.Pass(); - scoped_ptr<DEVMODE[]> scoped_dev_mode; { ColorTicketItem color; if (color.LoadFrom(description)) { bool is_color = color.value().type == STANDARD_COLOR; - scoped_dev_mode = CreateDevModeWithColor(printer, printer_name, is_color); + dev_mode = CreateDevModeWithColor(printer, printer_name, is_color); } else { - scoped_dev_mode = printing::CreateDevMode(printer, NULL); + dev_mode = printing::CreateDevMode(printer, NULL); } } - if (!scoped_dev_mode) - return scoped_ptr<DEVMODE[]>(); - - DEVMODE* dev_mode = scoped_dev_mode.get(); + if (!dev_mode) + return dev_mode.Pass(); ColorTicketItem color; DuplexTicketItem duplex; @@ -122,7 +122,7 @@ scoped_ptr<DEVMODE[]> CjtToDevMode(const base::string16& printer_name, } } - return printing::CreateDevMode(printer, dev_mode); + return printing::CreateDevMode(printer, dev_mode.get()); } std::string CapabilitiesToCdd( diff --git a/chrome/service/cloud_print/cdd_conversion_win.h b/chrome/service/cloud_print/cdd_conversion_win.h index cd751c4..8f50fc9 100644 --- a/chrome/service/cloud_print/cdd_conversion_win.h +++ b/chrome/service/cloud_print/cdd_conversion_win.h @@ -19,8 +19,9 @@ namespace cloud_print { bool IsValidCjt(const std::string& print_ticket); -scoped_ptr<DEVMODE[]> CjtToDevMode(const base::string16& printer_name, - const std::string& print_ticket); +scoped_ptr<DEVMODE, base::FreeDeleter> CjtToDevMode( + const base::string16& printer_name, + const std::string& print_ticket); std::string CapabilitiesToCdd( const printing::PrinterSemanticCapsAndDefaults& semantic_info); diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc index fc1ab97..98a4e97 100644 --- a/chrome/service/cloud_print/print_system_win.cc +++ b/chrome/service/cloud_print/print_system_win.cc @@ -270,7 +270,7 @@ class JobSpoolerWin : public PrintSystem::JobSpooler { last_page_printed_ = -1; // We only support PDF and XPS documents for now. if (print_data_mime_type == kContentTypePDF) { - scoped_ptr<DEVMODE[]> dev_mode; + scoped_ptr<DEVMODE, base::FreeDeleter> dev_mode; if (print_ticket_mime_type == kContentTypeJSON) { dev_mode = CjtToDevMode(printer_wide, print_ticket); } else { |