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

Side by Side Diff: printing/printing_context_mac.mm

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_cairo.cc ('k') | printing/printing_context_win.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) 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_mac.h" 5 #include "printing/printing_context_mac.h"
6 6
7 #import <ApplicationServices/ApplicationServices.h> 7 #import <ApplicationServices/ApplicationServices.h>
8 #import <AppKit/AppKit.h> 8 #import <AppKit/AppKit.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/sys_string_conversions.h" 12 #include "base/sys_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "printing/print_job_constants.h"
15 #include "printing/print_settings_initializer_mac.h" 14 #include "printing/print_settings_initializer_mac.h"
16 15
17 namespace printing { 16 namespace printing {
18 17
19 // static 18 // static
20 PrintingContext* PrintingContext::Create(const std::string& app_locale) { 19 PrintingContext* PrintingContext::Create(const std::string& app_locale) {
21 return static_cast<PrintingContext*>(new PrintingContextMac(app_locale)); 20 return static_cast<PrintingContext*>(new PrintingContextMac(app_locale));
22 } 21 }
23 22
24 PrintingContextMac::PrintingContextMac(const std::string& app_locale) 23 PrintingContextMac::PrintingContextMac(const std::string& app_locale)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 const DictionaryValue& job_settings, const PageRanges& ranges) { 85 const DictionaryValue& job_settings, const PageRanges& ranges) {
87 DCHECK(!in_print_job_); 86 DCHECK(!in_print_job_);
88 87
89 // TODO (kmadhusu): Update other print job settings such as number of copies, 88 // TODO (kmadhusu): Update other print job settings such as number of copies,
90 // collate, etc., 89 // collate, etc.,
91 90
92 ResetSettings(); 91 ResetSettings();
93 print_info_.reset([[NSPrintInfo sharedPrintInfo] copy]); 92 print_info_.reset([[NSPrintInfo sharedPrintInfo] copy]);
94 93
95 bool landscape; 94 bool landscape;
96 if (!job_settings.GetBoolean(kSettingLandscape, &landscape)) 95 std::string printer_name;
96 if (!GetSettingsFromDict(job_settings, &landscape, &printer_name))
97 return OnError(); 97 return OnError();
98
98 settings_.SetOrientation(landscape); 99 settings_.SetOrientation(landscape);
99 100
100 std::string printer_name;
101 if (!job_settings.GetString(kSettingPrinterName, &printer_name))
102 return OnError();
103
104 if (!SetPrinter(printer_name)) 101 if (!SetPrinter(printer_name))
105 return OnError(); 102 return OnError();
106 103
107 InitPrintSettingsFromPrintInfo(ranges); 104 InitPrintSettingsFromPrintInfo(ranges);
108 return OK; 105 return OK;
109 } 106 }
110 107
111 void PrintingContextMac::InitPrintSettingsFromPrintInfo( 108 void PrintingContextMac::InitPrintSettingsFromPrintInfo(
112 const PageRanges& ranges) { 109 const PageRanges& ranges) {
113 PMPrintSession print_session = 110 PMPrintSession print_session =
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 void PrintingContextMac::ReleaseContext() { 248 void PrintingContextMac::ReleaseContext() {
252 print_info_.reset(); 249 print_info_.reset();
253 context_ = NULL; 250 context_ = NULL;
254 } 251 }
255 252
256 gfx::NativeDrawingContext PrintingContextMac::context() const { 253 gfx::NativeDrawingContext PrintingContextMac::context() const {
257 return context_; 254 return context_;
258 } 255 }
259 256
260 } // namespace printing 257 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing_context_cairo.cc ('k') | printing/printing_context_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698