OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "printing/printing_context_mac.h" | 5 #include "printing/printing_context_mac.h" |
6 | 6 |
7 #import <ApplicationServices/ApplicationServices.h> | 7 #import <ApplicationServices/ApplicationServices.h> |
8 #import <AppKit/AppKit.h> | 8 #import <AppKit/AppKit.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 | 13 |
14 namespace printing { | 14 namespace printing { |
15 | 15 |
16 // static | 16 // static |
17 PrintingContext* PrintingContext::Create() { | 17 PrintingContext* PrintingContext::Create() { |
18 return static_cast<PrintingContext*>(new PrintingContextMac); | 18 return static_cast<PrintingContext*>(new PrintingContextMac); |
19 } | 19 } |
20 | 20 |
21 PrintingContextMac::PrintingContextMac() | 21 PrintingContextMac::PrintingContextMac() |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 in_print_job_ = true; | 117 in_print_job_ = true; |
118 | 118 |
119 PMPrintSession print_session = | 119 PMPrintSession print_session = |
120 static_cast<PMPrintSession>([print_info_ PMPrintSession]); | 120 static_cast<PMPrintSession>([print_info_ PMPrintSession]); |
121 PMPrintSettings print_settings = | 121 PMPrintSettings print_settings = |
122 static_cast<PMPrintSettings>([print_info_ PMPrintSettings]); | 122 static_cast<PMPrintSettings>([print_info_ PMPrintSettings]); |
123 PMPageFormat page_format = | 123 PMPageFormat page_format = |
124 static_cast<PMPageFormat>([print_info_ PMPageFormat]); | 124 static_cast<PMPageFormat>([print_info_ PMPageFormat]); |
125 | 125 |
126 scoped_cftyperef<CFStringRef> job_title( | 126 base::mac::ScopedCFTypeRef<CFStringRef> job_title( |
127 base::SysUTF16ToCFStringRef(document_name)); | 127 base::SysUTF16ToCFStringRef(document_name)); |
128 PMPrintSettingsSetJobName(print_settings, job_title.get()); | 128 PMPrintSettingsSetJobName(print_settings, job_title.get()); |
129 | 129 |
130 OSStatus status = PMSessionBeginCGDocumentNoDialog(print_session, | 130 OSStatus status = PMSessionBeginCGDocumentNoDialog(print_session, |
131 print_settings, | 131 print_settings, |
132 page_format); | 132 page_format); |
133 if (status != noErr) | 133 if (status != noErr) |
134 return OnError(); | 134 return OnError(); |
135 | 135 |
136 return OK; | 136 return OK; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 print_info_ = nil; | 208 print_info_ = nil; |
209 context_ = NULL; | 209 context_ = NULL; |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 gfx::NativeDrawingContext PrintingContextMac::context() const { | 213 gfx::NativeDrawingContext PrintingContextMac::context() const { |
214 return context_; | 214 return context_; |
215 } | 215 } |
216 | 216 |
217 } // namespace printing | 217 } // namespace printing |
OLD | NEW |