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; |
} |