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

Issue 7574002: Be able to print items that do window.print(); window.close() (airline tix e.g.) (Closed)

Created:
9 years, 4 months ago by Sheridan Rawlins
Modified:
9 years, 3 months ago
Reviewers:
Lei Zhang, kmadhusu
CC:
chromium-reviews, joi+watch-content_chromium.org, Avi (use Gerrit), brettw-cc_chromium.org, jam, Paweł Hajdan Jr., vandebo (ex-Chrome)
Visibility:
Public.

Description

Be able to print items that do window.print(); window.close() (airline tix e.g.) This is not commitable due to too many logs, and could stand some clean up. Please review locations of code and provide feedback of how it's done. Basic gist - hide; don't close initiator tabs, "own" them in the background printing manager, release them when they're no longer needed, deleting if owned. R=thestig@chromium.org BUG=87362 TEST=Create html file with window.print(); window.close(); and then print, cancel or close the print tab.

Patch Set 1 #

Patch Set 2 : Rebase. #

Total comments: 2

Patch Set 3 : Removed some logging, wrote a test for print(), close(). #

Patch Set 4 : Rollback pref logging, and logs in pp_tab_controller. #

Patch Set 5 : Rebase #

Patch Set 6 : Do register if there's no initiator tab, and don't register twice if there is. #

Patch Set 7 : Rebase + Release initiator when preview tab is closed. #

Total comments: 4

Patch Set 8 : Address Kausalya's comments. #

Total comments: 22

Patch Set 9 : Addressed comments. #

Total comments: 24

Patch Set 10 : Addressed Lei's comments. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+274 lines, -51 lines) Patch
M chrome/browser/printing/background_printing_manager.h View 1 2 3 4 5 6 7 8 9 2 chunks +36 lines, -6 lines 1 comment Download
M chrome/browser/printing/background_printing_manager.cc View 1 2 3 4 5 6 7 8 9 4 chunks +106 lines, -23 lines 1 comment Download
M chrome/browser/printing/print_preview_message_handler.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/printing/print_preview_tab_controller.cc View 1 2 3 4 5 6 7 8 9 5 chunks +28 lines, -9 lines 0 comments Download
M chrome/browser/ui/browser.cc View 1 2 3 4 5 6 7 8 9 2 chunks +14 lines, -0 lines 0 comments Download
M chrome/browser/ui/browser_list_unittest.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/javascript2webui.js View 1 2 3 4 5 6 7 8 9 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/print_preview_handler.cc View 1 2 3 4 5 6 7 8 9 2 chunks +10 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/web_ui_browsertest.h View 1 2 3 4 5 6 7 8 9 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/web_ui_browsertest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -4 lines 0 comments Download
M chrome/test/data/webui/print_preview.js View 1 2 3 4 5 6 7 8 9 1 chunk +43 lines, -0 lines 0 comments Download
A chrome/test/data/webui/print_preview_print_close_test.html View 1 2 1 chunk +12 lines, -0 lines 0 comments Download
M chrome/test/data/webui/test_api.js View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Sheridan Rawlins
9 years, 4 months ago (2011-08-04 22:03:01 UTC) #1
Lei Zhang
It's probably not too hard to add a test for this by calling Browser::CloseContents() from ...
9 years, 4 months ago (2011-08-11 09:47:16 UTC) #2
Sheridan Rawlins
Added a test too. http://codereview.chromium.org/7574002/diff/3001/chrome/browser/printing/background_printing_manager.h File chrome/browser/printing/background_printing_manager.h (right): http://codereview.chromium.org/7574002/diff/3001/chrome/browser/printing/background_printing_manager.h#newcode68 chrome/browser/printing/background_printing_manager.h:68: On 2011/08/11 09:47:16, Lei Zhang ...
9 years, 4 months ago (2011-08-16 06:11:54 UTC) #3
Sheridan Rawlins
Adding Kausalya as reviewer since I resolved some conflicts with her commits while rebasing.
9 years, 4 months ago (2011-08-18 23:27:38 UTC) #4
Sheridan Rawlins
Removing WIP. Please review.
9 years, 4 months ago (2011-08-18 23:33:38 UTC) #5
kmadhusu
http://codereview.chromium.org/7574002/diff/15001/chrome/browser/printing/background_printing_manager.cc File chrome/browser/printing/background_printing_manager.cc (right): http://codereview.chromium.org/7574002/diff/15001/chrome/browser/printing/background_printing_manager.cc#newcode102 chrome/browser/printing/background_printing_manager.cc:102: lines 99-113 and 128-140 are exactly the same. They ...
9 years, 4 months ago (2011-08-18 23:45:50 UTC) #6
Sheridan Rawlins
http://codereview.chromium.org/7574002/diff/15001/chrome/browser/printing/background_printing_manager.cc File chrome/browser/printing/background_printing_manager.cc (right): http://codereview.chromium.org/7574002/diff/15001/chrome/browser/printing/background_printing_manager.cc#newcode102 chrome/browser/printing/background_printing_manager.cc:102: On 2011/08/18 23:45:50, kmadhusu wrote: > lines 99-113 and ...
9 years, 4 months ago (2011-08-19 00:24:25 UTC) #7
kmadhusu
http://codereview.chromium.org/7574002/diff/18001/chrome/browser/printing/print_preview_tab_controller.cc File chrome/browser/printing/print_preview_tab_controller.cc (right): http://codereview.chromium.org/7574002/diff/18001/chrome/browser/printing/print_preview_tab_controller.cc#newcode165 chrome/browser/printing/print_preview_tab_controller.cc:165: print_preview_ui->OnInitiatorTabCrashed(); If the hidden initiator tab is crashed, you ...
9 years, 4 months ago (2011-08-19 17:13:04 UTC) #8
Lei Zhang
Crazy thought - what if we have JS code that looks like: window.print(); window.close(); alert('hi'); ...
9 years, 4 months ago (2011-08-19 19:00:23 UTC) #9
Sheridan Rawlins
Lei - as we discussed, that case can happen (audio, video, and javascript continue to ...
9 years, 4 months ago (2011-08-25 22:52:54 UTC) #10
Lei Zhang
http://codereview.chromium.org/7574002/diff/24001/chrome/browser/printing/background_printing_manager.cc File chrome/browser/printing/background_printing_manager.cc (right): http://codereview.chromium.org/7574002/diff/24001/chrome/browser/printing/background_printing_manager.cc#newcode33 chrome/browser/printing/background_printing_manager.cc:33: TabContentsWrapper* content) { This should be "contents" to be ...
9 years, 4 months ago (2011-08-26 10:01:54 UTC) #11
Sheridan Rawlins
http://codereview.chromium.org/7574002/diff/24001/chrome/browser/printing/background_printing_manager.cc File chrome/browser/printing/background_printing_manager.cc (right): http://codereview.chromium.org/7574002/diff/24001/chrome/browser/printing/background_printing_manager.cc#newcode33 chrome/browser/printing/background_printing_manager.cc:33: TabContentsWrapper* content) { On 2011/08/26 10:01:54, Lei Zhang wrote: ...
9 years, 3 months ago (2011-08-26 23:45:39 UTC) #12
Lei Zhang
9 years, 3 months ago (2011-08-27 01:05:06 UTC) #13
http://codereview.chromium.org/7574002/diff/29001/chrome/browser/printing/bac...
File chrome/browser/printing/background_printing_manager.cc (right):

http://codereview.chromium.org/7574002/diff/29001/chrome/browser/printing/bac...
chrome/browser/printing/background_printing_manager.cc:52:
!ReleaseInitiatorTabContents(initiator_tab_wrapper);
Why do you attempt to destroy the initiator tab here? Don't we already try to do
this when the print preview tab prints and goes away? (in
PrintPreviewTabController::OnTabContentsDestroyed)

http://codereview.chromium.org/7574002/diff/29001/chrome/browser/printing/bac...
File chrome/browser/printing/background_printing_manager.h (right):

http://codereview.chromium.org/7574002/diff/29001/chrome/browser/printing/bac...
chrome/browser/printing/background_printing_manager.h:72: TabContentsWrapper*
source_content,
I don't think you need to pass in |source_content|. You can derive it inside
OwnTabContents() by calling PrintPreviewTabController::GetPrintPreviewForTab().

Powered by Google App Engine
This is Rietveld 408576698