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