diff options
Diffstat (limited to 'printing/printing_context_mac.mm')
-rw-r--r-- | printing/printing_context_mac.mm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm index c4f09b0..ad09360 100644 --- a/printing/printing_context_mac.mm +++ b/printing/printing_context_mac.mm @@ -29,7 +29,7 @@ PrintingContext::~PrintingContext() { 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 @@ PrintingContext::Result PrintingContext::AskUserForSettings( // 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,19 @@ PrintingContext::Result PrintingContext::AskUserForSettings( options |= NSPrintPanelShowsScaling; [panel setOptions:options]; + if (parent_view) { + NSString* job_title = [[parent_view window] title]; + if (job_title) { + PMPrintSettings printSettings = + (PMPrintSettings)[printInfo PMPrintSettings]; + PMPrintSettingsSetJobName(printSettings, (CFStringRef)job_title); + [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]]; + NSInteger selection = [panel runModalWithPrintInfo:printInfo]; if (selection != NSOKButton) { return CANCEL; } |