| 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 <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #import <iomanip> | 9 #import <iomanip> |
| 10 #import <numeric> | 10 #import <numeric> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
| 14 #include "base/mac/scoped_nsautorelease_pool.h" | 14 #include "base/mac/scoped_nsautorelease_pool.h" |
| 15 #include "base/memory/ptr_util.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/values.h" | 18 #include "base/values.h" |
| 18 #include "printing/print_settings_initializer_mac.h" | 19 #include "printing/print_settings_initializer_mac.h" |
| 19 #include "printing/units.h" | 20 #include "printing/units.h" |
| 20 | 21 |
| 21 namespace printing { | 22 namespace printing { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 best_matching_paper = paper; | 60 best_matching_paper = paper; |
| 60 best_match = difference; | 61 best_match = difference; |
| 61 } | 62 } |
| 62 } | 63 } |
| 63 return best_matching_paper; | 64 return best_matching_paper; |
| 64 } | 65 } |
| 65 | 66 |
| 66 } // namespace | 67 } // namespace |
| 67 | 68 |
| 68 // static | 69 // static |
| 69 scoped_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) { | 70 std::unique_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) { |
| 70 return make_scoped_ptr<PrintingContext>(new PrintingContextMac(delegate)); | 71 return base::WrapUnique(new PrintingContextMac(delegate)); |
| 71 } | 72 } |
| 72 | 73 |
| 73 PrintingContextMac::PrintingContextMac(Delegate* delegate) | 74 PrintingContextMac::PrintingContextMac(Delegate* delegate) |
| 74 : PrintingContext(delegate), | 75 : PrintingContext(delegate), |
| 75 print_info_([[NSPrintInfo sharedPrintInfo] copy]), | 76 print_info_([[NSPrintInfo sharedPrintInfo] copy]), |
| 76 context_(NULL) { | 77 context_(NULL) { |
| 77 } | 78 } |
| 78 | 79 |
| 79 PrintingContextMac::~PrintingContextMac() { | 80 PrintingContextMac::~PrintingContextMac() { |
| 80 ReleaseContext(); | 81 ReleaseContext(); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 void PrintingContextMac::ReleaseContext() { | 514 void PrintingContextMac::ReleaseContext() { |
| 514 print_info_.reset(); | 515 print_info_.reset(); |
| 515 context_ = NULL; | 516 context_ = NULL; |
| 516 } | 517 } |
| 517 | 518 |
| 518 gfx::NativeDrawingContext PrintingContextMac::context() const { | 519 gfx::NativeDrawingContext PrintingContextMac::context() const { |
| 519 return context_; | 520 return context_; |
| 520 } | 521 } |
| 521 | 522 |
| 522 } // namespace printing | 523 } // namespace printing |
| OLD | NEW |