diff options
author | dgn <dgn@chromium.org> | 2014-12-15 13:11:23 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-15 21:11:50 +0000 |
commit | 4c172eea8b6649f1c1c620d1daa20ce733cee9e1 (patch) | |
tree | 9ac7df8f0058d80866716752ec2563d6fb0b3f79 /printing/printing_context_system_dialog_win.cc | |
parent | 7dac4befc4743666c0fcbb92d02ccd3c1c6a8389 (diff) | |
download | chromium_src-4c172eea8b6649f1c1c620d1daa20ce733cee9e1.zip chromium_src-4c172eea8b6649f1c1c620d1daa20ce733cee9e1.tar.gz chromium_src-4c172eea8b6649f1c1c620d1daa20ce733cee9e1.tar.bz2 |
Implement window.print() on Android
Essentially wires up the window.print() and the basic printing path
to Android framwork's PrintManager.
The changes affect the basic printing path using
PrintingMessageFilter::OnScriptedPrint. When calling window.print() on
Android, it would now be called twice.
The first time is directly after the JS call, OnScriptedPrint is called
with a parameter telling it that it's being called from JS. It will then
end up calling PrintJobWorker::GetSettings, forwarding that information.
PrintJobWorker then takes care of calling PrintingController through JNI,
joining the same code path used when printing from chrome's menu in android:
Android framework's PrintManager is invoked, and it manages the preview, using
the tab to generate the output as the user changes his/her preferences.
Why so many changes for just that: the window.print() call is blocked until the
end of the process by message pumping. It has to be disabled when printing is
finished. It is currently done by setting a callback in the current
PrintingContext, that will be called when printing is done. PrintingController
stores the reference to it, but here we have two queries at the same time, and
only the latest PrintingContext would be stored. I added a field to store
separately the one coming from the initial call, so
that it can be used when printing is done to stop the message pumping.
TL;DR: When window.print() is called, the basic printing path is used to forward
the query to PrintManager. The PrintManager then uses almost the same path to
actually print the document (as previously implemented to power the 'Print...'
entry in the menu). The changes are mostly to ensure that JS returns when
printing is completed and not before (or never).
BUG=437338
Review URL: https://codereview.chromium.org/740983002
Cr-Commit-Position: refs/heads/master@{#308416}
Diffstat (limited to 'printing/printing_context_system_dialog_win.cc')
-rw-r--r-- | printing/printing_context_system_dialog_win.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/printing/printing_context_system_dialog_win.cc b/printing/printing_context_system_dialog_win.cc index 4e1e8f1..19fc4271 100644 --- a/printing/printing_context_system_dialog_win.cc +++ b/printing/printing_context_system_dialog_win.cc @@ -21,6 +21,7 @@ PrintingContextSytemDialogWin::~PrintingContextSytemDialogWin() { void PrintingContextSytemDialogWin::AskUserForSettings( int max_pages, bool has_selection, + bool is_scripted, const PrintSettingsCallback& callback) { DCHECK(!in_print_job_); dialog_box_dismissed_ = false; |