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" | |
9 | 8 |
10 namespace printing { | 9 namespace printing { |
11 | 10 |
12 PrintingContext::PrintingContext(const std::string& app_locale) | 11 PrintingContext::PrintingContext(const std::string& app_locale) |
13 : dialog_box_dismissed_(false), | 12 : dialog_box_dismissed_(false), |
14 in_print_job_(false), | 13 in_print_job_(false), |
15 abort_printing_(false), | 14 abort_printing_(false), |
16 app_locale_(app_locale) { | 15 app_locale_(app_locale) { |
17 } | 16 } |
18 | 17 |
19 PrintingContext::~PrintingContext() { | 18 PrintingContext::~PrintingContext() { |
20 } | 19 } |
21 | 20 |
22 void PrintingContext::ResetSettings() { | 21 void PrintingContext::ResetSettings() { |
23 ReleaseContext(); | 22 ReleaseContext(); |
24 | 23 |
25 settings_.Clear(); | 24 settings_.Clear(); |
26 | 25 |
27 in_print_job_ = false; | 26 in_print_job_ = false; |
28 dialog_box_dismissed_ = false; | 27 dialog_box_dismissed_ = false; |
29 abort_printing_ = false; | 28 abort_printing_ = false; |
30 } | 29 } |
31 | 30 |
32 PrintingContext::Result PrintingContext::OnError() { | 31 PrintingContext::Result PrintingContext::OnError() { |
33 ResetSettings(); | 32 ResetSettings(); |
34 return abort_printing_ ? CANCEL : FAILED; | 33 return abort_printing_ ? CANCEL : FAILED; |
35 } | 34 } |
36 | 35 |
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 | |
46 } // namespace printing | 36 } // namespace printing |
OLD | NEW |