OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_ | |
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/memory/ref_counted_memory.h" | |
10 | |
11 namespace base { | |
12 class FilePath; | |
13 } | |
14 | |
15 namespace cloud_devices { | |
16 class CloudDeviceDescription; | |
17 } | |
18 | |
19 namespace gfx { | |
20 class Size; | |
21 } | |
22 | |
23 namespace printing { | |
24 class PdfRenderSettings; | |
25 struct PwgRasterSettings; | |
26 } | |
27 | |
28 namespace local_discovery { | |
29 | |
30 class PWGRasterConverter { | |
31 public: | |
32 // Callback for when the PDF is converted to a PWG raster. | |
33 // |success| denotes whether the conversion succeeded. | |
34 // |temp_file| is the path to the temp file (owned by the converter) that | |
35 // contains the PWG raster data. | |
36 typedef base::Callback<void(bool /*success*/, | |
37 const base::FilePath& /*temp_file*/)> | |
38 ResultCallback; | |
39 virtual ~PWGRasterConverter() {} | |
40 | |
41 static scoped_ptr<PWGRasterConverter> CreateDefault(); | |
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 | |
56 virtual void Start(base::RefCountedMemory* data, | |
57 const printing::PdfRenderSettings& conversion_settings, | |
58 const printing::PwgRasterSettings& bitmap_settings, | |
59 const ResultCallback& callback) = 0; | |
60 }; | |
61 | |
62 } // namespace local_discovery | |
63 | |
64 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_ | |
OLD | NEW |