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

Issue 7550022: Print Preview: Fixing behavior of event listeners. (Closed)

Created:
9 years, 4 months ago by dpapad
Modified:
9 years, 4 months ago
Reviewers:
Lei Zhang, kmadhusu
CC:
chromium-reviews, arv (Not doing code reviews)
Visibility:
Public.

Description

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 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=96634

Patch Set 1 #

Patch Set 2 : Making method private #

Patch Set 3 : Removing {add|remove}EventListeners functions from print_preview.js #

Patch Set 4 : Adding responseID to onDidPreviewPage #

Total comments: 2

Patch Set 5 : Adding comments, fixing style #

Patch Set 6 : Fixing mock_render_thread #

Patch Set 7 : Updating the print summary only once, immediately after the total page count is known. #

Patch Set 8 : Fixing color settings listener to not check for hasPendingPreviewRequest #

Patch Set 9 : Adding random initialRequestId to ignore obsolete request with id 0 when needed. #

Patch Set 10 : Adding function commetns #

Total comments: 6

Patch Set 11 : Adding comments to struct member #

Patch Set 12 : Adding new struct PrintHostMsg_DidGetPreviewPageCount_Params. #

Total comments: 30

Patch Set 13 : Addressing comments #

Total comments: 6

Patch Set 14 : Addressing kmadhusu's comments #

Total comments: 2

Patch Set 15 : Addressing thestig's comments #

Total comments: 4

Patch Set 16 : Addressing comments #

Patch Set 17 : Fixing failing browser_tests #

Patch Set 18 : Removing obsolete code #

Total comments: 1

Patch Set 19 : Rebasing, resolving conflicts #

Total comments: 2

Patch Set 20 : Rebasiing #

Patch Set 21 : Addressing comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+207 lines, -181 lines) Patch
M chrome/browser/printing/print_dialog_cloud.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/printing/print_preview_message_handler.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/printing/print_preview_message_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 4 chunks +11 lines, -11 lines 0 comments Download
M chrome/browser/resources/print_preview/color_settings.js View 1 2 3 4 5 6 7 1 chunk +2 lines, -4 lines 0 comments Download
M chrome/browser/resources/print_preview/layout_settings.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +22 lines, -13 lines 0 comments Download
M chrome/browser/resources/print_preview/page_settings.js View 1 3 chunks +12 lines, -29 lines 0 comments Download
M chrome/browser/resources/print_preview/print_preview.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 16 chunks +54 lines, -83 lines 0 comments Download
M chrome/browser/resources/print_preview/print_preview_utils.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +14 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/print_preview_ui.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +6 lines, -7 lines 0 comments Download
M chrome/browser/ui/webui/print_preview_ui.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +15 lines, -11 lines 0 comments Download
M chrome/common/print_messages.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +24 lines, -4 lines 0 comments Download
M chrome/renderer/mock_printer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/renderer/mock_printer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 chunks +7 lines, -1 line 0 comments Download
M chrome/renderer/mock_render_thread.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +5 lines, -4 lines 0 comments Download
M chrome/renderer/mock_render_thread.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +6 lines, -5 lines 0 comments Download
M chrome/renderer/print_web_view_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +14 lines, -6 lines 0 comments Download
M chrome/renderer/print_web_view_helper_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -0 lines 0 comments Download
M printing/print_job_constants.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M printing/print_job_constants.cc View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
dpapad
I have not removed the console.log statements from print_previw.js yet to make it easier for ...
9 years, 4 months ago (2011-08-03 18:38:45 UTC) #1
kmadhusu
I am yet to test your code. http://codereview.chromium.org/7550022/diff/5005/chrome/browser/printing/print_preview_message_handler.cc File chrome/browser/printing/print_preview_message_handler.cc (right): http://codereview.chromium.org/7550022/diff/5005/chrome/browser/printing/print_preview_message_handler.cc#newcode86 chrome/browser/printing/print_preview_message_handler.cc:86: bool is_modifiable, ...
9 years, 4 months ago (2011-08-03 18:39:45 UTC) #2
kmadhusu
dpapad: Can you rebase your CL?
9 years, 4 months ago (2011-08-05 16:01:12 UTC) #3
Lei Zhang
http://codereview.chromium.org/7550022/diff/7024/chrome/browser/resources/print_preview/print_preview.js File chrome/browser/resources/print_preview/print_preview.js (right): http://codereview.chromium.org/7550022/diff/7024/chrome/browser/resources/print_preview/print_preview.js#newcode86 chrome/browser/resources/print_preview/print_preview.js:86: initialPreviewRequestID = getRandomIntegerWithinRange(0, 32000); Is this so if we ...
9 years, 4 months ago (2011-08-06 00:52:57 UTC) #4
dpapad
http://codereview.chromium.org/7550022/diff/7024/chrome/browser/resources/print_preview/print_preview.js File chrome/browser/resources/print_preview/print_preview.js (right): http://codereview.chromium.org/7550022/diff/7024/chrome/browser/resources/print_preview/print_preview.js#newcode86 chrome/browser/resources/print_preview/print_preview.js:86: initialPreviewRequestID = getRandomIntegerWithinRange(0, 32000); On 2011/08/06 00:52:57, Lei Zhang ...
9 years, 4 months ago (2011-08-06 01:21:20 UTC) #5
dpapad
Addressed kmadhusu's comment. http://codereview.chromium.org/7550022/diff/5005/chrome/browser/printing/print_preview_message_handler.cc File chrome/browser/printing/print_preview_message_handler.cc (right): http://codereview.chromium.org/7550022/diff/5005/chrome/browser/printing/print_preview_message_handler.cc#newcode86 chrome/browser/printing/print_preview_message_handler.cc:86: bool is_modifiable, On 2011/08/03 18:39:45, kmadhusu ...
9 years, 4 months ago (2011-08-08 18:25:35 UTC) #6
kmadhusu
http://codereview.chromium.org/7550022/diff/20001/chrome/browser/printing/print_preview_message_handler.cc File chrome/browser/printing/print_preview_message_handler.cc (right): http://codereview.chromium.org/7550022/diff/20001/chrome/browser/printing/print_preview_message_handler.cc#newcode93 chrome/browser/printing/print_preview_message_handler.cc:93: print_preview_ui->OnDidGetPreviewPageCount( You can change PrintPreviewUI::OnDidGetPreviewPageCount() to take PrintHostMsg_DidGetPreviewPageCount_Params as ...
9 years, 4 months ago (2011-08-08 22:20:45 UTC) #7
dpapad
http://codereview.chromium.org/7550022/diff/20001/chrome/browser/printing/print_preview_message_handler.cc File chrome/browser/printing/print_preview_message_handler.cc (right): http://codereview.chromium.org/7550022/diff/20001/chrome/browser/printing/print_preview_message_handler.cc#newcode93 chrome/browser/printing/print_preview_message_handler.cc:93: print_preview_ui->OnDidGetPreviewPageCount( On 2011/08/08 22:20:45, kmadhusu wrote: > You can ...
9 years, 4 months ago (2011-08-08 23:41:43 UTC) #8
kmadhusu
http://codereview.chromium.org/7550022/diff/20001/chrome/browser/printing/print_preview_message_handler.cc File chrome/browser/printing/print_preview_message_handler.cc (right): http://codereview.chromium.org/7550022/diff/20001/chrome/browser/printing/print_preview_message_handler.cc#newcode93 chrome/browser/printing/print_preview_message_handler.cc:93: print_preview_ui->OnDidGetPreviewPageCount( On 2011/08/08 23:41:43, dpapad wrote: > On 2011/08/08 ...
9 years, 4 months ago (2011-08-09 22:30:40 UTC) #9
dpapad
http://codereview.chromium.org/7550022/diff/20001/chrome/browser/printing/print_preview_message_handler.cc File chrome/browser/printing/print_preview_message_handler.cc (right): http://codereview.chromium.org/7550022/diff/20001/chrome/browser/printing/print_preview_message_handler.cc#newcode93 chrome/browser/printing/print_preview_message_handler.cc:93: print_preview_ui->OnDidGetPreviewPageCount( On 2011/08/09 22:30:40, kmadhusu wrote: > On 2011/08/08 ...
9 years, 4 months ago (2011-08-10 00:17:10 UTC) #10
Lei Zhang
http://codereview.chromium.org/7550022/diff/20001/chrome/browser/resources/print_preview/print_preview.js File chrome/browser/resources/print_preview/print_preview.js (right): http://codereview.chromium.org/7550022/diff/20001/chrome/browser/resources/print_preview/print_preview.js#newcode429 chrome/browser/resources/print_preview/print_preview.js:429: settings.isFirstRequest = isFirstPreviewRequest(); On 2011/08/10 00:17:10, dpapad wrote: > ...
9 years, 4 months ago (2011-08-10 03:26:07 UTC) #11
dpapad
http://codereview.chromium.org/7550022/diff/20001/chrome/browser/resources/print_preview/print_preview.js File chrome/browser/resources/print_preview/print_preview.js (right): http://codereview.chromium.org/7550022/diff/20001/chrome/browser/resources/print_preview/print_preview.js#newcode429 chrome/browser/resources/print_preview/print_preview.js:429: settings.isFirstRequest = isFirstPreviewRequest(); Done. I restored getSettings() to have ...
9 years, 4 months ago (2011-08-10 15:47:09 UTC) #12
kmadhusu
I assume you are still investigating on how to initialize those parameters in mock_printer.cc. http://codereview.chromium.org/7550022/diff/33002/chrome/browser/resources/print_preview/print_preview.js ...
9 years, 4 months ago (2011-08-10 17:12:40 UTC) #13
dpapad
I am still looking on mock_printer.cc. http://codereview.chromium.org/7550022/diff/33002/chrome/browser/resources/print_preview/print_preview.js File chrome/browser/resources/print_preview/print_preview.js (right): http://codereview.chromium.org/7550022/diff/33002/chrome/browser/resources/print_preview/print_preview.js#newcode287 chrome/browser/resources/print_preview/print_preview.js:287: * Note: |lastPreviewRequestID| ...
9 years, 4 months ago (2011-08-10 17:21:39 UTC) #14
dpapad
MockPrinter is only used in print_web_view_helper_browsertest.cc PrintWebViewHelperTest.PrintWithIframe. I dont see how this is related to ...
9 years, 4 months ago (2011-08-10 17:39:35 UTC) #15
kmadhusu1
On Wed, Aug 10, 2011 at 10:39 AM, <dpapad@chromium.org> wrote: > MockPrinter is only used ...
9 years, 4 months ago (2011-08-10 18:03:03 UTC) #16
dpapad
Remove some checks that made sense when 1 pending request was allowed, but do not ...
9 years, 4 months ago (2011-08-11 21:21:37 UTC) #17
dpapad
Resolved conflicts with ToT.
9 years, 4 months ago (2011-08-11 22:52:34 UTC) #18
Lei Zhang
http://codereview.chromium.org/7550022/diff/39006/chrome/renderer/mock_printer.cc File chrome/renderer/mock_printer.cc (right): http://codereview.chromium.org/7550022/diff/39006/chrome/renderer/mock_printer.cc#newcode39 chrome/renderer/mock_printer.cc:39: is_first_request_(false), Why don't we just default to true and ...
9 years, 4 months ago (2011-08-12 02:11:34 UTC) #19
dpapad
http://codereview.chromium.org/7550022/diff/39006/chrome/renderer/mock_printer.cc File chrome/renderer/mock_printer.cc (right): http://codereview.chromium.org/7550022/diff/39006/chrome/renderer/mock_printer.cc#newcode39 chrome/renderer/mock_printer.cc:39: is_first_request_(false), On 2011/08/12 02:11:34, Lei Zhang wrote: > Why ...
9 years, 4 months ago (2011-08-12 19:01:28 UTC) #20
Lei Zhang
LGTM
9 years, 4 months ago (2011-08-12 19:41:47 UTC) #21
kmadhusu
9 years, 4 months ago (2011-08-12 19:53:19 UTC) #22
LGTM

Powered by Google App Engine
This is Rietveld 408576698