| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PRINT_DIALOG_GTK_INTERFACE_H_ | 5 #ifndef PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ |
| 6 #define PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ | 6 #define PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "printing/printing_context_gtk.h" | 9 #include "printing/printing_context_gtk.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 11 | 11 |
| 12 namespace printing { | 12 namespace printing { |
| 13 | 13 |
| 14 class Metafile; | 14 class Metafile; |
| 15 class PrintSettings; | 15 class PrintSettings; |
| 16 | 16 |
| 17 // An interface for GTK printing dialogs. Classes that live outside of | 17 // An interface for GTK printing dialogs. Classes that live outside of |
| 18 // printing/ can implement this interface and get threading requirements | 18 // printing/ can implement this interface and get threading requirements |
| 19 // correct without exposing those requirements to printing/. | 19 // correct without exposing those requirements to printing/. |
| 20 class PrintDialogGtkInterface { | 20 class PrintDialogGtkInterface { |
| 21 public: | 21 public: |
| 22 // Tell the dialog to use the default print setting. | 22 // Tell the dialog to use the default print setting. |
| 23 virtual void UseDefaultSettings() = 0; | 23 virtual void UseDefaultSettings() = 0; |
| 24 | 24 |
| 25 // Updates the dialog to use |settings|. Only used when printing without the | 25 // Updates the dialog to use |settings|. Only used when printing without the |
| 26 // system print dialog. E.g. for Print Preview. Returns false on error. | 26 // system print dialog. E.g. for Print Preview. Returns false on error. |
| 27 // |target_is_pdf| is true if implementation needs to generate PDF without | 27 virtual bool UpdateSettings(PrintSettings* settings) = 0; |
| 28 // actual printing. In this case implementation may avoid setup of native | |
| 29 // print system. Ex. "save to pdf" or Cloud Print. | |
| 30 virtual bool UpdateSettings(bool target_is_pdf, | |
| 31 PrintSettings* settings) = 0; | |
| 32 | 28 |
| 33 // Shows the dialog and handles the response with |callback|. Only used when | 29 // Shows the dialog and handles the response with |callback|. Only used when |
| 34 // printing with the native print dialog. | 30 // printing with the native print dialog. |
| 35 virtual void ShowDialog( | 31 virtual void ShowDialog( |
| 36 gfx::NativeView parent_view, | 32 gfx::NativeView parent_view, |
| 37 bool has_selection, | 33 bool has_selection, |
| 38 const PrintingContextGtk::PrintSettingsCallback& callback) = 0; | 34 const PrintingContextGtk::PrintSettingsCallback& callback) = 0; |
| 39 | 35 |
| 40 // Prints the document named |document_name| contained in |metafile|. | 36 // Prints the document named |document_name| contained in |metafile|. |
| 41 // Called from the print worker thread. Once called, the | 37 // Called from the print worker thread. Once called, the |
| 42 // PrintDialogGtkInterface instance should not be reused. | 38 // PrintDialogGtkInterface instance should not be reused. |
| 43 virtual void PrintDocument(const Metafile* metafile, | 39 virtual void PrintDocument(const Metafile* metafile, |
| 44 const base::string16& document_name) = 0; | 40 const base::string16& document_name) = 0; |
| 45 | 41 |
| 46 // Same as AddRef/Release, but with different names since | 42 // Same as AddRef/Release, but with different names since |
| 47 // PrintDialogGtkInterface does not inherit from RefCounted. | 43 // PrintDialogGtkInterface does not inherit from RefCounted. |
| 48 virtual void AddRefToDialog() = 0; | 44 virtual void AddRefToDialog() = 0; |
| 49 virtual void ReleaseDialog() = 0; | 45 virtual void ReleaseDialog() = 0; |
| 50 | 46 |
| 51 protected: | 47 protected: |
| 52 virtual ~PrintDialogGtkInterface() {} | 48 virtual ~PrintDialogGtkInterface() {} |
| 53 }; | 49 }; |
| 54 | 50 |
| 55 } // namespace printing | 51 } // namespace printing |
| 56 | 52 |
| 57 #endif // PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ | 53 #endif // PRINTING_PRINT_DIALOG_GTK_INTERFACE_H_ |
| OLD | NEW |