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

Issue 2566153007: Implement PrintBrowser functionality. (Closed)

Created:
4 years ago by gozzard
Modified:
3 years, 10 months ago
CC:
arv+watch_chromium.org, chromium-reviews, nainar, rbpotter, Lei Zhang
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement PrintBrowser functionality. The --enable-print-browser flag triggers logic to display every page in print preview mode. BUG=667547 Design Doc: https://docs.google.com/a/google.com/document/d/1pRu5Lh4SGelhbsqfrLnLQov0o82nVmoWbucz1LYZtu8/edit?usp=sharing CQ-DEPEND=CL:2556023002 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Patch Set 1 #

Patch Set 2 : Implement PrintBrowser functionality. #

Patch Set 3 : Implement PrintBrowser functionality. #

Patch Set 4 : Fix git weirdness #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+89 lines, -7 lines) Patch
M chrome/browser/printing/print_preview_dialog_controller.cc View 4 chunks +44 lines, -6 lines 1 comment Download
M chrome/browser/printing/print_preview_message_handler.h View 2 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/printing/print_preview_message_handler.cc View 3 chunks +20 lines, -0 lines 3 comments Download
M chrome/browser/resources/print_preview/print_preview.js View 1 chunk +6 lines, -0 lines 1 comment Download
M chrome/browser/ui/webui/print_preview/print_preview_ui.cc View 3 chunks +12 lines, -0 lines 0 comments Download
M chrome/renderer/printing/chrome_print_web_view_helper_delegate.cc View 1 chunk +0 lines, -1 line 1 comment Download

Depends on Patchset:

Messages

Total messages: 35 (25 generated)
gozzard
PTAL
4 years ago (2016-12-14 23:09:32 UTC) #4
Vitaly Buka (NO REVIEWS)
On 2016/12/14 23:09:32, gozzard wrote: > PTAL Probably you want CQ-DEPEND=CL:2556023002 instead of "This issue ...
4 years ago (2016-12-15 00:05:00 UTC) #5
Vitaly Buka (NO REVIEWS)
On 2016/12/15 00:05:00, Vitaly Buka wrote: > On 2016/12/14 23:09:32, gozzard wrote: > > PTAL ...
4 years ago (2016-12-15 00:06:18 UTC) #6
Vitaly Buka (NO REVIEWS)
If this is for tests, could we have a trivial test, probably browser test, which ...
4 years ago (2016-12-15 00:18:16 UTC) #7
gozzard
On 2016/12/15 at 00:18:16, vitalybuka wrote: > If this is for tests, could we have ...
4 years ago (2016-12-15 02:59:53 UTC) #8
Vitaly Buka (NO REVIEWS)
+rbpotter +skau Folks, please review this as well. This probably affect your work. Maybe you ...
4 years ago (2016-12-16 00:16:35 UTC) #31
skau
PrintPreview does quite a few things IRT retrieving printer properties. Is it possible to extract ...
4 years ago (2016-12-16 18:32:50 UTC) #32
rbpotter
https://codereview.chromium.org/2566153007/diff/60001/chrome/browser/printing/print_preview_dialog_controller.cc File chrome/browser/printing/print_preview_dialog_controller.cc (right): https://codereview.chromium.org/2566153007/diff/60001/chrome/browser/printing/print_preview_dialog_controller.cc#newcode406 chrome/browser/printing/print_preview_dialog_controller.cc:406: CoreTabHelper::FromWebContents(initiator)->delegate()->SwapTabContents( I think you need to ensure the initiator ...
4 years ago (2016-12-16 20:05:29 UTC) #33
gozzard
On 2016/12/16 at 18:32:50, skau wrote: > PrintPreview does quite a few things IRT retrieving ...
4 years ago (2016-12-19 01:07:31 UTC) #34
gozzard
4 years ago (2016-12-19 01:53:50 UTC) #35
On 2016/12/16 at 20:05:29, rbpotter wrote:
>
https://codereview.chromium.org/2566153007/diff/60001/chrome/browser/printing...
> File chrome/browser/printing/print_preview_dialog_controller.cc (right):
> 
>
https://codereview.chromium.org/2566153007/diff/60001/chrome/browser/printing...
> chrome/browser/printing/print_preview_dialog_controller.cc:406:
CoreTabHelper::FromWebContents(initiator)->delegate()->SwapTabContents(
> I think you need to ensure the initiator web contents are destroyed at an
appropriate point after calling this.

I was originally told this was out of scope as, for the intended use case, we
are just going to be closing the browser entirely anyway. Having said that I am
currently investigating how to reliably clean up the initiator. They have to
remain long enough to be used as a source to render from, so I will probably
have to delete them in reaction to OnNavEntryCommitted and
OnWebContentsDestroyed. TL;DR: Working on it.

>
https://codereview.chromium.org/2566153007/diff/60001/chrome/browser/printing...
> File chrome/browser/printing/print_preview_message_handler.cc (right):
> 
>
https://codereview.chromium.org/2566153007/diff/60001/chrome/browser/printing...
> chrome/browser/printing/print_preview_message_handler.cc:260:
printing::StartPrint(initiator, false /* print_preview_disabled */,
> On 2016/12/16 18:32:50, skau wrote:
> > You should enforce that Print Preview is enabled for Print Browser to be
> > enabled.  Otherwise, this could send a print job every time you load a page.

> 
> In this case it may be implicitly enforced; I don't think
PrintPreviewMessageHandler gets created if Print Preview isn't enabled; it's
created in tab_helper.cc only if the ENABLE_PRINT_PREVIEW build flag is on.

This is correct, and the ENABLE_PRINT_BROWSER flag is explicitly dependent on
the ENABLE_PRINT_PREVIEW build flag.

> 
>
https://codereview.chromium.org/2566153007/diff/60001/chrome/browser/resource...
> File chrome/browser/resources/print_preview/print_preview.js (right):
> 
>
https://codereview.chromium.org/2566153007/diff/60001/chrome/browser/resource...
> chrome/browser/resources/print_preview/print_preview.js:25:
$('navbar-container').style.display = 'none';
> Not sure that this stops all the events from the navbar. If you open print
preview, apply this styling, then hit "enter" you can still print the page,
which seems unexpected.

Good catch. I will try to find a more robust way to do this.

Powered by Google App Engine
This is Rietveld 408576698