| OLD | NEW |
| 1 // Copyright (c) 2011 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_H_ | 5 #ifndef PRINTING_PRINTING_CONTEXT_H_ |
| 6 #define PRINTING_PRINTING_CONTEXT_H_ | 6 #define PRINTING_PRINTING_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 Delegate() {}; | 31 Delegate() {}; |
| 32 virtual ~Delegate() {}; | 32 virtual ~Delegate() {}; |
| 33 | 33 |
| 34 // Returns parent view to use for modal dialogs. | 34 // Returns parent view to use for modal dialogs. |
| 35 virtual gfx::NativeView GetParentView() = 0; | 35 virtual gfx::NativeView GetParentView() = 0; |
| 36 | 36 |
| 37 // Returns application locale. | 37 // Returns application locale. |
| 38 virtual std::string GetAppLocale() = 0; | 38 virtual std::string GetAppLocale() = 0; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Tri-state result for user behavior-dependent functions. | 41 // Result for user behavior-dependent functions. |
| 42 enum Result { | 42 enum Result { |
| 43 OK, | 43 OK, |
| 44 CANCEL, | 44 CANCEL, |
| 45 FAILED, | 45 FAILED, |
| 46 SYSTEM_DIALOG_DONE, |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 virtual ~PrintingContext(); | 49 virtual ~PrintingContext(); |
| 49 | 50 |
| 50 // Callback of AskUserForSettings, used to notify the PrintJobWorker when | 51 // Callback of AskUserForSettings, used to notify the PrintJobWorker when |
| 51 // print settings are available. | 52 // print settings are available. |
| 52 typedef base::Callback<void(Result)> PrintSettingsCallback; | 53 typedef base::Callback<void(Result)> PrintSettingsCallback; |
| 53 | 54 |
| 55 // Called when a printing process initiated by a script finishes. |
| 56 // It's required to synchronize window.print() calls on Android |
| 57 virtual void RequestSystemDialog(const PrintSettingsCallback& cb); |
| 58 |
| 54 // Asks the user what printer and format should be used to print. Updates the | 59 // Asks the user what printer and format should be used to print. Updates the |
| 55 // context with the select device settings. The result of the call is returned | 60 // context with the select device settings. The result of the call is returned |
| 56 // in the callback. This is necessary for Linux, which only has an | 61 // in the callback. This is necessary for Linux, which only has an |
| 57 // asynchronous printing API. | 62 // asynchronous printing API. |
| 58 virtual void AskUserForSettings(int max_pages, | 63 virtual void AskUserForSettings(int max_pages, |
| 59 bool has_selection, | 64 bool has_selection, |
| 60 const PrintSettingsCallback& callback) = 0; | 65 const PrintSettingsCallback& callback) = 0; |
| 61 | 66 |
| 62 // Selects the user's default printer and format. Updates the context with the | 67 // Selects the user's default printer and format. Updates the context with the |
| 63 // default device settings. | 68 // default device settings. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Did the user cancel the print job. | 149 // Did the user cancel the print job. |
| 145 volatile bool abort_printing_; | 150 volatile bool abort_printing_; |
| 146 | 151 |
| 147 private: | 152 private: |
| 148 DISALLOW_COPY_AND_ASSIGN(PrintingContext); | 153 DISALLOW_COPY_AND_ASSIGN(PrintingContext); |
| 149 }; | 154 }; |
| 150 | 155 |
| 151 } // namespace printing | 156 } // namespace printing |
| 152 | 157 |
| 153 #endif // PRINTING_PRINTING_CONTEXT_H_ | 158 #endif // PRINTING_PRINTING_CONTEXT_H_ |
| OLD | NEW |