Perform printer setup on Chrome OS before selecting printer.
In Chrome OS, printers might need to be configured before they can be
used. For local printers with origin CROS, perform configuration before
continuing to print preview. The chosen approach is similar to that of
the extension printers.
BUG=670819
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Review-Url: https://codereview.chromium.org/2606043004
Cr-Commit-Position: refs/heads/master@{#443735}
Committed: https://chromium.googlesource.com/chromium/src/+/f14c7a220a083a7fd6870a10f35fdcf9a8c0b01b
Description was changed from ========== Perform printer setup on Chrome OS before selecting printer. In ...
3 years, 11 months ago
(2016-12-29 23:12:47 UTC)
#1
Description was changed from
==========
Perform printer setup on Chrome OS before selecting printer.
In Chrome OS, printers might need to be configured before they can be
used. For local printers with origin CROS, perform configuration before
continuing to print preview. The chosen approach is similar to that of
the extension printers.
BUG=670819
==========
to
==========
Perform printer setup on Chrome OS before selecting printer.
In Chrome OS, printers might need to be configured before they can be
used. For local printers with origin CROS, perform configuration before
continuing to print preview. The chosen approach is similar to that of
the extension printers.
BUG=670819
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
3 years, 11 months ago
(2016-12-29 23:20:09 UTC)
#6
chrome/browser/resources/print_preview/ LGTM
xdai1
Generally looks good. https://codereview.chromium.org/2606043004/diff/1/chrome/browser/resources/print_preview/data/destination_store.js File chrome/browser/resources/print_preview/data/destination_store.js (right): https://codereview.chromium.org/2606043004/diff/1/chrome/browser/resources/print_preview/data/destination_store.js#newcode1287 chrome/browser/resources/print_preview/data/destination_store.js:1287: DestinationStore.EventType.PRINTER_CONFIGURED); Seems there is no DestinationStore.EventType.PRINTER_CONFIGURED ...
3 years, 11 months ago
(2016-12-30 00:38:13 UTC)
#7
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/339379)
3 years, 11 months ago
(2016-12-30 00:53:14 UTC)
#9
Thanks for the review. All comments have been addressed. https://codereview.chromium.org/2606043004/diff/80001/chrome/browser/resources/print_preview/data/destination_store.js File chrome/browser/resources/print_preview/data/destination_store.js (right): https://codereview.chromium.org/2606043004/diff/80001/chrome/browser/resources/print_preview/data/destination_store.js#newcode1108 chrome/browser/resources/print_preview/data/destination_store.js:1108: ...
3 years, 11 months ago
(2017-01-12 00:36:16 UTC)
#22
https://codereview.chromium.org/2606043004/diff/80001/chrome/browser/resources/print_preview/search/cros_destination_resolver.js File chrome/browser/resources/print_preview/search/cros_destination_resolver.js (right): https://codereview.chromium.org/2606043004/diff/80001/chrome/browser/resources/print_preview/search/cros_destination_resolver.js#newcode127 chrome/browser/resources/print_preview/search/cros_destination_resolver.js:127: * fulfilled when the destination resolving is finished. On ...
3 years, 11 months ago
(2017-01-12 01:18:10 UTC)
#23
https://codereview.chromium.org/2606043004/diff/80001/chrome/browser/resource...
File chrome/browser/resources/print_preview/search/cros_destination_resolver.js
(right):
https://codereview.chromium.org/2606043004/diff/80001/chrome/browser/resource...
chrome/browser/resources/print_preview/search/cros_destination_resolver.js:127:
* fulfilled when the destination resolving is finished.
On 2017/01/12 at 00:36:16, skau wrote:
> On 2017/01/11 20:36:30, dpapad wrote:
> > Indentation off
>
> Is there a linter that would catch this?
Not to my knowledge. And to be fair, this is an ambitious goal (having a well
working linter for JSDoc comments, which are not "standard" by any means). We
are not even at the point where we have a well working linter for JS itself (in
Chromium), but we are making progress on this front.
Having said that, you might want to try running clang-format and see if that
would fix it automatically.
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
File chrome/browser/resources/print_preview/data/destination_store.js (right):
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
chrome/browser/resources/print_preview/data/destination_store.js:1124:
this.nativeLayer_.setupPrinter(destination.id).
There is no need to call both then and catch. then() accepts a 2nd parameter.
Also I think this would be simpler if you simply inline the two handling
functions here, as follows.
this.nativeLayer_.setupPrinter(destination.id).then(
function(response) {
var event = ...;
...
this.dispatchEvent(event);
}.bind(this),
function() { // You don't even need the parameter anymore, just use
destination.id
...
}.bind(this));
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
chrome/browser/resources/print_preview/data/destination_store.js:1323: var event
= new Event(
Technically, we should not be augmenting a native Event with extra properties. A
much simpler (and robust) way is to use a class specifically made for custom
events, called CustomEvent
(https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent).
For example this could look as simple as follows
var event = new CustomEvent(
DestinationStore.EventType.PRINTER_CONFIGURED,
{detail: response});
this.dispatchEvent(event);
Then consumers of the event can simply refer to the "payload" of the event as
"event.detail".
I am not suggesting to do this now. We should probably cleanup all "new Event"
occurrences in print_preview/ at some point.
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
File chrome/browser/resources/print_preview/native_layer.js (right):
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
chrome/browser/resources/print_preview/native_layer.js:240: return
cr.sendWithPromise('setupPrinter', [printerId]);
Why do you need to wrap |printerId| in an array? Should not be necessary.
https://codereview.chromium.org/2606043004/diff/120001/chrome/test/data/webui...
File chrome/test/data/webui/print_preview.js (right):
https://codereview.chromium.org/2606043004/diff/120001/chrome/test/data/webui...
chrome/test/data/webui/print_preview.js:392:
this.initialSettings_.serializedAppStateStr_ =
Nit (optional): Instead of painfully constructing a JSON string manually, how
about the following?
var settings = {
version: 2,
recentDestinations: [1, 2, 3].map(function(i) {
return {
id: 'ID' + i, origin: origin, account: '', capabilities: 0,
name: '', extensionId: '', extensionName: ''
};
}),
};
this.initialSettings_.serializedAppStateStr_ = JSON.stringify(settings);
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
3 years, 11 months ago
(2017-01-12 02:03:09 UTC)
#24
Incorporated the second round of comments. PTAL. Thanks for the tips. https://codereview.chromium.org/2606043004/diff/80001/chrome/browser/resources/print_preview/search/cros_destination_resolver.js File chrome/browser/resources/print_preview/search/cros_destination_resolver.js (right): ...
3 years, 11 months ago
(2017-01-12 02:17:17 UTC)
#28
Incorporated the second round of comments. PTAL. Thanks for the tips.
https://codereview.chromium.org/2606043004/diff/80001/chrome/browser/resource...
File chrome/browser/resources/print_preview/search/cros_destination_resolver.js
(right):
https://codereview.chromium.org/2606043004/diff/80001/chrome/browser/resource...
chrome/browser/resources/print_preview/search/cros_destination_resolver.js:127:
* fulfilled when the destination resolving is finished.
On 2017/01/12 01:18:10, dpapad wrote:
> On 2017/01/12 at 00:36:16, skau wrote:
> > On 2017/01/11 20:36:30, dpapad wrote:
> > > Indentation off
> >
> > Is there a linter that would catch this?
>
> Not to my knowledge. And to be fair, this is an ambitious goal (having a well
> working linter for JSDoc comments, which are not "standard" by any means). We
> are not even at the point where we have a well working linter for JS itself
(in
> Chromium), but we are making progress on this front.
>
> Having said that, you might want to try running clang-format and see if that
> would fix it automatically.
Good to know. I just tried clang-format and it definitely ignores JSDoc.
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
File chrome/browser/resources/print_preview/data/destination_store.js (right):
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
chrome/browser/resources/print_preview/data/destination_store.js:1124:
this.nativeLayer_.setupPrinter(destination.id).
On 2017/01/12 01:18:10, dpapad wrote:
> There is no need to call both then and catch. then() accepts a 2nd parameter.
> Also I think this would be simpler if you simply inline the two handling
> functions here, as follows.
>
> this.nativeLayer_.setupPrinter(destination.id).then(
> function(response) {
> var event = ...;
> ...
> this.dispatchEvent(event);
> }.bind(this),
> function() { // You don't even need the parameter anymore, just use
> destination.id
> ...
> }.bind(this));
Done.
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
chrome/browser/resources/print_preview/data/destination_store.js:1323: var event
= new Event(
On 2017/01/12 01:18:10, dpapad wrote:
> Technically, we should not be augmenting a native Event with extra properties.
A
> much simpler (and robust) way is to use a class specifically made for custom
> events, called CustomEvent
> (https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent).
>
> For example this could look as simple as follows
>
> var event = new CustomEvent(
> DestinationStore.EventType.PRINTER_CONFIGURED,
> {detail: response});
> this.dispatchEvent(event);
>
> Then consumers of the event can simply refer to the "payload" of the event as
> "event.detail".
>
> I am not suggesting to do this now. We should probably cleanup all "new Event"
> occurrences in print_preview/ at some point.
It seems to lead to much cleaner code. I'll use it for this.
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
File chrome/browser/resources/print_preview/native_layer.js (right):
https://codereview.chromium.org/2606043004/diff/120001/chrome/browser/resourc...
chrome/browser/resources/print_preview/native_layer.js:240: return
cr.sendWithPromise('setupPrinter', [printerId]);
On 2017/01/12 01:18:10, dpapad wrote:
> Why do you need to wrap |printerId| in an array? Should not be necessary.
I've unwrapped it. Send needed it to be wrapped.
https://codereview.chromium.org/2606043004/diff/120001/chrome/test/data/webui...
File chrome/test/data/webui/print_preview.js (right):
https://codereview.chromium.org/2606043004/diff/120001/chrome/test/data/webui...
chrome/test/data/webui/print_preview.js:392:
this.initialSettings_.serializedAppStateStr_ =
On 2017/01/12 01:18:10, dpapad wrote:
> Nit (optional): Instead of painfully constructing a JSON string manually, how
> about the following?
>
> var settings = {
> version: 2,
> recentDestinations: [1, 2, 3].map(function(i) {
> return {
> id: 'ID' + i, origin: origin, account: '', capabilities: 0,
> name: '', extensionId: '', extensionName: ''
> };
> }),
> };
>
> this.initialSettings_.serializedAppStateStr_ = JSON.stringify(settings);
Done.
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
3 years, 11 months ago
(2017-01-12 02:29:06 UTC)
#29
Dry run: Try jobs failed on following builders: chromeos_daisy_chromium_compile_only_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_daisy_chromium_compile_only_ng/builds/263230)
3 years, 11 months ago
(2017-01-12 02:29:07 UTC)
#30
https://codereview.chromium.org/2606043004/diff/140001/chrome/browser/resources/print_preview/data/destination_store.js File chrome/browser/resources/print_preview/data/destination_store.js (right): https://codereview.chromium.org/2606043004/diff/140001/chrome/browser/resources/print_preview/data/destination_store.js#newcode1125 chrome/browser/resources/print_preview/data/destination_store.js:1125: then( Nit: You would avoid a lot of indentation ...
3 years, 11 months ago
(2017-01-12 19:32:50 UTC)
#31
CQ is committing da patch. Bot data: {"patchset_id": 200001, "attempt_start_ts": 1484348285866270, "parent_rev": "c711312d40ea1f9294385ae6fafdb2ceb20737c4", "commit_rev": "f14c7a220a083a7fd6870a10f35fdcf9a8c0b01b"}
3 years, 11 months ago
(2017-01-14 00:07:03 UTC)
#41
CQ is committing da patch.
Bot data: {"patchset_id": 200001, "attempt_start_ts": 1484348285866270,
"parent_rev": "c711312d40ea1f9294385ae6fafdb2ceb20737c4", "commit_rev":
"f14c7a220a083a7fd6870a10f35fdcf9a8c0b01b"}
commit-bot: I haz the power
Description was changed from ========== Perform printer setup on Chrome OS before selecting printer. In ...
3 years, 11 months ago
(2017-01-14 00:07:37 UTC)
#42
Message was sent while issue was closed.
Description was changed from
==========
Perform printer setup on Chrome OS before selecting printer.
In Chrome OS, printers might need to be configured before they can be
used. For local printers with origin CROS, perform configuration before
continuing to print preview. The chosen approach is similar to that of
the extension printers.
BUG=670819
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
to
==========
Perform printer setup on Chrome OS before selecting printer.
In Chrome OS, printers might need to be configured before they can be
used. For local printers with origin CROS, perform configuration before
continuing to print preview. The chosen approach is similar to that of
the extension printers.
BUG=670819
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Review-Url: https://codereview.chromium.org/2606043004
Cr-Commit-Position: refs/heads/master@{#443735}
Committed:
https://chromium.googlesource.com/chromium/src/+/f14c7a220a083a7fd6870a10f35f...
==========
commit-bot: I haz the power
Committed patchset #11 (id:200001) as https://chromium.googlesource.com/chromium/src/+/f14c7a220a083a7fd6870a10f35fdcf9a8c0b01b
3 years, 11 months ago
(2017-01-14 00:07:38 UTC)
#43
Issue 2606043004: Perform printer setup on Chrome OS before selecting printer.
(Closed)
Created 3 years, 11 months ago by skau
Modified 3 years, 11 months ago
Reviewers: dpapad, Vitaly Buka (NO REVIEWS), xdai1
Base URL:
Comments: 54