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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 DCHECK(!in_print_job_); | 104 DCHECK(!in_print_job_); |
105 | 105 |
106 // NOTE: Reset |print_info_| with a copy of |sharedPrintInfo| so as to start | 106 // NOTE: Reset |print_info_| with a copy of |sharedPrintInfo| so as to start |
107 // with a clean slate. | 107 // with a clean slate. |
108 print_info_.reset([[NSPrintInfo sharedPrintInfo] copy]); | 108 print_info_.reset([[NSPrintInfo sharedPrintInfo] copy]); |
109 | 109 |
110 bool collate; | 110 bool collate; |
111 int color; | 111 int color; |
112 bool landscape; | 112 bool landscape; |
113 bool print_to_pdf; | 113 bool print_to_pdf; |
| 114 bool is_cloud_dialog; |
114 int copies; | 115 int copies; |
115 int duplex_mode; | 116 int duplex_mode; |
116 std::string device_name; | 117 std::string device_name; |
117 | 118 |
118 if (!job_settings.GetBoolean(kSettingLandscape, &landscape) || | 119 if (!job_settings.GetBoolean(kSettingLandscape, &landscape) || |
119 !job_settings.GetBoolean(kSettingCollate, &collate) || | 120 !job_settings.GetBoolean(kSettingCollate, &collate) || |
120 !job_settings.GetInteger(kSettingColor, &color) || | 121 !job_settings.GetInteger(kSettingColor, &color) || |
121 !job_settings.GetBoolean(kSettingPrintToPDF, &print_to_pdf) || | 122 !job_settings.GetBoolean(kSettingPrintToPDF, &print_to_pdf) || |
122 !job_settings.GetInteger(kSettingDuplexMode, &duplex_mode) || | 123 !job_settings.GetInteger(kSettingDuplexMode, &duplex_mode) || |
123 !job_settings.GetInteger(kSettingCopies, &copies) || | 124 !job_settings.GetInteger(kSettingCopies, &copies) || |
124 !job_settings.GetString(kSettingDeviceName, &device_name)) { | 125 !job_settings.GetString(kSettingDeviceName, &device_name) || |
| 126 !job_settings.GetBoolean(kSettingCloudPrintDialog, &is_cloud_dialog)) { |
125 return OnError(); | 127 return OnError(); |
126 } | 128 } |
127 | 129 |
128 bool print_to_cloud = job_settings.HasKey(printing::kSettingCloudPrintId); | 130 bool print_to_cloud = job_settings.HasKey(printing::kSettingCloudPrintId); |
129 | 131 |
130 if (!print_to_pdf && !print_to_cloud) { | 132 if (!print_to_pdf && !print_to_cloud && !is_cloud_dialog) { |
131 if (!SetPrinter(device_name)) | 133 if (!SetPrinter(device_name)) |
132 return OnError(); | 134 return OnError(); |
133 | 135 |
134 if (!SetCopiesInPrintSettings(copies)) | 136 if (!SetCopiesInPrintSettings(copies)) |
135 return OnError(); | 137 return OnError(); |
136 | 138 |
137 if (!SetCollateInPrintSettings(collate)) | 139 if (!SetCollateInPrintSettings(collate)) |
138 return OnError(); | 140 return OnError(); |
139 | 141 |
140 if (!SetDuplexModeInPrintSettings( | 142 if (!SetDuplexModeInPrintSettings( |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 void PrintingContextMac::ReleaseContext() { | 379 void PrintingContextMac::ReleaseContext() { |
378 print_info_.reset(); | 380 print_info_.reset(); |
379 context_ = NULL; | 381 context_ = NULL; |
380 } | 382 } |
381 | 383 |
382 gfx::NativeDrawingContext PrintingContextMac::context() const { | 384 gfx::NativeDrawingContext PrintingContextMac::context() const { |
383 return context_; | 385 return context_; |
384 } | 386 } |
385 | 387 |
386 } // namespace printing | 388 } // namespace printing |
OLD | NEW |