Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / printing / printing_context_linux.h
blob0de512c70ac3c77ffa7ad9321a4d1fa66c6209a0
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PRINTING_PRINTING_CONTEXT_LINUX_H_
6 #define PRINTING_PRINTING_CONTEXT_LINUX_H_
8 #include <string>
10 #include "printing/printing_context.h"
12 namespace base {
13 class DictionaryValue;
16 namespace printing {
18 class MetafilePlayer;
19 class PrintDialogGtkInterface;
21 // PrintingContext with optional native UI for print dialog and pdf_paper_size.
22 class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
23 public:
24 explicit PrintingContextLinux(Delegate* delegate);
25 ~PrintingContextLinux() override;
27 // Sets the function that creates the print dialog.
28 static void SetCreatePrintDialogFunction(
29 PrintDialogGtkInterface* (*create_dialog_func)(
30 PrintingContextLinux* context));
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));
36 // Prints the document contained in |metafile|.
37 void PrintDocument(const MetafilePlayer& metafile);
39 // PrintingContext implementation.
40 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,
48 int page_count) override;
49 Result InitWithSettings(const PrintSettings& settings) override;
50 Result NewDocument(const base::string16& document_name) override;
51 Result NewPage() override;
52 Result PageDone() override;
53 Result DocumentDone() override;
54 void Cancel() override;
55 void ReleaseContext() override;
56 gfx::NativeDrawingContext context() const override;
58 private:
59 base::string16 document_name_;
60 PrintDialogGtkInterface* print_dialog_;
62 DISALLOW_COPY_AND_ASSIGN(PrintingContextLinux);
65 } // namespace printing
67 #endif // PRINTING_PRINTING_CONTEXT_LINUX_H_