Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / local_discovery / pwg_raster_converter.h
blob90412bea93b58dab37d35b316093bf4f10688e8a
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.
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_
8 #include "base/callback.h"
9 #include "base/memory/ref_counted_memory.h"
11 namespace base {
12 class FilePath;
15 namespace cloud_devices {
16 class CloudDeviceDescription;
19 namespace gfx {
20 class Size;
23 namespace printing {
24 class PdfRenderSettings;
25 struct PwgRasterSettings;
28 namespace local_discovery {
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() {}
41 static scoped_ptr<PWGRasterConverter> CreateDefault();
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);
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);
56 virtual void Start(base::RefCountedMemory* data,
57 const printing::PdfRenderSettings& conversion_settings,
58 const printing::PwgRasterSettings& bitmap_settings,
59 const ResultCallback& callback) = 0;
62 } // namespace local_discovery
64 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PWG_RASTER_CONVERTER_H_