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.h" | 5 #include "printing/printing_context.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "printing/page_setup.h" | 9 #include "printing/page_setup.h" |
10 #include "printing/page_size_margins.h" | 10 #include "printing/page_size_margins.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 ReleaseContext(); | 37 ReleaseContext(); |
38 | 38 |
39 settings_.Clear(); | 39 settings_.Clear(); |
40 | 40 |
41 in_print_job_ = false; | 41 in_print_job_ = false; |
42 dialog_box_dismissed_ = false; | 42 dialog_box_dismissed_ = false; |
43 abort_printing_ = false; | 43 abort_printing_ = false; |
44 } | 44 } |
45 | 45 |
46 PrintingContext::Result PrintingContext::OnError() { | 46 PrintingContext::Result PrintingContext::OnError() { |
| 47 Result result = abort_printing_ ? CANCEL : FAILED; |
47 ResetSettings(); | 48 ResetSettings(); |
48 return abort_printing_ ? CANCEL : FAILED; | 49 return result; |
49 } | 50 } |
50 | 51 |
51 PrintingContext::Result PrintingContext::UsePdfSettings() { | 52 PrintingContext::Result PrintingContext::UsePdfSettings() { |
52 scoped_ptr<base::DictionaryValue> pdf_settings(new base::DictionaryValue); | 53 scoped_ptr<base::DictionaryValue> pdf_settings(new base::DictionaryValue); |
53 pdf_settings->SetBoolean(kSettingHeaderFooterEnabled, false); | 54 pdf_settings->SetBoolean(kSettingHeaderFooterEnabled, false); |
54 pdf_settings->SetBoolean(kSettingShouldPrintBackgrounds, false); | 55 pdf_settings->SetBoolean(kSettingShouldPrintBackgrounds, false); |
55 pdf_settings->SetBoolean(kSettingShouldPrintSelectionOnly, false); | 56 pdf_settings->SetBoolean(kSettingShouldPrintSelectionOnly, false); |
56 pdf_settings->SetInteger(kSettingMarginsType, printing::NO_MARGINS); | 57 pdf_settings->SetInteger(kSettingMarginsType, printing::NO_MARGINS); |
57 pdf_settings->SetBoolean(kSettingCollate, true); | 58 pdf_settings->SetBoolean(kSettingCollate, true); |
58 pdf_settings->SetInteger(kSettingCopies, 1); | 59 pdf_settings->SetInteger(kSettingCopies, 1); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 kCloudPrintMarginInch * settings_.device_units_per_inch()); | 110 kCloudPrintMarginInch * settings_.device_units_per_inch()); |
110 } | 111 } |
111 settings_.SetPrinterPrintableArea(paper_size, paper_rect, true); | 112 settings_.SetPrinterPrintableArea(paper_size, paper_rect, true); |
112 return OK; | 113 return OK; |
113 } | 114 } |
114 | 115 |
115 return UpdatePrinterSettings(open_in_external_preview); | 116 return UpdatePrinterSettings(open_in_external_preview); |
116 } | 117 } |
117 | 118 |
118 } // namespace printing | 119 } // namespace printing |
OLD | NEW |