forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
printing_context_linux.h
66 lines (51 loc) · 2.18 KB
/
printing_context_linux.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// 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.
#ifndef PRINTING_PRINTING_CONTEXT_LINUX_H_
#define PRINTING_PRINTING_CONTEXT_LINUX_H_
#include <string>
#include "base/macros.h"
#include "printing/printing_context.h"
namespace printing {
class MetafilePlayer;
class PrintDialogGtkInterface;
// PrintingContext with optional native UI for print dialog and pdf_paper_size.
class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
public:
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);
// Initializes with predefined settings.
void InitWithSettings(const PrintSettings& settings);
// PrintingContext implementation.
void AskUserForSettings(int max_pages,
bool has_selection,
bool is_scripted,
PrintSettingsCallback callback) override;
gfx::Size GetPdfPaperSizeDeviceUnits() override;
Result UseDefaultSettings() override;
Result UpdatePrinterSettings(bool external_preview,
bool show_system_dialog,
int page_count) override;
Result NewDocument(const base::string16& document_name) override;
Result NewPage() override;
Result PageDone() override;
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
printing::NativeDrawingContext context() const override;
private:
base::string16 document_name_;
PrintDialogGtkInterface* print_dialog_;
DISALLOW_COPY_AND_ASSIGN(PrintingContextLinux);
};
} // namespace printing
#endif // PRINTING_PRINTING_CONTEXT_LINUX_H_