diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-12 19:26:40 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-12 19:26:40 +0000 |
commit | fc790462b4f248712bbc8c3734664dd6b05f80f2 (patch) | |
tree | 4ef04b11c6620ac2c95fb3f87e0d722e7bbcd1ee /printing/printing_context_mac.mm | |
parent | 1d0ee423b6a0bb307c7c19fe28c95d8761691e9a (diff) | |
download | chromium_src-fc790462b4f248712bbc8c3734664dd6b05f80f2.zip chromium_src-fc790462b4f248712bbc8c3734664dd6b05f80f2.tar.gz chromium_src-fc790462b4f248712bbc8c3734664dd6b05f80f2.tar.bz2 |
Set the job name for the print job on the Mac.
BUG=http://crbug.com/29188
TEST=as in bug
Review URL: http://codereview.chromium.org/1997016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47056 0039d316-1c4b-4281-b951-d872f2087c98
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; } |