| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/service/cloud_print/cdd_conversion_win.h" | 5 #include "chrome/service/cloud_print/cdd_conversion_win.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include "base/memory/free_deleter.h" | 9 #include "base/memory/free_deleter.h" | 
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" | 
| 11 #include "components/cloud_devices/common/printer_description.h" | 11 #include "components/cloud_devices/common/printer_description.h" | 
| 12 #include "printing/backend/win_helper.h" | 12 #include "printing/backend/win_helper.h" | 
| 13 | 13 | 
| 14 namespace cloud_print { | 14 namespace cloud_print { | 
| 15 | 15 | 
| 16 bool IsValidCjt(const std::string& print_ticket_data) { | 16 bool IsValidCjt(const std::string& print_ticket_data) { | 
| 17   cloud_devices::CloudDeviceDescription description; | 17   cloud_devices::CloudDeviceDescription description; | 
| 18   return description.InitFromString(print_ticket_data); | 18   return description.InitFromString(print_ticket_data); | 
| 19 } | 19 } | 
| 20 | 20 | 
| 21 scoped_ptr<DEVMODE, base::FreeDeleter> CjtToDevMode( | 21 std::unique_ptr<DEVMODE, base::FreeDeleter> CjtToDevMode( | 
| 22     const base::string16& printer_name, | 22     const base::string16& printer_name, | 
| 23     const std::string& print_ticket) { | 23     const std::string& print_ticket) { | 
| 24   scoped_ptr<DEVMODE, base::FreeDeleter> dev_mode; | 24   std::unique_ptr<DEVMODE, base::FreeDeleter> dev_mode; | 
| 25 | 25 | 
| 26   cloud_devices::CloudDeviceDescription description; | 26   cloud_devices::CloudDeviceDescription description; | 
| 27   if (!description.InitFromString(print_ticket)) | 27   if (!description.InitFromString(print_ticket)) | 
| 28     return dev_mode; | 28     return dev_mode; | 
| 29 | 29 | 
| 30   using namespace cloud_devices::printer; | 30   using namespace cloud_devices::printer; | 
| 31   printing::ScopedPrinterHandle printer; | 31   printing::ScopedPrinterHandle printer; | 
| 32   if (!printer.OpenPrinter(printer_name.c_str())) | 32   if (!printer.OpenPrinter(printer_name.c_str())) | 
| 33     return dev_mode; | 33     return dev_mode; | 
| 34 | 34 | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 125       dev_mode->dmPaperWidth = width; | 125       dev_mode->dmPaperWidth = width; | 
| 126       dev_mode->dmFields |= DM_PAPERLENGTH; | 126       dev_mode->dmFields |= DM_PAPERLENGTH; | 
| 127       dev_mode->dmPaperLength = height; | 127       dev_mode->dmPaperLength = height; | 
| 128     } | 128     } | 
| 129   } | 129   } | 
| 130 | 130 | 
| 131   return printing::CreateDevMode(printer.Get(), dev_mode.get()); | 131   return printing::CreateDevMode(printer.Get(), dev_mode.get()); | 
| 132 } | 132 } | 
| 133 | 133 | 
| 134 }  // namespace cloud_print | 134 }  // namespace cloud_print | 
| OLD | NEW | 
|---|