| 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" |
| 11 #include "printing/print_job_constants.h" | 11 #include "printing/print_job_constants.h" |
| 12 #include "printing/print_settings_conversion.h" | 12 #include "printing/print_settings_conversion.h" |
| 13 #include "printing/units.h" | 13 #include "printing/units.h" |
| 14 | 14 |
| 15 namespace printing { | 15 namespace printing { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 const float kCloudPrintMarginInch = 0.25; | 18 const float kCloudPrintMarginInch = 0.25; |
| 19 } | 19 } |
| 20 | 20 |
| 21 PrintingContext::PrintingContext(Delegate* delegate) | 21 PrintingContext::PrintingContext(Delegate* delegate) |
| 22 : delegate_(delegate), | 22 : delegate_(delegate), |
| 23 dialog_box_dismissed_(false), | |
| 24 in_print_job_(false), | 23 in_print_job_(false), |
| 25 abort_printing_(false) { | 24 abort_printing_(false) { |
| 26 CHECK(delegate_); | 25 CHECK(delegate_); |
| 27 } | 26 } |
| 28 | 27 |
| 29 PrintingContext::~PrintingContext() { | 28 PrintingContext::~PrintingContext() { |
| 30 } | 29 } |
| 31 | 30 |
| 32 void PrintingContext::set_margin_type(MarginType type) { | 31 void PrintingContext::set_margin_type(MarginType type) { |
| 33 DCHECK(type != CUSTOM_MARGINS); | 32 DCHECK(type != CUSTOM_MARGINS); |
| 34 settings_.set_margin_type(type); | 33 settings_.set_margin_type(type); |
| 35 } | 34 } |
| 36 | 35 |
| 37 void PrintingContext::ResetSettings() { | 36 void PrintingContext::ResetSettings() { |
| 38 ReleaseContext(); | 37 ReleaseContext(); |
| 39 | 38 |
| 40 settings_.Clear(); | 39 settings_.Clear(); |
| 41 | 40 |
| 42 in_print_job_ = false; | 41 in_print_job_ = false; |
| 43 dialog_box_dismissed_ = false; | |
| 44 abort_printing_ = false; | 42 abort_printing_ = false; |
| 45 } | 43 } |
| 46 | 44 |
| 47 PrintingContext::Result PrintingContext::OnError() { | 45 PrintingContext::Result PrintingContext::OnError() { |
| 48 Result result = abort_printing_ ? CANCEL : FAILED; | 46 Result result = abort_printing_ ? CANCEL : FAILED; |
| 49 ResetSettings(); | 47 ResetSettings(); |
| 50 return result; | 48 return result; |
| 51 } | 49 } |
| 52 | 50 |
| 53 PrintingContext::Result PrintingContext::UsePdfSettings() { | 51 PrintingContext::Result PrintingContext::UsePdfSettings() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 113 } |
| 116 | 114 |
| 117 bool show_system_dialog = false; | 115 bool show_system_dialog = false; |
| 118 job_settings.GetBoolean(printing::kSettingShowSystemDialog, | 116 job_settings.GetBoolean(printing::kSettingShowSystemDialog, |
| 119 &show_system_dialog); | 117 &show_system_dialog); |
| 120 | 118 |
| 121 return UpdatePrinterSettings(open_in_external_preview, show_system_dialog); | 119 return UpdatePrinterSettings(open_in_external_preview, show_system_dialog); |
| 122 } | 120 } |
| 123 | 121 |
| 124 } // namespace printing | 122 } // namespace printing |
| OLD | NEW |