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

Unified Diff: printing/printing_context_mac.mm

Issue 1997016: Set the job name for the print job on the Mac.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: printing/printing_context_mac.mm
===================================================================
--- printing/printing_context_mac.mm (revision 47035)
+++ printing/printing_context_mac.mm (working copy)
@@ -29,7 +29,7 @@
PrintingContext::Result PrintingContext::AskUserForSettings(
- gfx::NativeWindow window, int max_pages, bool has_selection) {
+ gfx::NativeView parent_view, int max_pages, bool has_selection) {
DCHECK([NSThread isMainThread]);
// We deliberately don't feed max_pages into the dialog, because setting
@@ -40,6 +40,7 @@
// adding a new custom view to the panel on 10.5; 10.6 has
// NSPrintPanelShowsPrintSelection).
NSPrintPanel* panel = [NSPrintPanel printPanel];
+ NSPrintInfo* printInfo = [NSPrintInfo sharedPrintInfo];
NSPrintPanelOptions options = [panel options];
options |= NSPrintPanelShowsPaperSize;
@@ -47,10 +48,15 @@
options |= NSPrintPanelShowsScaling;
[panel setOptions:options];
+ NSString* job_title = [[parent_view window] title];
+ PMPrintSettings printSettings = (PMPrintSettings)[printInfo PMPrintSettings];
+ PMPrintSettingsSetJobName(printSettings, (CFStringRef)job_title);
stuartmorgan 2010/05/12 18:54:43 Do you need to nil-check job_title before calling
+ [printInfo updateFromPMPrintSettings];
+
// TODO(stuartmorgan): We really want a tab sheet here, not a modal window.
// Will require restructuring the PrintingContext API to use a callback.
NSInteger selection =
- [panel runModalWithPrintInfo:[NSPrintInfo sharedPrintInfo]];
+ [panel runModalWithPrintInfo:printInfo];
if (selection != NSOKButton) {
return CANCEL;
}

Powered by Google App Engine
This is Rietveld 408576698