summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/mock_printer.cc
diff options
context:
space:
mode:
authordpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 22:11:33 +0000
committerdpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 22:11:33 +0000
commit718af82b9cda848d115dc731634ed9378640ace3 (patch)
tree698bc53413f96071231cad40b1f61ab41bb5fb00 /chrome/renderer/mock_printer.cc
parent5a363f218b70bc0f9f5db1ae2fb9e6b1fdcb1978 (diff)
downloadchromium_src-718af82b9cda848d115dc731634ed9378640ace3.zip
chromium_src-718af82b9cda848d115dc731634ed9378640ace3.tar.gz
chromium_src-718af82b9cda848d115dc731634ed9378640ace3.tar.bz2
Print Preview: Fixing behavior of event listeners.
Now that pending preview requests are being canceled when a new request is issued, the event listeners of the printing controls should not check for |hasPendingPreviewRequest| before issuing new requests, instead they should immediately request a new preview so that the previous one is canceled. Also all functions that are associated with a specific print request should get the requestID as a parameter, in order to ignore obsolete responses. I found out that when the print preview tab is reloaded, responses from requests before the reload are reaching the ui code. If reloading the preview tab repeatedly all these request have id=0 and are not being ignored as they should. Therefore I changed the id of the initial request to have a random variable. BUG=91556, 91769 TEST=See bug description Review URL: http://codereview.chromium.org/7550022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96634 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/mock_printer.cc')
-rw-r--r--chrome/renderer/mock_printer.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/chrome/renderer/mock_printer.cc b/chrome/renderer/mock_printer.cc
index 6fa65cc..ac2c779 100644
--- a/chrome/renderer/mock_printer.cc
+++ b/chrome/renderer/mock_printer.cc
@@ -35,7 +35,9 @@ MockPrinter::MockPrinter()
current_document_cookie_(0),
printer_status_(PRINTER_READY),
number_pages_(0),
- page_number_(0) {
+ page_number_(0),
+ is_first_request_(true),
+ preview_request_id_(0) {
page_size_.SetSize(static_cast<int>(8.5 * dpi_),
static_cast<int>(11.0 * dpi_));
printable_size_.SetSize(static_cast<int>((7.5 * dpi_)),
@@ -90,6 +92,8 @@ void MockPrinter::ScriptedPrint(int cookie,
settings->params.document_cookie = document_cookie_;
settings->params.page_size = page_size_;
settings->params.printable_size = printable_size_;
+ settings->params.is_first_request = is_first_request_;
+ settings->params.preview_request_id = preview_request_id_;
printer_status_ = PRINTER_PRINTING;
}
@@ -230,4 +234,6 @@ void MockPrinter::SetPrintParams(PrintMsg_Print_Params* params) {
params->printable_size = printable_size_;
params->margin_left = margin_left_;
params->margin_top = margin_top_;
+ params->is_first_request = is_first_request_;
+ params->preview_request_id = preview_request_id_;
}