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

Issue 6775013: PrintPreview: While printing the preview data, set the initiator tab title as print job name. (Closed)

Created:
9 years, 9 months ago by kmadhusu
Modified:
9 years, 7 months ago
Reviewers:
Lei Zhang, stuartmorgan
CC:
chromium-reviews, pam+watch_chromium.org, Paweł Hajdan Jr., arv (Not doing code reviews), darin-cc_chromium.org, brettw-cc_chromium.org
Visibility:
Public.

Description

PrintPreview: While printing the preview data, set the initiator tab title as print job name. Some important changes in this CL: 1. Initiator job title is sent along with pages count information in 'PrintHostMsg_DidGetPrintedPagesCount' message. 2. Renamed 'PrintHostMsg_DidGetPrintedPagesCount' message to 'PrintHostMsg_DidGetBasicPrintJobInfo'. 3. Added a member variable |job_title_| in print_web_view_helper class to store the job title on the renderer process. 4. Added a member variable |job_title_| in print_view_manager to store the job title on the browser process. BUG=76123 TEST=Enable print preview on mac. Press Ctrl+p on a webpage to show the preview tab. Click the print button. Verify the print job name in printer job status dialog.

Patch Set 1 #

Patch Set 2 : Fix a style error #

Total comments: 2

Patch Set 3 : Updated the CL. #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+99 lines, -34 lines) Patch
M chrome/browser/printing/print_view_manager.h View 2 chunks +11 lines, -1 line 2 comments Download
M chrome/browser/printing/print_view_manager.cc View 1 2 3 chunks +14 lines, -7 lines 1 comment Download
M chrome/browser/resources/print_preview.js View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M chrome/common/print_messages.h View 1 chunk +6 lines, -4 lines 0 comments Download
M chrome/renderer/mock_render_thread.h View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M chrome/renderer/mock_render_thread.cc View 1 2 2 chunks +4 lines, -3 lines 0 comments Download
M chrome/renderer/print_web_view_helper.h View 1 chunk +6 lines, -0 lines 1 comment Download
M chrome/renderer/print_web_view_helper.cc View 1 2 4 chunks +7 lines, -2 lines 0 comments Download
M chrome/renderer/print_web_view_helper_linux.cc View 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/test/render_view_test.cc View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M printing/print_job_constants.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M printing/print_job_constants.cc View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M printing/printing_context_mac.h View 2 chunks +9 lines, -0 lines 1 comment Download
M printing/printing_context_mac.mm View 1 2 3 chunks +26 lines, -9 lines 3 comments Download

Messages

Total messages: 2 (0 generated)
kmadhusu
As per our discussion, this CL handles the task of assigning the initiator tab title ...
9 years, 9 months ago (2011-03-30 00:52:32 UTC) #1
stuartmorgan
9 years, 8 months ago (2011-03-30 22:59:17 UTC) #2
http://codereview.chromium.org/6775013/diff/3002/chrome/browser/printing/prin...
File chrome/browser/printing/print_view_manager.cc (right):

http://codereview.chromium.org/6775013/diff/3002/chrome/browser/printing/prin...
chrome/browser/printing/print_view_manager.cc:63: if (job_title_.empty()) {
This is where some of that discussion should go. I'd still avoid talking about
how it got this way though, just that not being set means to use the tab title,
or default if it's empty.

http://codereview.chromium.org/6775013/diff/3002/chrome/browser/printing/prin...
File chrome/browser/printing/print_view_manager.h (right):

http://codereview.chromium.org/6775013/diff/3002/chrome/browser/printing/prin...
chrome/browser/printing/print_view_manager.h:135: //
PrintHostMsg_DidGetBasicPrintJobInfo message handler.
Having this much detail about the implementation in the header is almost always
a bad idea; the chances of it getting out of sync over time are extremely high.

http://codereview.chromium.org/6775013/diff/3002/chrome/browser/printing/prin...
chrome/browser/printing/print_view_manager.h:138: // empty, use the default job
title.
I wouldn't even mention print preview vs "normal" (keep in mind that at some
point print preview will be the normal case, so that will become confusing).
Really, discussion of what happens when this is empty belongs in the code
reading it, since this is not public.

http://codereview.chromium.org/6775013/diff/3002/chrome/renderer/print_web_vi...
File chrome/renderer/print_web_view_helper.h (right):

http://codereview.chromium.org/6775013/diff/3002/chrome/renderer/print_web_vi...
chrome/renderer/print_web_view_helper.h:247: // the current tab title as print
job name.
Again, too much detail for a header.

http://codereview.chromium.org/6775013/diff/3002/printing/printing_context_mac.h
File printing/printing_context_mac.h (right):

http://codereview.chromium.org/6775013/diff/3002/printing/printing_context_ma...
printing/printing_context_mac.h:57: // Returns true if print job name is set
else returns false.
"else returns false" is redundant.

http://codereview.chromium.org/6775013/diff/3002/printing/printing_context_ma...
File printing/printing_context_mac.mm (right):

http://codereview.chromium.org/6775013/diff/3002/printing/printing_context_ma...
printing/printing_context_mac.mm:102: return OnError();
It's not clear to me that not having/setting a job name should be a fatal error.

http://codereview.chromium.org/6775013/diff/3002/printing/printing_context_ma...
printing/printing_context_mac.mm:139: NSString* print_job_name =
base::SysUTF16ToNSString(job_name);
Indentation is wrong here.

http://codereview.chromium.org/6775013/diff/3002/printing/printing_context_ma...
printing/printing_context_mac.mm:148: if (job_name) {
Change to
  if (!job_name)
    return;
so the core logic isn't indented.

Powered by Google App Engine
This is Rietveld 408576698