diff options
author | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 22:11:33 +0000 |
---|---|---|
committer | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-12 22:11:33 +0000 |
commit | 718af82b9cda848d115dc731634ed9378640ace3 (patch) | |
tree | 698bc53413f96071231cad40b1f61ab41bb5fb00 /chrome/renderer/mock_render_thread.cc | |
parent | 5a363f218b70bc0f9f5db1ae2fb9e6b1fdcb1978 (diff) | |
download | chromium_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_render_thread.cc')
-rw-r--r-- | chrome/renderer/mock_render_thread.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc index aac7156..b443559 100644 --- a/chrome/renderer/mock_render_thread.cc +++ b/chrome/renderer/mock_render_thread.cc @@ -211,10 +211,9 @@ void MockRenderThread::OnDidPrintPage( printer_->PrintPage(params); } -void MockRenderThread::OnDidGetPreviewPageCount(int document_cookie, - int number_pages, - bool is_modifiable) { - print_preview_pages_remaining_ = number_pages; +void MockRenderThread::OnDidGetPreviewPageCount( + const PrintHostMsg_DidGetPreviewPageCount_Params& params) { + print_preview_pages_remaining_ = params.page_count; } void MockRenderThread::OnDidPreviewPage( @@ -235,9 +234,11 @@ void MockRenderThread::OnUpdatePrintSettings( !job_settings.GetBoolean(printing::kSettingCollate, NULL) || !job_settings.GetBoolean(printing::kSettingColor, NULL) || !job_settings.GetBoolean(printing::kSettingPrintToPDF, NULL) || + !job_settings.GetBoolean(printing::kIsFirstRequest, NULL) || !job_settings.GetString(printing::kSettingDeviceName, &dummy_string) || !job_settings.GetInteger(printing::kSettingDuplexMode, NULL) || - !job_settings.GetInteger(printing::kSettingCopies, NULL)) { + !job_settings.GetInteger(printing::kSettingCopies, NULL) || + !job_settings.GetInteger(printing::kPreviewRequestID, NULL)) { return; } |