| 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" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 PrintingContext::Result PrintingContextMac::UseDefaultSettings() { | 75 PrintingContext::Result PrintingContextMac::UseDefaultSettings() { |
| 76 DCHECK(!in_print_job_); | 76 DCHECK(!in_print_job_); |
| 77 | 77 |
| 78 ParsePrintInfo([NSPrintInfo sharedPrintInfo]); | 78 ParsePrintInfo([NSPrintInfo sharedPrintInfo]); |
| 79 | 79 |
| 80 return OK; | 80 return OK; |
| 81 } | 81 } |
| 82 | 82 |
| 83 PrintingContext::Result PrintingContextMac::UpdatePrintSettings( |
| 84 const std::string& job_settings, const PageRanges& ranges) { |
| 85 DCHECK(!in_print_job_); |
| 86 |
| 87 // TODO (kmadhusu): Update other print job settings such as number of copies, |
| 88 // collate, etc., |
| 89 |
| 90 // Update the print range information. |
| 91 settings_.ranges = ranges; |
| 92 |
| 93 return OK; |
| 94 } |
| 95 |
| 83 void PrintingContextMac::ParsePrintInfo(NSPrintInfo* print_info) { | 96 void PrintingContextMac::ParsePrintInfo(NSPrintInfo* print_info) { |
| 84 ResetSettings(); | 97 ResetSettings(); |
| 85 print_info_ = [print_info retain]; | 98 print_info_ = [print_info retain]; |
| 86 PageRanges page_ranges; | 99 PageRanges page_ranges; |
| 87 NSDictionary* print_info_dict = [print_info_ dictionary]; | 100 NSDictionary* print_info_dict = [print_info_ dictionary]; |
| 88 if (![[print_info_dict objectForKey:NSPrintAllPages] boolValue]) { | 101 if (![[print_info_dict objectForKey:NSPrintAllPages] boolValue]) { |
| 89 PageRange range; | 102 PageRange range; |
| 90 range.from = [[print_info_dict objectForKey:NSPrintFirstPage] intValue] - 1; | 103 range.from = [[print_info_dict objectForKey:NSPrintFirstPage] intValue] - 1; |
| 91 range.to = [[print_info_dict objectForKey:NSPrintLastPage] intValue] - 1; | 104 range.to = [[print_info_dict objectForKey:NSPrintLastPage] intValue] - 1; |
| 92 page_ranges.push_back(range); | 105 page_ranges.push_back(range); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 print_info_ = nil; | 220 print_info_ = nil; |
| 208 context_ = NULL; | 221 context_ = NULL; |
| 209 } | 222 } |
| 210 } | 223 } |
| 211 | 224 |
| 212 gfx::NativeDrawingContext PrintingContextMac::context() const { | 225 gfx::NativeDrawingContext PrintingContextMac::context() const { |
| 213 return context_; | 226 return context_; |
| 214 } | 227 } |
| 215 | 228 |
| 216 } // namespace printing | 229 } // namespace printing |
| OLD | NEW |