| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 | 10 |
| 11 namespace base { | 11 namespace base { |
| 12 class FilePath; | 12 class FilePath; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace cloud_devices { |
| 16 class CloudDeviceDescription; |
| 17 } |
| 18 |
| 15 namespace gfx { | 19 namespace gfx { |
| 16 class Size; | 20 class Size; |
| 17 } | 21 } |
| 18 | 22 |
| 19 namespace printing { | 23 namespace printing { |
| 20 class PdfRenderSettings; | 24 class PdfRenderSettings; |
| 21 struct PwgRasterSettings; | 25 struct PwgRasterSettings; |
| 22 } | 26 } |
| 23 | 27 |
| 24 namespace local_discovery { | 28 namespace local_discovery { |
| 25 | 29 |
| 26 class PWGRasterConverter { | 30 class PWGRasterConverter { |
| 27 public: | 31 public: |
| 28 // Callback for when the PDF is converted to a PWG raster. | 32 // Callback for when the PDF is converted to a PWG raster. |
| 29 // |success| denotes whether the conversion succeeded. | 33 // |success| denotes whether the conversion succeeded. |
| 30 // |temp_file| is the path to the temp file (owned by the converter) that | 34 // |temp_file| is the path to the temp file (owned by the converter) that |
| 31 // contains the PWG raster data. | 35 // contains the PWG raster data. |
| 32 typedef base::Callback<void(bool /*success*/, | 36 typedef base::Callback<void(bool /*success*/, |
| 33 const base::FilePath& /*temp_file*/)> | 37 const base::FilePath& /*temp_file*/)> |
| 34 ResultCallback; | 38 ResultCallback; |
| 35 virtual ~PWGRasterConverter() {} | 39 virtual ~PWGRasterConverter() {} |
| 36 | 40 |
| 37 static scoped_ptr<PWGRasterConverter> CreateDefault(); | 41 static scoped_ptr<PWGRasterConverter> CreateDefault(); |
| 38 | 42 |
| 43 // Generates conversion settings to be used with converter from printer |
| 44 // capabilities and page size. |
| 45 // TODO(vitalybuka): Extract page size from pdf document data. |
| 46 static printing::PdfRenderSettings GetConversionSettings( |
| 47 const cloud_devices::CloudDeviceDescription& printer_capabilities, |
| 48 const gfx::Size& page_size); |
| 49 |
| 50 // Generates pwg bitmap settings to be used with the converter from |
| 51 // device capabilites and printing ticket. |
| 52 static printing::PwgRasterSettings GetBitmapSettings( |
| 53 const cloud_devices::CloudDeviceDescription& printer_capabilities, |
| 54 const cloud_devices::CloudDeviceDescription& ticket); |
| 55 |
| 39 virtual void Start(base::RefCountedMemory* data, | 56 virtual void Start(base::RefCountedMemory* data, |
| 40 const printing::PdfRenderSettings& conversion_settings, | 57 const printing::PdfRenderSettings& conversion_settings, |
| 41 const printing::PwgRasterSettings& bitmap_settings, | 58 const printing::PwgRasterSettings& bitmap_settings, |
| 42 const ResultCallback& callback) = 0; | 59 const ResultCallback& callback) = 0; |
| 43 }; | 60 }; |
| 44 | 61 |
| 45 } // namespace local_discovery | 62 } // namespace local_discovery |
| 46 | 63 |
| 47 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_ | 64 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_ |
| OLD | NEW |