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_win.h" | 5 #include "printing/printing_context_win.h" |
6 | 6 |
7 #include <winspool.h> | 7 #include <winspool.h> |
8 | 8 |
9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "printing/print_job_constants.h" | |
16 #include "printing/print_settings_initializer_win.h" | 15 #include "printing/print_settings_initializer_win.h" |
17 #include "printing/printed_document.h" | 16 #include "printing/printed_document.h" |
18 #include "skia/ext/platform_device_win.h" | 17 #include "skia/ext/platform_device_win.h" |
19 | 18 |
20 using base::Time; | 19 using base::Time; |
21 | 20 |
22 namespace printing { | 21 namespace printing { |
23 | 22 |
24 class PrintingContextWin::CallbackHandler : public IPrintDialogCallback, | 23 class PrintingContextWin::CallbackHandler : public IPrintDialogCallback, |
25 public IObjectWithSite { | 24 public IObjectWithSite { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 return FAILED; | 207 return FAILED; |
209 } | 208 } |
210 return ParseDialogResult(dialog_options); | 209 return ParseDialogResult(dialog_options); |
211 } | 210 } |
212 | 211 |
213 PrintingContext::Result PrintingContextWin::UpdatePrintSettings( | 212 PrintingContext::Result PrintingContextWin::UpdatePrintSettings( |
214 const DictionaryValue& job_settings, const PageRanges& ranges) { | 213 const DictionaryValue& job_settings, const PageRanges& ranges) { |
215 DCHECK(!in_print_job_); | 214 DCHECK(!in_print_job_); |
216 | 215 |
217 bool landscape; | 216 bool landscape; |
218 if (!job_settings.GetBoolean(kSettingLandscape, &landscape)) | 217 if (!GetSettingsFromDict(job_settings, &landscape, NULL)) |
219 return OnError(); | 218 return OnError(); |
| 219 |
220 settings_.SetOrientation(landscape); | 220 settings_.SetOrientation(landscape); |
221 | 221 |
222 // TODO(kmadhusu): Update other print settings such as number of copies, | 222 // TODO(kmadhusu): Update other print settings such as number of copies, |
223 // collate, duplex printing, job title, etc., | 223 // collate, duplex printing, job title, etc., |
224 | 224 |
225 settings_.ranges = ranges; | 225 settings_.ranges = ranges; |
226 | 226 |
227 return OK; | 227 return OK; |
228 } | 228 } |
229 | 229 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 if (buf_size) { | 618 if (buf_size) { |
619 buffer->reset(new uint8[buf_size]); | 619 buffer->reset(new uint8[buf_size]); |
620 memset(buffer->get(), 0, buf_size); | 620 memset(buffer->get(), 0, buf_size); |
621 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { | 621 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { |
622 buffer->reset(); | 622 buffer->reset(); |
623 } | 623 } |
624 } | 624 } |
625 } | 625 } |
626 | 626 |
627 } // namespace printing | 627 } // namespace printing |
OLD | NEW |