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_MAC_H_ | 5 #ifndef PRINTING_PRINTING_CONTEXT_MAC_H_ |
6 #define PRINTING_PRINTING_CONTEXT_MAC_H_ | 6 #define PRINTING_PRINTING_CONTEXT_MAC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 virtual Result InitWithSettings(const PrintSettings& settings); | 35 virtual Result InitWithSettings(const PrintSettings& settings); |
36 virtual Result NewDocument(const string16& document_name); | 36 virtual Result NewDocument(const string16& document_name); |
37 virtual Result NewPage(); | 37 virtual Result NewPage(); |
38 virtual Result PageDone(); | 38 virtual Result PageDone(); |
39 virtual Result DocumentDone(); | 39 virtual Result DocumentDone(); |
40 virtual void Cancel(); | 40 virtual void Cancel(); |
41 virtual void ReleaseContext(); | 41 virtual void ReleaseContext(); |
42 virtual gfx::NativeDrawingContext context() const; | 42 virtual gfx::NativeDrawingContext context() const; |
43 | 43 |
44 private: | 44 private: |
45 // Read the settings from the given NSPrintInfo (and cache it for later use). | 45 // Initializes PrintSettings from |print_info_|. This must be called |
46 void ParsePrintInfo(NSPrintInfo* print_info); | 46 // after changes to |print_info_| in order for the changes to take effect in |
| 47 // printing. |
| 48 // This function ignores the page range information specified in the print |
| 49 // info object and use |ranges| instead. |
| 50 void InitPrintSettingsFromPrintInfo(const PageRanges& ranges); |
47 | 51 |
48 // Initializes PrintSettings from native print info object. | 52 // Returns the set of page ranges constructed from |print_info_|. |
49 void InitPrintSettingsFromPrintInfo(const PageRanges& ranges); | 53 PageRanges GetPageRangesFromPrintInfo(); |
50 | 54 |
51 // Updates |print_info_| to use the given printer. | 55 // Updates |print_info_| to use the given printer. |
52 // Returns true if the printer was set else returns false. | 56 // Returns true if the printer was set else returns false. |
53 bool SetPrinter(const std::string& device_name); | 57 bool SetPrinter(const std::string& device_name); |
54 | 58 |
55 // Sets |copies| in PMPrintSettings. | 59 // Sets |copies| in PMPrintSettings. |
56 // Returns true if the number of copies is set. | 60 // Returns true if the number of copies is set. |
57 bool SetCopiesInPrintSettings(int copies); | 61 bool SetCopiesInPrintSettings(int copies); |
58 | 62 |
59 // Sets |collate| in PMPrintSettings. | 63 // Sets |collate| in PMPrintSettings. |
(...skipping 18 matching lines...) Expand all Loading... |
78 // The current page's context; only valid between NewPage and PageDone call | 82 // The current page's context; only valid between NewPage and PageDone call |
79 // pairs. | 83 // pairs. |
80 CGContext* context_; | 84 CGContext* context_; |
81 | 85 |
82 DISALLOW_COPY_AND_ASSIGN(PrintingContextMac); | 86 DISALLOW_COPY_AND_ASSIGN(PrintingContextMac); |
83 }; | 87 }; |
84 | 88 |
85 } // namespace printing | 89 } // namespace printing |
86 | 90 |
87 #endif // PRINTING_PRINTING_CONTEXT_MAC_H_ | 91 #endif // PRINTING_PRINTING_CONTEXT_MAC_H_ |
OLD | NEW |