blob: 611fd565f7523f85c8b3d781080ecb1594702d0d [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
[email protected]51e8d9352010-10-06 22:21:1710#include "printing/printing_context.h"
11
[email protected]f3a1c642011-07-12 19:15:0312namespace base {
13class DictionaryValue;
14}
15
[email protected]51e8d9352010-10-06 22:21:1716namespace printing {
17
vitalybuka5d1290582014-09-12 09:19:5918class MetafilePlayer;
[email protected]eaa389e2011-04-11 04:58:2019class PrintDialogGtkInterface;
20
[email protected]d53002f42014-01-14 16:08:5621// PrintingContext with optional native UI for print dialog and pdf_paper_size.
22class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
[email protected]51e8d9352010-10-06 22:21:1723 public:
Vitaly Bukabd7c9812014-08-26 08:57:5424 explicit PrintingContextLinux(Delegate* delegate);
dcheng0f9f1d72014-12-22 23:35:1625 ~PrintingContextLinux() override;
[email protected]51e8d9352010-10-06 22:21:1726
[email protected]eaa389e2011-04-11 04:58:2027 // Sets the function that creates the print dialog.
28 static void SetCreatePrintDialogFunction(
29 PrintDialogGtkInterface* (*create_dialog_func)(
[email protected]d53002f42014-01-14 16:08:5630 PrintingContextLinux* context));
31
32 // Sets the function that returns pdf paper size through the native API.
33 static void SetPdfPaperSizeFunction(
34 gfx::Size (*get_pdf_paper_size)(PrintingContextLinux* context));
[email protected]5cc4c422011-02-19 00:09:2235
36 // Prints the document contained in |metafile|.
vitalybuka5d1290582014-09-12 09:19:5937 void PrintDocument(const MetafilePlayer& metafile);
[email protected]5cc4c422011-02-19 00:09:2238
[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,
43 const PrintSettingsCallback& callback) override;
44 gfx::Size GetPdfPaperSizeDeviceUnits() override;
45 Result UseDefaultSettings() override;
46 Result UpdatePrinterSettings(bool external_preview,
47 bool show_system_dialog) override;
48 Result InitWithSettings(const PrintSettings& settings) override;
49 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;
55 gfx::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_