blob: 307601488db9def05b36f90d6ee36996c11395f1 [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
[email protected]7d7489902011-04-11 21:54:0618class Metafile;
[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:
[email protected]d53002f42014-01-14 16:08:5624 explicit PrintingContextLinux(const std::string& app_locale);
25 virtual ~PrintingContextLinux();
[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|.
[email protected]7d7489902011-04-11 21:54:0637 void PrintDocument(const Metafile* metafile);
[email protected]5cc4c422011-02-19 00:09:2238
[email protected]51e8d9352010-10-06 22:21:1739 // PrintingContext implementation.
[email protected]abe48112011-11-19 01:58:3840 virtual void AskUserForSettings(
41 gfx::NativeView parent_view,
42 int max_pages,
43 bool has_selection,
44 const PrintSettingsCallback& callback) OVERRIDE;
[email protected]4c9054b2013-11-04 18:34:2945 virtual gfx::Size GetPdfPaperSizeDeviceUnits() OVERRIDE;
[email protected]d85a45c2011-11-16 17:28:5346 virtual Result UseDefaultSettings() OVERRIDE;
[email protected]4c9054b2013-11-04 18:34:2947 virtual Result UpdatePrinterSettings(bool external_preview) OVERRIDE;
[email protected]d85a45c2011-11-16 17:28:5348 virtual Result InitWithSettings(const PrintSettings& settings) OVERRIDE;
[email protected]b5fa4ee2013-10-01 07:19:0749 virtual Result NewDocument(const base::string16& document_name) OVERRIDE;
[email protected]d85a45c2011-11-16 17:28:5350 virtual Result NewPage() OVERRIDE;
51 virtual Result PageDone() OVERRIDE;
52 virtual Result DocumentDone() OVERRIDE;
53 virtual void Cancel() OVERRIDE;
54 virtual void ReleaseContext() OVERRIDE;
55 virtual 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_