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.h" | 5 #include "printing/printing_context.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" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 #ifndef NDEBUG | 115 #ifndef NDEBUG |
116 page_number_ = -1; | 116 page_number_ = -1; |
117 #endif | 117 #endif |
118 dialog_box_dismissed_ = false; | 118 dialog_box_dismissed_ = false; |
119 abort_printing_ = false; | 119 abort_printing_ = false; |
120 in_print_job_ = false; | 120 in_print_job_ = false; |
121 context_ = NULL; | 121 context_ = NULL; |
122 } | 122 } |
123 | 123 |
124 PrintingContext::Result PrintingContext::NewDocument( | 124 PrintingContext::Result PrintingContext::NewDocument( |
125 const std::wstring& document_name) { | 125 const string16& document_name) { |
126 DCHECK(!in_print_job_); | 126 DCHECK(!in_print_job_); |
127 | 127 |
128 in_print_job_ = true; | 128 in_print_job_ = true; |
129 | 129 |
130 PMPrintSession print_session = | 130 PMPrintSession print_session = |
131 static_cast<PMPrintSession>([print_info_ PMPrintSession]); | 131 static_cast<PMPrintSession>([print_info_ PMPrintSession]); |
132 PMPrintSettings print_settings = | 132 PMPrintSettings print_settings = |
133 static_cast<PMPrintSettings>([print_info_ PMPrintSettings]); | 133 static_cast<PMPrintSettings>([print_info_ PMPrintSettings]); |
134 PMPageFormat page_format = | 134 PMPageFormat page_format = |
135 static_cast<PMPageFormat>([print_info_ PMPageFormat]); | 135 static_cast<PMPageFormat>([print_info_ PMPageFormat]); |
136 | 136 |
137 scoped_cftyperef<CFStringRef> job_title( | 137 scoped_cftyperef<CFStringRef> job_title( |
138 base::SysWideToCFStringRef(document_name)); | 138 base::SysUTF16ToCFStringRef(document_name)); |
139 PMPrintSettingsSetJobName(print_settings, job_title.get()); | 139 PMPrintSettingsSetJobName(print_settings, job_title.get()); |
140 | 140 |
141 OSStatus status = PMSessionBeginCGDocumentNoDialog(print_session, | 141 OSStatus status = PMSessionBeginCGDocumentNoDialog(print_session, |
142 print_settings, | 142 print_settings, |
143 page_format); | 143 page_format); |
144 if (status != noErr) | 144 if (status != noErr) |
145 return OnError(); | 145 return OnError(); |
146 | 146 |
147 #ifndef NDEBUG | 147 #ifndef NDEBUG |
148 page_number_ = 0; | 148 page_number_ = 0; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void PrintingContext::DismissDialog() { | 220 void PrintingContext::DismissDialog() { |
221 NOTIMPLEMENTED(); | 221 NOTIMPLEMENTED(); |
222 } | 222 } |
223 | 223 |
224 PrintingContext::Result PrintingContext::OnError() { | 224 PrintingContext::Result PrintingContext::OnError() { |
225 ResetSettings(); | 225 ResetSettings(); |
226 return abort_printing_ ? CANCEL : FAILED; | 226 return abort_printing_ ? CANCEL : FAILED; |
227 } | 227 } |
228 | 228 |
229 } // namespace printing | 229 } // namespace printing |
OLD | NEW |