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/values.h" | 7 #include "base/values.h" |
| 8 #include "printing/print_settings_initializer.h" |
8 | 9 |
9 namespace printing { | 10 namespace printing { |
10 | 11 |
11 PrintingContext::PrintingContext(const std::string& app_locale) | 12 PrintingContext::PrintingContext(const std::string& app_locale) |
12 : dialog_box_dismissed_(false), | 13 : dialog_box_dismissed_(false), |
13 in_print_job_(false), | 14 in_print_job_(false), |
14 abort_printing_(false), | 15 abort_printing_(false), |
15 app_locale_(app_locale) { | 16 app_locale_(app_locale) { |
16 } | 17 } |
17 | 18 |
18 PrintingContext::~PrintingContext() { | 19 PrintingContext::~PrintingContext() { |
19 } | 20 } |
20 | 21 |
21 void PrintingContext::ResetSettings() { | 22 void PrintingContext::ResetSettings() { |
22 ReleaseContext(); | 23 ReleaseContext(); |
23 | 24 |
24 settings_.Clear(); | 25 settings_.Clear(); |
25 | 26 |
26 in_print_job_ = false; | 27 in_print_job_ = false; |
27 dialog_box_dismissed_ = false; | 28 dialog_box_dismissed_ = false; |
28 abort_printing_ = false; | 29 abort_printing_ = false; |
29 } | 30 } |
30 | 31 |
31 PrintingContext::Result PrintingContext::OnError() { | 32 PrintingContext::Result PrintingContext::OnError() { |
32 ResetSettings(); | 33 ResetSettings(); |
33 return abort_printing_ ? CANCEL : FAILED; | 34 return abort_printing_ ? CANCEL : FAILED; |
34 } | 35 } |
35 | 36 |
| 37 PrintingContext::Result PrintingContext::UpdatePrintSettings( |
| 38 const base::DictionaryValue& job_settings, |
| 39 const PageRanges& ranges) { |
| 40 PrintingContext::Result result = UpdatePrinterSettings(job_settings, ranges); |
| 41 printing::PrintSettingsInitializer::InitHeaderFooterStrings(job_settings, |
| 42 &settings_); |
| 43 return result; |
| 44 } |
| 45 |
36 } // namespace printing | 46 } // namespace printing |
OLD | NEW |