OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PRINTING_PRINTING_CONTEXT_CAIRO_H_ | 5 #ifndef PRINTING_PRINTING_CONTEXT_CAIRO_H_ |
6 #define PRINTING_PRINTING_CONTEXT_CAIRO_H_ | 6 #define PRINTING_PRINTING_CONTEXT_CAIRO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "printing/printing_context.h" | 10 #include "printing/printing_context.h" |
11 | 11 |
| 12 #if !defined(OS_CHROMEOS) |
| 13 #include "printing/native_metafile.h" |
| 14 #endif |
| 15 |
12 namespace printing { | 16 namespace printing { |
13 | 17 |
14 class PrintingContextCairo : public PrintingContext { | 18 class PrintingContextCairo : public PrintingContext { |
15 public: | 19 public: |
16 explicit PrintingContextCairo(const std::string& app_locale); | 20 explicit PrintingContextCairo(const std::string& app_locale); |
17 ~PrintingContextCairo(); | 21 ~PrintingContextCairo(); |
18 | 22 |
| 23 #if !defined(OS_CHROMEOS) |
| 24 // Sets the function that creates the print dialog, and the function that |
| 25 // prints the document. |
| 26 static void SetPrintingFunctions( |
| 27 void* (*create_dialog_func)(PrintSettingsCallback* callback, |
| 28 PrintingContextCairo* context), |
| 29 void (*print_document_func)(void* print_dialog, |
| 30 const NativeMetafile* metafile, |
| 31 const string16& document_name)); |
| 32 |
| 33 // Prints the document contained in |metafile|. |
| 34 void PrintDocument(const NativeMetafile* metafile); |
| 35 #endif |
| 36 |
19 // PrintingContext implementation. | 37 // PrintingContext implementation. |
20 virtual void AskUserForSettings(gfx::NativeView parent_view, | 38 virtual void AskUserForSettings(gfx::NativeView parent_view, |
21 int max_pages, | 39 int max_pages, |
22 bool has_selection, | 40 bool has_selection, |
23 PrintSettingsCallback* callback); | 41 PrintSettingsCallback* callback); |
24 virtual Result UseDefaultSettings(); | 42 virtual Result UseDefaultSettings(); |
25 virtual Result InitWithSettings(const PrintSettings& settings); | 43 virtual Result InitWithSettings(const PrintSettings& settings); |
26 virtual Result NewDocument(const string16& document_name); | 44 virtual Result NewDocument(const string16& document_name); |
27 virtual Result NewPage(); | 45 virtual Result NewPage(); |
28 virtual Result PageDone(); | 46 virtual Result PageDone(); |
29 virtual Result DocumentDone(); | 47 virtual Result DocumentDone(); |
30 virtual void Cancel(); | 48 virtual void Cancel(); |
31 virtual void ReleaseContext(); | 49 virtual void ReleaseContext(); |
32 virtual gfx::NativeDrawingContext context() const; | 50 virtual gfx::NativeDrawingContext context() const; |
33 | 51 |
34 private: | 52 private: |
| 53 #if !defined(OS_CHROMEOS) |
| 54 string16 document_name_; |
| 55 void* print_dialog_; |
| 56 #endif |
| 57 |
35 DISALLOW_COPY_AND_ASSIGN(PrintingContextCairo); | 58 DISALLOW_COPY_AND_ASSIGN(PrintingContextCairo); |
36 }; | 59 }; |
37 | 60 |
38 } // namespace printing | 61 } // namespace printing |
39 | 62 |
40 #endif // PRINTING_PRINTING_CONTEXT_CAIRO_H_ | 63 #endif // PRINTING_PRINTING_CONTEXT_CAIRO_H_ |
OLD | NEW |