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

Issue 8351048: Print Preview: Making margin selection sticky (part 2/2) (Closed)

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

Description

Print Preview: Making margin selection sticky (part 2/2) This CL makes "Custom" margins sticky across different preview sessions but also within the same preview session. Here is a summary of all changes. - Within same preview session: So far selecting "Custom" was picking up from whatever the previous selected option was. Now, "Custom" remembers the specified margins. To test this select "Custom", do some dragging, then change to another option and back to "Custom". - Across preview sessions: Select "Custom", do some dragging, then print. Open print preview again, the last used custom margins are remembered. - There was a bunch of messages sent from JS to get various info/settings (initiator tab title, measurement system and number format, last used margin settings, default printer). I created a single message "getInitialSettings" to get all at once (they are needed before the 1st preview is is requested). BUG=102446 TEST=See bug description. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=110035

Patch Set 1 #

Patch Set 2 : Removing spam #

Patch Set 3 : Respecting remembered margins. #

Patch Set 4 : Resolving conflicts, displaying UI when custom was the last selection #

Patch Set 5 : Cleanups #

Total comments: 18

Patch Set 6 : Addressing coments #

Total comments: 4

Patch Set 7 : Addressed comments #

Total comments: 10

Patch Set 8 : Addressing some of the comments #

Total comments: 1

Patch Set 9 : Fixing several issues, consolidating calls to C++ before first preview to one. #

Patch Set 10 : Handling source PDF case, fixing marginsUI flashing. #

Total comments: 14

Patch Set 11 : Adding default printer info in getInitialSettings #

Patch Set 12 : Addressing comments #

Patch Set 13 : Addressing comments #

Patch Set 14 : Updating PrintPreviewWebUITests #

Total comments: 10

Patch Set 15 : Addressed comments #

Patch Set 16 : Fixing a bug regarding setting the initial printer resetting the margins. #

Total comments: 2

Patch Set 17 : Adding test for verifying that sticky settings are stored. #

Total comments: 10

Patch Set 18 : Addressing comments #

Patch Set 19 : Adding some more tests #

Total comments: 5

Patch Set 20 : Addressed vandebo's comments #

Total comments: 4

Patch Set 21 : Fixing potential memory leak in the test code. #

Total comments: 1

Patch Set 22 : Addressing nits #

Total comments: 2

Patch Set 23 : Nits #

Patch Set 24 : Resolving conflicts #

Patch Set 25 : Nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+582 lines, -170 lines) Patch
M chrome/browser/printing/print_preview_message_handler.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/printing/print_preview_message_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +9 lines, -1 line 0 comments Download
M chrome/browser/printing/print_system_task_proxy.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/printing/print_system_task_proxy.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +9 lines, -12 lines 0 comments Download
M chrome/browser/resources/print_preview/margin_settings.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 chunks +89 lines, -41 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 6 chunks +30 lines, -19 lines 0 comments Download
M chrome/browser/ui/webui/print_preview_handler.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 5 chunks +25 lines, -13 lines 0 comments Download
M chrome/browser/ui/webui/print_preview_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 9 chunks +84 lines, -54 lines 0 comments Download
A chrome/browser/ui/webui/print_preview_handler_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +261 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 20 21 22 3 chunks +16 lines, -0 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 2 chunks +5 lines, -3 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/print_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -1 line 0 comments Download
M chrome/renderer/print_web_view_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M chrome/test/data/webui/print_preview.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 2 chunks +2 lines, -2 lines 0 comments Download
M printing/page_size_margins.h View 1 2 3 4 5 6 2 chunks +7 lines, -1 line 0 comments Download
A printing/page_size_margins.cc View 1 2 3 4 5 6 1 chunk +29 lines, -0 lines 0 comments Download
M printing/printing.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +1 line, -0 lines 0 comments Download
M printing/printing_context.cc View 1 2 3 4 5 6 2 chunks +8 lines, -19 lines 0 comments Download

Messages

Total messages: 38 (0 generated)
dpapad
I am not doing any validation in the backend as of now. After looking at ...
9 years, 1 month ago (2011-11-02 18:13:20 UTC) #1
kmadhusu
http://codereview.chromium.org/8351048/diff/4012/chrome/browser/resources/print_preview/margin_settings.js File chrome/browser/resources/print_preview/margin_settings.js (right): http://codereview.chromium.org/8351048/diff/4012/chrome/browser/resources/print_preview/margin_settings.js#newcode134 chrome/browser/resources/print_preview/margin_settings.js:134: this.optionToRestore_ = null; Since this is a number, can ...
9 years, 1 month ago (2011-11-02 20:40:05 UTC) #2
dpapad
http://codereview.chromium.org/8351048/diff/4012/chrome/browser/resources/print_preview/margin_settings.js File chrome/browser/resources/print_preview/margin_settings.js (right): http://codereview.chromium.org/8351048/diff/4012/chrome/browser/resources/print_preview/margin_settings.js#newcode134 chrome/browser/resources/print_preview/margin_settings.js:134: this.optionToRestore_ = null; On 2011/11/02 20:40:05, kmadhusu wrote: > ...
9 years, 1 month ago (2011-11-02 21:33:57 UTC) #3
vandebo (ex-Chrome)
http://codereview.chromium.org/8351048/diff/4012/printing/page_size_margins.h File printing/page_size_margins.h (right): http://codereview.chromium.org/8351048/diff/4012/printing/page_size_margins.h#newcode25 printing/page_size_margins.h:25: void extractPageSizeMargins(const base::DictionaryValue& settings, getCustomMarginsFromJobSettings? http://codereview.chromium.org/8351048/diff/32/chrome/browser/resources/print_preview/margin_settings.js File chrome/browser/resources/print_preview/margin_settings.js (right): ...
9 years, 1 month ago (2011-11-02 22:36:54 UTC) #4
kmadhusu
http://codereview.chromium.org/8351048/diff/4012/chrome/browser/ui/webui/print_preview_handler.cc File chrome/browser/ui/webui/print_preview_handler.cc (right): http://codereview.chromium.org/8351048/diff/4012/chrome/browser/ui/webui/print_preview_handler.cc#newcode411 chrome/browser/ui/webui/print_preview_handler.cc:411: last_used_page_size_margins_ = new printing::PageSizeMargins(); On 2011/11/02 21:33:57, dpapad wrote: ...
9 years, 1 month ago (2011-11-02 23:46:16 UTC) #5
dpapad
Addressed comments. http://codereview.chromium.org/8351048/diff/4012/chrome/browser/ui/webui/print_preview_handler.cc File chrome/browser/ui/webui/print_preview_handler.cc (right): http://codereview.chromium.org/8351048/diff/4012/chrome/browser/ui/webui/print_preview_handler.cc#newcode411 chrome/browser/ui/webui/print_preview_handler.cc:411: last_used_page_size_margins_ = new printing::PageSizeMargins(); On 2011/11/02 23:46:16, ...
9 years, 1 month ago (2011-11-03 00:15:27 UTC) #6
kmadhusu
http://codereview.chromium.org/8351048/diff/3015/chrome/browser/resources/print_preview/margin_settings.js File chrome/browser/resources/print_preview/margin_settings.js (right): http://codereview.chromium.org/8351048/diff/3015/chrome/browser/resources/print_preview/margin_settings.js#newcode132 chrome/browser/resources/print_preview/margin_settings.js:132: // @type {boolean} True if the margins UI should ...
9 years, 1 month ago (2011-11-03 17:35:38 UTC) #7
vandebo (ex-Chrome)
http://codereview.chromium.org/8351048/diff/3015/chrome/browser/resources/print_preview/margin_settings.js File chrome/browser/resources/print_preview/margin_settings.js (right): http://codereview.chromium.org/8351048/diff/3015/chrome/browser/resources/print_preview/margin_settings.js#newcode230 chrome/browser/resources/print_preview/margin_settings.js:230: * @param {Object} lastUsedMargins The last used margins. It ...
9 years, 1 month ago (2011-11-03 18:07:27 UTC) #8
kmadhusu
http://codereview.chromium.org/8351048/diff/3015/chrome/browser/ui/webui/print_preview_handler.cc File chrome/browser/ui/webui/print_preview_handler.cc (right): http://codereview.chromium.org/8351048/diff/3015/chrome/browser/ui/webui/print_preview_handler.cc#newcode659 chrome/browser/ui/webui/print_preview_handler.cc:659: if (last_used_page_size_margins_) { On 2011/11/03 18:07:27, vandebo wrote: > ...
9 years, 1 month ago (2011-11-03 18:28:38 UTC) #9
dpapad
Posting some comments, I am still working on the source PDF case. It seems that ...
9 years, 1 month ago (2011-11-03 18:48:27 UTC) #10
kmadhusu
Initial set of comments. http://codereview.chromium.org/8351048/diff/23006/chrome/browser/resources/print_preview/margin_settings.js File chrome/browser/resources/print_preview/margin_settings.js (right): http://codereview.chromium.org/8351048/diff/23006/chrome/browser/resources/print_preview/margin_settings.js#newcode205 chrome/browser/resources/print_preview/margin_settings.js:205: * @param {{marginLeft: number, marginTop: ...
9 years, 1 month ago (2011-11-09 00:57:54 UTC) #11
dpapad
Addressed comments. http://codereview.chromium.org/8351048/diff/23006/chrome/browser/resources/print_preview/margin_settings.js File chrome/browser/resources/print_preview/margin_settings.js (right): http://codereview.chromium.org/8351048/diff/23006/chrome/browser/resources/print_preview/margin_settings.js#newcode205 chrome/browser/resources/print_preview/margin_settings.js:205: * @param {{marginLeft: number, marginTop: number, marginRight: ...
9 years, 1 month ago (2011-11-09 03:19:00 UTC) #12
kmadhusu
http://codereview.chromium.org/8351048/diff/23023/chrome/browser/printing/print_preview_message_handler.h File chrome/browser/printing/print_preview_message_handler.h (right): http://codereview.chromium.org/8351048/diff/23023/chrome/browser/printing/print_preview_message_handler.h#newcode46 chrome/browser/printing/print_preview_message_handler.h:46: void OnRequestPrintPreview(bool is_modifiable); nit: is_modifiable => source_is_modifiable http://codereview.chromium.org/8351048/diff/23023/chrome/browser/resources/print_preview/margin_settings.js File ...
9 years, 1 month ago (2011-11-09 19:26:11 UTC) #13
vandebo (ex-Chrome)
Are you ready for further review? The last status I saw was that you were ...
9 years, 1 month ago (2011-11-09 19:29:07 UTC) #14
dpapad
On 2011/11/09 19:29:07, vandebo wrote: > Are you ready for further review? The last status ...
9 years, 1 month ago (2011-11-09 19:31:12 UTC) #15
dpapad
Addressed kamdhusu's comments. Still looking on adding backend tests for sticky margins.
9 years, 1 month ago (2011-11-09 23:42:38 UTC) #16
vandebo (ex-Chrome)
LGTM http://codereview.chromium.org/8351048/diff/28021/chrome/browser/resources/print_preview/margin_settings.js File chrome/browser/resources/print_preview/margin_settings.js (right): http://codereview.chromium.org/8351048/diff/28021/chrome/browser/resources/print_preview/margin_settings.js#newcode314 chrome/browser/resources/print_preview/margin_settings.js:314: if (this.previousCustomMargins_ && Can you incorporate this check ...
9 years, 1 month ago (2011-11-10 18:39:14 UTC) #17
kmadhusu
http://codereview.chromium.org/8351048/diff/28021/chrome/browser/resources/print_preview/print_preview.js File chrome/browser/resources/print_preview/print_preview.js (right): http://codereview.chromium.org/8351048/diff/28021/chrome/browser/resources/print_preview/print_preview.js#newcode176 chrome/browser/resources/print_preview/print_preview.js:176: console.log(initialSettings); nit: remove console.log http://codereview.chromium.org/8351048/diff/28021/printing/print_job_constants.h File printing/print_job_constants.h (right): http://codereview.chromium.org/8351048/diff/28021/printing/print_job_constants.h#newcode50 ...
9 years, 1 month ago (2011-11-10 18:39:56 UTC) #18
dpapad
Addressed comments and also fixed a bug (see below). http://codereview.chromium.org/8351048/diff/28021/chrome/browser/resources/print_preview/margin_settings.js File chrome/browser/resources/print_preview/margin_settings.js (right): http://codereview.chromium.org/8351048/diff/28021/chrome/browser/resources/print_preview/margin_settings.js#newcode314 chrome/browser/resources/print_preview/margin_settings.js:314: ...
9 years, 1 month ago (2011-11-10 20:04:01 UTC) #19
kmadhusu
lgtm LGTM http://codereview.chromium.org/8351048/diff/40002/chrome/browser/ui/webui/print_preview_handler.cc File chrome/browser/ui/webui/print_preview_handler.cc (right): http://codereview.chromium.org/8351048/diff/40002/chrome/browser/ui/webui/print_preview_handler.cc#newcode101 chrome/browser/ui/webui/print_preview_handler.cc:101: const char kCloudPrintData[] = "cloudPrintData"; nit: Declare ...
9 years, 1 month ago (2011-11-10 20:45:19 UTC) #20
kmadhusu
dpapad: Are you planning to add tests for this behavior?
9 years, 1 month ago (2011-11-10 20:49:51 UTC) #21
dpapad
Added a unit_test.
9 years, 1 month ago (2011-11-11 22:19:09 UTC) #22
Lei Zhang
http://codereview.chromium.org/8351048/diff/45001/chrome/browser/ui/webui/print_preview_handler_unittest.cc File chrome/browser/ui/webui/print_preview_handler_unittest.cc (right): http://codereview.chromium.org/8351048/diff/45001/chrome/browser/ui/webui/print_preview_handler_unittest.cc#newcode63 chrome/browser/ui/webui/print_preview_handler_unittest.cc:63: settings.SetDouble(ss.str(), 25.5); make the values constants? http://codereview.chromium.org/8351048/diff/45001/chrome/browser/ui/webui/print_preview_handler_unittest.cc#newcode78 chrome/browser/ui/webui/print_preview_handler_unittest.cc:78: args.Append(new ...
9 years, 1 month ago (2011-11-11 22:56:29 UTC) #23
kmadhusu
http://codereview.chromium.org/8351048/diff/45001/chrome/browser/ui/webui/print_preview_handler_unittest.cc File chrome/browser/ui/webui/print_preview_handler_unittest.cc (right): http://codereview.chromium.org/8351048/diff/45001/chrome/browser/ui/webui/print_preview_handler_unittest.cc#newcode24 chrome/browser/ui/webui/print_preview_handler_unittest.cc:24: TEST_F(PrintPreviewHandlerTest, HandlePrintTest) { Your test case is fine. But ...
9 years, 1 month ago (2011-11-11 23:39:40 UTC) #24
dpapad
Added 3 tests for testing that settings are saved correctly, and 2 for testing that ...
9 years, 1 month ago (2011-11-14 16:31:54 UTC) #25
vandebo (ex-Chrome)
http://codereview.chromium.org/8351048/diff/51001/chrome/browser/ui/webui/print_preview_handler_unittest.cc File chrome/browser/ui/webui/print_preview_handler_unittest.cc (right): http://codereview.chromium.org/8351048/diff/51001/chrome/browser/ui/webui/print_preview_handler_unittest.cc#newcode184 chrome/browser/ui/webui/print_preview_handler_unittest.cc:184: ASSERT_TRUE(!PrintPreviewHandler::last_used_page_size_margins_); ASSERT_FALSE http://codereview.chromium.org/8351048/diff/51001/chrome/browser/ui/webui/print_preview_handler_unittest.cc#newcode198 chrome/browser/ui/webui/print_preview_handler_unittest.cc:198: Check custom margins here too.
9 years, 1 month ago (2011-11-14 17:05:39 UTC) #26
dpapad
Addressed vandebo's comments. http://codereview.chromium.org/8351048/diff/51001/chrome/browser/ui/webui/print_preview_handler_unittest.cc File chrome/browser/ui/webui/print_preview_handler_unittest.cc (right): http://codereview.chromium.org/8351048/diff/51001/chrome/browser/ui/webui/print_preview_handler_unittest.cc#newcode184 chrome/browser/ui/webui/print_preview_handler_unittest.cc:184: ASSERT_TRUE(!PrintPreviewHandler::last_used_page_size_margins_); On 2011/11/14 17:05:39, vandebo wrote: ...
9 years, 1 month ago (2011-11-14 17:20:14 UTC) #27
vandebo (ex-Chrome)
LGTM
9 years, 1 month ago (2011-11-14 17:25:35 UTC) #28
dpapad
Fixed a potential memory leak in the test code. Waiting for kmadhusu's reLGTM before landing.
9 years, 1 month ago (2011-11-14 19:59:27 UTC) #29
Lei Zhang
LGTM with a couple small nits. http://codereview.chromium.org/8351048/diff/56001/chrome/browser/ui/webui/print_preview_handler_unittest.cc File chrome/browser/ui/webui/print_preview_handler_unittest.cc (right): http://codereview.chromium.org/8351048/diff/56001/chrome/browser/ui/webui/print_preview_handler_unittest.cc#newcode190 chrome/browser/ui/webui/print_preview_handler_unittest.cc:190: const double margin_top ...
9 years, 1 month ago (2011-11-14 20:00:49 UTC) #30
kmadhusu1
FYI. I am on sheriff duty today. Please expect a delay in reviewing your CL. ...
9 years, 1 month ago (2011-11-14 20:06:04 UTC) #31
dpapad
Addressed nits. http://codereview.chromium.org/8351048/diff/56001/chrome/browser/ui/webui/print_preview_handler_unittest.cc File chrome/browser/ui/webui/print_preview_handler_unittest.cc (right): http://codereview.chromium.org/8351048/diff/56001/chrome/browser/ui/webui/print_preview_handler_unittest.cc#newcode190 chrome/browser/ui/webui/print_preview_handler_unittest.cc:190: const double margin_top = 125.5; On 2011/11/14 ...
9 years, 1 month ago (2011-11-14 23:19:58 UTC) #32
kmadhusu1
dpapad: Don't wait for my lgtm. If thestig@ is blocked on this CL, Go ahead ...
9 years, 1 month ago (2011-11-15 00:08:40 UTC) #33
Lei Zhang
http://codereview.chromium.org/8351048/diff/57022/chrome/browser/ui/webui/print_preview_ui.h File chrome/browser/ui/webui/print_preview_ui.h (right): http://codereview.chromium.org/8351048/diff/57022/chrome/browser/ui/webui/print_preview_ui.h#newcode146 chrome/browser/ui/webui/print_preview_ui.h:146: friend class PrintPreviewHandlerTest; Sorry to keep bugging you with ...
9 years, 1 month ago (2011-11-15 00:12:04 UTC) #34
dpapad
Waiting for tryjobs to complete. http://codereview.chromium.org/8351048/diff/57022/chrome/browser/ui/webui/print_preview_ui.h File chrome/browser/ui/webui/print_preview_ui.h (right): http://codereview.chromium.org/8351048/diff/57022/chrome/browser/ui/webui/print_preview_ui.h#newcode146 chrome/browser/ui/webui/print_preview_ui.h:146: friend class PrintPreviewHandlerTest; On ...
9 years, 1 month ago (2011-11-15 00:55:04 UTC) #35
kmadhusu
lgtm with a nit. http://codereview.chromium.org/8351048/diff/58001/chrome/browser/ui/webui/print_preview_handler_unittest.cc File chrome/browser/ui/webui/print_preview_handler_unittest.cc (right): http://codereview.chromium.org/8351048/diff/58001/chrome/browser/ui/webui/print_preview_handler_unittest.cc#newcode20 chrome/browser/ui/webui/print_preview_handler_unittest.cc:20: //typedef BrowserWithTestWindowTest PrintPreviewHandlerTest; Remove this ...
9 years, 1 month ago (2011-11-15 02:31:02 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dpapad@chromium.org/8351048/31016
9 years, 1 month ago (2011-11-15 02:33:33 UTC) #37
commit-bot: I haz the power
9 years, 1 month ago (2011-11-15 03:45:39 UTC) #38
Change committed as 110035

Powered by Google App Engine
This is Rietveld 408576698