blob: c513d6a2a38435bf7acc82fca2be26b9e5d4b6da [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
[email protected]f3a1c642011-07-12 19:15:0313namespace base {
14class DictionaryValue;
15}
16
[email protected]51e8d9352010-10-06 22:21:1717namespace printing {
18
vitalybuka5d1290582014-09-12 09:19:5919class MetafilePlayer;
[email protected]eaa389e2011-04-11 04:58:2020class PrintDialogGtkInterface;
21
[email protected]d53002f42014-01-14 16:08:5622// PrintingContext with optional native UI for print dialog and pdf_paper_size.
23class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
[email protected]51e8d9352010-10-06 22:21:1724 public:
Vitaly Bukabd7c9812014-08-26 08:57:5425 explicit PrintingContextLinux(Delegate* delegate);
dcheng0f9f1d72014-12-22 23:35:1626 ~PrintingContextLinux() override;
[email protected]51e8d9352010-10-06 22:21:1727
[email protected]eaa389e2011-04-11 04:58:2028 // Sets the function that creates the print dialog.
29 static void SetCreatePrintDialogFunction(
30 PrintDialogGtkInterface* (*create_dialog_func)(
[email protected]d53002f42014-01-14 16:08:5631 PrintingContextLinux* context));
32
33 // Sets the function that returns pdf paper size through the native API.
34 static void SetPdfPaperSizeFunction(
35 gfx::Size (*get_pdf_paper_size)(PrintingContextLinux* context));
[email protected]5cc4c422011-02-19 00:09:2236
37 // Prints the document contained in |metafile|.
vitalybuka5d1290582014-09-12 09:19:5938 void PrintDocument(const MetafilePlayer& metafile);
[email protected]5cc4c422011-02-19 00:09:2239
thestig5f683912016-09-30 22:42:1640 // Initializes with predefined settings.
41 void InitWithSettings(const PrintSettings& settings);
42
[email protected]51e8d9352010-10-06 22:21:1743 // PrintingContext implementation.
dcheng0f9f1d72014-12-22 23:35:1644 void AskUserForSettings(int max_pages,
45 bool has_selection,
46 bool is_scripted,
47 const PrintSettingsCallback& callback) override;
48 gfx::Size GetPdfPaperSizeDeviceUnits() override;
49 Result UseDefaultSettings() override;
50 Result UpdatePrinterSettings(bool external_preview,
vitalybuka95fa3c92015-05-05 03:03:3251 bool show_system_dialog,
52 int page_count) override;
dcheng0f9f1d72014-12-22 23:35:1653 Result NewDocument(const base::string16& document_name) override;
54 Result NewPage() override;
55 Result PageDone() override;
56 Result DocumentDone() override;
57 void Cancel() override;
58 void ReleaseContext() override;
59 gfx::NativeDrawingContext context() const override;
[email protected]51e8d9352010-10-06 22:21:1760
61 private:
[email protected]b5fa4ee2013-10-01 07:19:0762 base::string16 document_name_;
[email protected]eaa389e2011-04-11 04:58:2063 PrintDialogGtkInterface* print_dialog_;
[email protected]5cc4c422011-02-19 00:09:2264
[email protected]d53002f42014-01-14 16:08:5665 DISALLOW_COPY_AND_ASSIGN(PrintingContextLinux);
[email protected]51e8d9352010-10-06 22:21:1766};
67
68} // namespace printing
69
[email protected]d53002f42014-01-14 16:08:5670#endif // PRINTING_PRINTING_CONTEXT_LINUX_H_