blob: 1dd5085ecb23d6e61d2273eb9a3f8908504bfcce [file] [log] [blame]
[email protected]d53002f42014-01-14 16:08:561// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]51e8d9352010-10-06 22:21:172// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]d53002f42014-01-14 16:08:565#ifndef PRINTING_PRINTING_CONTEXT_LINUX_H_
6#define PRINTING_PRINTING_CONTEXT_LINUX_H_
[email protected]51e8d9352010-10-06 22:21:177
[email protected]ee5f36e42010-12-03 22:40:378#include <string>
9
avi126e93c2015-12-21 21:48:1610#include "base/macros.h"
[email protected]51e8d9352010-10-06 22:21:1711#include "printing/printing_context.h"
12
13namespace printing {
14
vitalybuka5d1290582014-09-12 09:19:5915class MetafilePlayer;
[email protected]eaa389e2011-04-11 04:58:2016class PrintDialogGtkInterface;
17
[email protected]d53002f42014-01-14 16:08:5618// PrintingContext with optional native UI for print dialog and pdf_paper_size.
19class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
[email protected]51e8d9352010-10-06 22:21:1720 public:
Vitaly Bukabd7c9812014-08-26 08:57:5421 explicit PrintingContextLinux(Delegate* delegate);
dcheng0f9f1d72014-12-22 23:35:1622 ~PrintingContextLinux() override;
[email protected]51e8d9352010-10-06 22:21:1723
[email protected]eaa389e2011-04-11 04:58:2024 // Sets the function that creates the print dialog.
25 static void SetCreatePrintDialogFunction(
26 PrintDialogGtkInterface* (*create_dialog_func)(
[email protected]d53002f42014-01-14 16:08:5627 PrintingContextLinux* context));
28
29 // Sets the function that returns pdf paper size through the native API.
30 static void SetPdfPaperSizeFunction(
31 gfx::Size (*get_pdf_paper_size)(PrintingContextLinux* context));
[email protected]5cc4c422011-02-19 00:09:2232
33 // Prints the document contained in |metafile|.
vitalybuka5d1290582014-09-12 09:19:5934 void PrintDocument(const MetafilePlayer& metafile);
[email protected]5cc4c422011-02-19 00:09:2235
thestig5f683912016-09-30 22:42:1636 // Initializes with predefined settings.
37 void InitWithSettings(const PrintSettings& settings);
38
[email protected]51e8d9352010-10-06 22:21:1739 // PrintingContext implementation.
dcheng0f9f1d72014-12-22 23:35:1640 void AskUserForSettings(int max_pages,
41 bool has_selection,
42 bool is_scripted,
Vladislav Kuzkokov48ceab22018-02-14 16:29:2843 PrintSettingsCallback callback) override;
dcheng0f9f1d72014-12-22 23:35:1644 gfx::Size GetPdfPaperSizeDeviceUnits() override;
45 Result UseDefaultSettings() override;
46 Result UpdatePrinterSettings(bool external_preview,
vitalybuka95fa3c92015-05-05 03:03:3247 bool show_system_dialog,
48 int page_count) override;
dcheng0f9f1d72014-12-22 23:35:1649 Result NewDocument(const base::string16& document_name) override;
50 Result NewPage() override;
51 Result PageDone() override;
52 Result DocumentDone() override;
53 void Cancel() override;
54 void ReleaseContext() override;
Nico Weber8e559562017-10-03 01:25:2655 printing::NativeDrawingContext context() const override;
[email protected]51e8d9352010-10-06 22:21:1756
57 private:
[email protected]b5fa4ee2013-10-01 07:19:0758 base::string16 document_name_;
[email protected]eaa389e2011-04-11 04:58:2059 PrintDialogGtkInterface* print_dialog_;
[email protected]5cc4c422011-02-19 00:09:2260
[email protected]d53002f42014-01-14 16:08:5661 DISALLOW_COPY_AND_ASSIGN(PrintingContextLinux);
[email protected]51e8d9352010-10-06 22:21:1762};
63
64} // namespace printing
65
[email protected]d53002f42014-01-14 16:08:5666#endif // PRINTING_PRINTING_CONTEXT_LINUX_H_