#include "chrome/browser/printing/pwg_raster_converter.h"
#include <algorithm>
#include <memory>
#include <optional>
#include <utility>
#include "base/cancelable_callback.h"
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "chrome/browser/printing/printing_service.h"
#include "chrome/services/printing/public/mojom/pdf_to_pwg_raster_converter.mojom.h"
#include "chrome/services/printing/public/mojom/printing_service.mojom.h"
#include "components/cloud_devices/common/cloud_device_description.h"
#include "components/cloud_devices/common/printer_description.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "printing/mojom/print.mojom.h"
#include "printing/pdf_render_settings.h"
#include "printing/pwg_raster_settings.h"
#include "printing/units.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
namespace printing {
namespace {
BrowserThread;
class PwgRasterConverterHelper
: public base::RefCounted<PwgRasterConverterHelper> { … };
PwgRasterConverterHelper::PwgRasterConverterHelper(
const PdfRenderSettings& settings,
const PwgRasterSettings& bitmap_settings)
: … { … }
PwgRasterConverterHelper::~PwgRasterConverterHelper() { … }
void PwgRasterConverterHelper::Convert(
const std::optional<bool>& use_skia,
const base::RefCountedMemory* data,
PwgRasterConverter::ResultCallback callback) { … }
void PwgRasterConverterHelper::RunCallback(
base::ReadOnlySharedMemoryRegion region,
uint32_t page_count) { … }
class PwgRasterConverterImpl : public PwgRasterConverter { … };
PwgRasterConverterImpl::PwgRasterConverterImpl() = default;
PwgRasterConverterImpl::~PwgRasterConverterImpl() = default;
void PwgRasterConverterImpl::Start(const std::optional<bool>& use_skia,
const base::RefCountedMemory* data,
const PdfRenderSettings& conversion_settings,
const PwgRasterSettings& bitmap_settings,
ResultCallback callback) { … }
}
std::unique_ptr<PwgRasterConverter> PwgRasterConverter::CreateDefault() { … }
PdfRenderSettings PwgRasterConverter::GetConversionSettings(
const cloud_devices::CloudDeviceDescription& printer_capabilities,
const gfx::Size& page_size,
bool use_color) { … }
PwgRasterSettings PwgRasterConverter::GetBitmapSettings(
const cloud_devices::CloudDeviceDescription& printer_capabilities,
const cloud_devices::CloudDeviceDescription& ticket) { … }
}