| 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 #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" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 bool PrintingContextMac::SetDuplexModeInPrintSettings(DuplexMode mode) { | 230 bool PrintingContextMac::SetDuplexModeInPrintSettings(DuplexMode mode) { |
| 231 PMDuplexMode duplexSetting; | 231 PMDuplexMode duplexSetting; |
| 232 switch (mode) { | 232 switch (mode) { |
| 233 case LONG_EDGE: | 233 case LONG_EDGE: |
| 234 duplexSetting = kPMDuplexNoTumble; | 234 duplexSetting = kPMDuplexNoTumble; |
| 235 break; | 235 break; |
| 236 case SHORT_EDGE: | 236 case SHORT_EDGE: |
| 237 duplexSetting = kPMDuplexTumble; | 237 duplexSetting = kPMDuplexTumble; |
| 238 break; | 238 break; |
| 239 case SIMPLEX: | 239 default: |
| 240 duplexSetting = kPMDuplexNone; | 240 duplexSetting = kPMDuplexNone; |
| 241 break; | 241 break; |
| 242 default: // UNKNOWN_DUPLEX_MODE | |
| 243 return true; | |
| 244 } | 242 } |
| 245 | 243 |
| 246 PMPrintSettings pmPrintSettings = | 244 PMPrintSettings pmPrintSettings = |
| 247 static_cast<PMPrintSettings>([print_info_.get() PMPrintSettings]); | 245 static_cast<PMPrintSettings>([print_info_.get() PMPrintSettings]); |
| 248 return PMSetDuplex(pmPrintSettings, duplexSetting) == noErr; | 246 return PMSetDuplex(pmPrintSettings, duplexSetting) == noErr; |
| 249 } | 247 } |
| 250 | 248 |
| 251 bool PrintingContextMac::SetOutputColor(int color_mode) { | 249 bool PrintingContextMac::SetOutputColor(int color_mode) { |
| 252 PMPrintSettings pmPrintSettings = | 250 PMPrintSettings pmPrintSettings = |
| 253 static_cast<PMPrintSettings>([print_info_.get() PMPrintSettings]); | 251 static_cast<PMPrintSettings>([print_info_.get() PMPrintSettings]); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 void PrintingContextMac::ReleaseContext() { | 375 void PrintingContextMac::ReleaseContext() { |
| 378 print_info_.reset(); | 376 print_info_.reset(); |
| 379 context_ = NULL; | 377 context_ = NULL; |
| 380 } | 378 } |
| 381 | 379 |
| 382 gfx::NativeDrawingContext PrintingContextMac::context() const { | 380 gfx::NativeDrawingContext PrintingContextMac::context() const { |
| 383 return context_; | 381 return context_; |
| 384 } | 382 } |
| 385 | 383 |
| 386 } // namespace printing | 384 } // namespace printing |
| OLD | NEW |