| 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 #import <iomanip> | 10 #import <iomanip> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 context_(NULL) { | 78 context_(NULL) { |
| 79 } | 79 } |
| 80 | 80 |
| 81 PrintingContextMac::~PrintingContextMac() { | 81 PrintingContextMac::~PrintingContextMac() { |
| 82 ReleaseContext(); | 82 ReleaseContext(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void PrintingContextMac::AskUserForSettings( | 85 void PrintingContextMac::AskUserForSettings( |
| 86 int max_pages, | 86 int max_pages, |
| 87 bool has_selection, | 87 bool has_selection, |
| 88 bool is_scripted, |
| 88 const PrintSettingsCallback& callback) { | 89 const PrintSettingsCallback& callback) { |
| 89 // Third-party print drivers seem to be an area prone to raising exceptions. | 90 // Third-party print drivers seem to be an area prone to raising exceptions. |
| 90 // This will allow exceptions to be raised, but does not handle them. The | 91 // This will allow exceptions to be raised, but does not handle them. The |
| 91 // NSPrintPanel appears to have appropriate NSException handlers. | 92 // NSPrintPanel appears to have appropriate NSException handlers. |
| 92 base::mac::ScopedNSExceptionEnabler enabler; | 93 base::mac::ScopedNSExceptionEnabler enabler; |
| 93 | 94 |
| 94 // Exceptions can also happen when the NSPrintPanel is being | 95 // Exceptions can also happen when the NSPrintPanel is being |
| 95 // deallocated, so it must be autoreleased within this scope. | 96 // deallocated, so it must be autoreleased within this scope. |
| 96 base::mac::ScopedNSAutoreleasePool pool; | 97 base::mac::ScopedNSAutoreleasePool pool; |
| 97 | 98 |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 void PrintingContextMac::ReleaseContext() { | 519 void PrintingContextMac::ReleaseContext() { |
| 519 print_info_.reset(); | 520 print_info_.reset(); |
| 520 context_ = NULL; | 521 context_ = NULL; |
| 521 } | 522 } |
| 522 | 523 |
| 523 gfx::NativeDrawingContext PrintingContextMac::context() const { | 524 gfx::NativeDrawingContext PrintingContextMac::context() const { |
| 524 return context_; | 525 return context_; |
| 525 } | 526 } |
| 526 | 527 |
| 527 } // namespace printing | 528 } // namespace printing |
| OLD | NEW |