blob: 611fd565f7523f85c8b3d781080ecb1594702d0d [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include "printing/printing_context.h"
namespace base {
class DictionaryValue;
namespace printing {
class MetafilePlayer;
class PrintDialogGtkInterface;
// PrintingContext with optional native UI for print dialog and pdf_paper_size.
class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
explicit PrintingContextLinux(Delegate* delegate);
~PrintingContextLinux() override;
// Sets the function that creates the print dialog.
static void SetCreatePrintDialogFunction(
PrintDialogGtkInterface* (*create_dialog_func)(
PrintingContextLinux* context));
// Sets the function that returns pdf paper size through the native API.
static void SetPdfPaperSizeFunction(
gfx::Size (*get_pdf_paper_size)(PrintingContextLinux* context));
// Prints the document contained in |metafile|.
void PrintDocument(const MetafilePlayer& metafile);
// PrintingContext implementation.
void AskUserForSettings(int max_pages,
bool has_selection,
bool is_scripted,
const PrintSettingsCallback& callback) override;
gfx::Size GetPdfPaperSizeDeviceUnits() override;
Result UseDefaultSettings() override;
Result UpdatePrinterSettings(bool external_preview,
bool show_system_dialog) override;
Result InitWithSettings(const PrintSettings& settings) override;
Result NewDocument(const base::string16& document_name) override;
Result NewPage() override;
Result PageDone() override;
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
gfx::NativeDrawingContext context() const override;
base::string16 document_name_;
PrintDialogGtkInterface* print_dialog_;
} // namespace printing