kmadhusu@chromium.org | 7868ecab | 2011-03-05 00:12:53 | [diff] [blame^] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
jhawkins@chromium.org | 51e8d93 | 2010-10-06 22:21:17 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef PRINTING_PRINTING_CONTEXT_MAC_H_ |
| 6 | #define PRINTING_PRINTING_CONTEXT_MAC_H_ |
| 7 | |
sanjeevr@chromium.org | ee5f36e4 | 2010-12-03 22:40:37 | [diff] [blame] | 8 | #include <string> |
| 9 | |
jhawkins@chromium.org | 51e8d93 | 2010-10-06 22:21:17 | [diff] [blame] | 10 | #include "printing/printing_context.h" |
| 11 | |
| 12 | #ifdef __OBJC__ |
| 13 | @class NSPrintInfo; |
| 14 | #else |
| 15 | class NSPrintInfo; |
| 16 | #endif // __OBJC__ |
| 17 | |
| 18 | namespace printing { |
| 19 | |
| 20 | class PrintingContextMac : public PrintingContext { |
| 21 | public: |
sanjeevr@chromium.org | ee5f36e4 | 2010-12-03 22:40:37 | [diff] [blame] | 22 | explicit PrintingContextMac(const std::string& app_locale); |
jhawkins@chromium.org | 51e8d93 | 2010-10-06 22:21:17 | [diff] [blame] | 23 | ~PrintingContextMac(); |
| 24 | |
| 25 | // PrintingContext implementation. |
| 26 | virtual void AskUserForSettings(gfx::NativeView parent_view, |
| 27 | int max_pages, |
| 28 | bool has_selection, |
| 29 | PrintSettingsCallback* callback); |
| 30 | virtual Result UseDefaultSettings(); |
kmadhusu@chromium.org | 7868ecab | 2011-03-05 00:12:53 | [diff] [blame^] | 31 | virtual Result UpdatePrintSettings(const PageRanges& ranges); |
jhawkins@chromium.org | 51e8d93 | 2010-10-06 22:21:17 | [diff] [blame] | 32 | virtual Result InitWithSettings(const PrintSettings& settings); |
| 33 | virtual Result NewDocument(const string16& document_name); |
| 34 | virtual Result NewPage(); |
| 35 | virtual Result PageDone(); |
| 36 | virtual Result DocumentDone(); |
| 37 | virtual void Cancel(); |
jhawkins@chromium.org | 51e8d93 | 2010-10-06 22:21:17 | [diff] [blame] | 38 | virtual void ReleaseContext(); |
| 39 | virtual gfx::NativeDrawingContext context() const; |
| 40 | |
| 41 | private: |
| 42 | // Read the settings from the given NSPrintInfo (and cache it for later use). |
| 43 | void ParsePrintInfo(NSPrintInfo* print_info); |
| 44 | |
| 45 | // The native print info object. |
| 46 | NSPrintInfo* print_info_; |
| 47 | |
| 48 | // The current page's context; only valid between NewPage and PageDone call |
| 49 | // pairs. |
| 50 | CGContext* context_; |
| 51 | |
| 52 | DISALLOW_COPY_AND_ASSIGN(PrintingContextMac); |
| 53 | }; |
| 54 | |
| 55 | } // namespace printing |
| 56 | |
| 57 | #endif // PRINTING_PRINTING_CONTEXT_MAC_H_ |