Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(654)

Side by Side Diff: printing/printing_context.cc

Issue 6758014: PrintPreview: Added a helper function to get print job settings from dictionary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac build error. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « printing/printing_context.h ('k') | printing/printing_context_cairo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 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"
8 #include "printing/print_job_constants.h"
9
7 namespace printing { 10 namespace printing {
8 11
9 PrintingContext::PrintingContext(const std::string& app_locale) 12 PrintingContext::PrintingContext(const std::string& app_locale)
10 : dialog_box_dismissed_(false), 13 : dialog_box_dismissed_(false),
11 in_print_job_(false), 14 in_print_job_(false),
12 abort_printing_(false), 15 abort_printing_(false),
13 app_locale_(app_locale) { 16 app_locale_(app_locale) {
14 } 17 }
15 18
16 PrintingContext::~PrintingContext() { 19 PrintingContext::~PrintingContext() {
17 } 20 }
18 21
19 void PrintingContext::ResetSettings() { 22 void PrintingContext::ResetSettings() {
20 ReleaseContext(); 23 ReleaseContext();
21 24
22 settings_.Clear(); 25 settings_.Clear();
23 26
24 in_print_job_ = false; 27 in_print_job_ = false;
25 dialog_box_dismissed_ = false; 28 dialog_box_dismissed_ = false;
26 abort_printing_ = false; 29 abort_printing_ = false;
27 } 30 }
28 31
32 bool PrintingContext::GetSettingsFromDict(const DictionaryValue& settings,
33 bool* landscape,
34 std::string* printerName) {
35 bool ret = true;
36 if (landscape)
37 ret &= settings.GetBoolean(kSettingLandscape, landscape);
38
39 if (printerName)
40 ret &= settings.GetString(kSettingPrinterName, printerName);
41
42 return ret;
43 }
44
29 PrintingContext::Result PrintingContext::OnError() { 45 PrintingContext::Result PrintingContext::OnError() {
30 ResetSettings(); 46 ResetSettings();
31 return abort_printing_ ? CANCEL : FAILED; 47 return abort_printing_ ? CANCEL : FAILED;
32 } 48 }
33 49
34 } // namespace printing 50 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing_context.h ('k') | printing/printing_context_cairo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698