GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing codereview.chromium.org — Issue 2117713002: Print directly to CUPS using the IPP APIs - Code Review

Keyboard Shortcuts

File
u :up to issue
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
Issue
u :up to list of issues
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
 
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Issues Search
    My Issues | Starred     Open | Closed | All

Issue 2117713002: Print directly to CUPS using the IPP APIs (Closed)

Created:
4 years, 5 months ago by skau
Modified:
4 years, 4 months ago
Reviewers:
Lei Zhang, briannorris
CC:
chromium-reviews, adlr
Base URL:
https://chromium.googlesource.com/chromium/src.git@ippRead
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.
More Reviews

Description

Print directly to CUPS using the IPP APIs Implements printing to CUPS with paper size, color, and duplexing configurable. Existing bug where the printer does not initialize the first time it is selected. BUG=607668 TEST=Enable --enable-native-cups. Print a webpage to a desired CUPS printer. Committed: https://crrev.com/b793195a8a91fa9a17eaf4af0fa21fed4da4d9cc Cr-Commit-Position: refs/heads/master@{#408179}

Patch Set 1 #

Patch Set 2 : It prints now #

Patch Set 3 : Loggin cleaned up #

Total comments: 10

Patch Set 4 : Address review comments. #

Patch Set 5 : Update patch #

Total comments: 17

Patch Set 6 : Fixed up #

Patch Set 7 : some checks #

Patch Set 8 : Only extend metafile for Chrome OS #

Patch Set 9 : Fix document build #

Patch Set 10 : Skip compiling the chromeos context if we don't compile against cups #

Patch Set 11 : Skip compiling the chromeos context if we don't compile against cups #

Total comments: 20

Patch Set 12 : lint #

Total comments: 16

Patch Set 13 : address comments #

Patch Set 14 : format and merge #

Created: 4 years, 4 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+527 lines, -19 lines) Patch
M chrome/browser/printing/pdf_to_emf_converter.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +7 lines, -0 lines 0 comments Download
M printing/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +4 lines, -1 line 0 comments Download
M printing/backend/cups_deleters.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
M printing/backend/cups_deleters.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -0 lines 0 comments Download
M printing/backend/cups_ipp_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +9 lines, -0 lines 0 comments Download
M printing/backend/cups_ipp_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -2 lines 0 comments Download
M printing/metafile.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +6 lines, -2 lines 0 comments Download
M printing/printed_document.cc View 1 2 3 4 5 6 1 chunk +3 lines, -2 lines 0 comments Download
A printing/printed_document_chromeos.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +47 lines, -0 lines 0 comments Download
M printing/printed_document_linux.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M printing/printing.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +4 lines, -0 lines 0 comments Download
A + printing/printing_context_chromeos.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +23 lines, -8 lines 0 comments Download
A printing/printing_context_chromeos.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +401 lines, -0 lines 0 comments Download
M printing/printing_context_no_system_dialog.cc View 1 2 3 4 5 3 chunks +6 lines, -2 lines 0 comments Download

Messages

Total messages: 37 (24 generated)
Expand Messages | Collapse Messages | Show Generated Messages | Hide Generated Messages
skau
[email protected] changed reviewers: + [email protected], [email protected]
4 years, 5 months ago (2016-07-08 00:53:52 UTC) #1
[email protected] changed reviewers:
+ [email protected], [email protected]
skau
The last CL to implement printing to CUPS on Chrome OS. Please review at your ...
4 years, 5 months ago (2016-07-08 00:53:53 UTC) #2
The last CL to implement printing to CUPS on Chrome OS.

Please review at your earliest convenience.

Thanks!
Lei Zhang
https://codereview.chromium.org/2117713002/diff/40001/printing/metafile.h File printing/metafile.h (right): https://codereview.chromium.org/2117713002/diff/40001/printing/metafile.h#newcode95 printing/metafile.h:95: virtual bool GetDataAsVector(std::vector<char>* buffer) const = 0; Put this ...
4 years, 5 months ago (2016-07-08 01:35:26 UTC) #3
https://codereview.chromium.org/2117713002/diff/40001/printing/metafile.h
File printing/metafile.h (right):

https://codereview.chromium.org/2117713002/diff/40001/printing/metafile.h#new...
printing/metafile.h:95: virtual bool GetDataAsVector(std::vector<char>* buffer)
const = 0;
Put this above SaveTo() since the impl below is already in that order?

https://codereview.chromium.org/2117713002/diff/40001/printing/printed_docume...
File printing/printed_document.cc (right):

https://codereview.chromium.org/2117713002/diff/40001/printing/printed_docume...
printing/printed_document.cc:267: // This function is not used on aura
linux/chromeos or android.
Comment is out of date.

https://codereview.chromium.org/2117713002/diff/40001/printing/printing_conte...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/40001/printing/printing_conte...
printing/printing_context_chromeos.cc:46: bool use_native_cups_ = false;
g_use_native_cups ... but do you really need this?

https://codereview.chromium.org/2117713002/diff/40001/printing/printing_conte...
printing/printing_context_chromeos.cc:245: // HACK We should get this from the
device driver
What's going on here?
skau
I've responded to the comments and fixed most of them. I've left a comment regarding ...
4 years, 5 months ago (2016-07-09 00:28:33 UTC) #4
I've responded to the comments and fixed most of them.  I've left a comment
regarding the issue with the DPI.  I'll look into what might be the root cause
since I have a suspicion that dpi should not match printer resolution in some
circumstances.

https://codereview.chromium.org/2117713002/diff/40001/printing/metafile.h
File printing/metafile.h (right):

https://codereview.chromium.org/2117713002/diff/40001/printing/metafile.h#new...
printing/metafile.h:95: virtual bool GetDataAsVector(std::vector<char>* buffer)
const = 0;
On 2016/07/08 01:35:26, Lei Zhang wrote:
> Put this above SaveTo() since the impl below is already in that order?

Done.

https://codereview.chromium.org/2117713002/diff/40001/printing/printed_docume...
File printing/printed_document.cc (right):

https://codereview.chromium.org/2117713002/diff/40001/printing/printed_docume...
printing/printed_document.cc:267: // This function is not used on aura
linux/chromeos or android.
On 2016/07/08 01:35:26, Lei Zhang wrote:
> Comment is out of date.

Are there aura tests to verify that I haven't broken something?

https://codereview.chromium.org/2117713002/diff/40001/printing/printing_conte...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/40001/printing/printing_conte...
printing/printing_context_chromeos.cc:46: bool use_native_cups_ = false;
On 2016/07/08 01:35:26, Lei Zhang wrote:
> g_use_native_cups ... but do you really need this?

Nope. I had it in for debugging.

https://codereview.chromium.org/2117713002/diff/40001/printing/printing_conte...
printing/printing_context_chromeos.cc:245: // HACK We should get this from the
device driver
On 2016/07/08 01:35:26, Lei Zhang wrote:
> What's going on here?

Setting the dpi using printer the reported printer resolution has undesirable
results so I've hardcoded it to 300dpi for the time being.  It seems like the
rendering resolution (which this is used for) should sometimes be different from
the requested printer resolution.

I've updated the comment to reference the bug where I'm working on the quality
issue and added more rationale.
Lei Zhang
Still got red trybots. https://codereview.chromium.org/2117713002/diff/40001/printing/printed_document.cc File printing/printed_document.cc (right): https://codereview.chromium.org/2117713002/diff/40001/printing/printed_document.cc#newcode267 printing/printed_document.cc:267: // This function is not ...
4 years, 5 months ago (2016-07-13 01:43:06 UTC) #5
Still got red trybots.

https://codereview.chromium.org/2117713002/diff/40001/printing/printed_docume...
File printing/printed_document.cc (right):

https://codereview.chromium.org/2117713002/diff/40001/printing/printed_docume...
printing/printed_document.cc:267: // This function is not used on aura
linux/chromeos or android.
On 2016/07/09 00:28:33, skau wrote:
> On 2016/07/08 01:35:26, Lei Zhang wrote:
> > Comment is out of date.
> 
> Are there aura tests to verify that I haven't broken something?

If you put a NOTREACHED() in the body, we can see if anyone actually reaches it.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:148: return base::WrapUnique(new
PrintingContextChromeos(delegate));
base::MakeUnique

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:178: LOG(WARNING) << "No printer
selected";
BTW, consider only logging the serious stuff.
https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md...

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:241: // TODO(skau): Convert to DCHECK when
https://crbug.com/613779 is resolved
Should this also mention line 182 above?

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:271: if (printer == nullptr) {
More nullptr comparisons

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:330: return CANCEL;
Consider putting a new line after, just like line 239 or line 346.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:389: printer_.reset(nullptr);
Just reset()

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
File printing/printing_context_chromeos.h (right):

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.h:8: #include <cups/cups.h>
not needed here?

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.h:43: Result StreamData(char* buffer, int
len);
Can this take a vector?
skau
The CQ bit was checked by [email protected] to run a CQ dry run
4 years, 5 months ago (2016-07-14 21:26:23 UTC) #6
The CQ bit was checked by [email protected] to run a CQ dry run
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2117713002/100001
4 years, 5 months ago (2016-07-14 21:27:25 UTC) #7
Dry run: CQ is trying da patch. Follow status at
 
https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
skau
The CQ bit was unchecked by [email protected]
4 years, 5 months ago (2016-07-14 21:33:37 UTC) #8
The CQ bit was unchecked by [email protected]
skau
The CQ bit was checked by [email protected] to run a CQ dry run
4 years, 5 months ago (2016-07-14 21:48:59 UTC) #9
The CQ bit was checked by [email protected] to run a CQ dry run
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2117713002/120001
4 years, 5 months ago (2016-07-14 21:49:54 UTC) #10
Dry run: CQ is trying da patch. Follow status at
 
https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
commit-bot: I haz the power
The CQ bit was unchecked by [email protected]
4 years, 5 months ago (2016-07-14 22:07:06 UTC) #11
The CQ bit was unchecked by [email protected]
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_compile_dbg_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_compile_dbg_ng/builds/231208)
4 years, 5 months ago (2016-07-14 22:07:07 UTC) #12
Dry run: Try jobs failed on following builders:
  linux_chromium_chromeos_compile_dbg_ng on master.tryserver.chromium.linux
(JOB_FAILED,
http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
skau
The CQ bit was checked by [email protected] to run a CQ dry run
4 years, 5 months ago (2016-07-14 23:42:46 UTC) #13
The CQ bit was checked by [email protected] to run a CQ dry run
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2117713002/160001
4 years, 5 months ago (2016-07-14 23:43:06 UTC) #14
Dry run: CQ is trying da patch. Follow status at
 
https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
skau
Thanks for the review. I'm pretty sure I fixed all the trybots, I'll keep an ...
4 years, 5 months ago (2016-07-14 23:47:13 UTC) #15
Thanks for the review.  I'm pretty sure I fixed all the trybots, I'll keep an
eye on it.

https://codereview.chromium.org/2117713002/diff/40001/printing/printed_docume...
File printing/printed_document.cc (right):

https://codereview.chromium.org/2117713002/diff/40001/printing/printed_docume...
printing/printed_document.cc:267: // This function is not used on aura
linux/chromeos or android.
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> On 2016/07/09 00:28:33, skau wrote:
> > On 2016/07/08 01:35:26, Lei Zhang wrote:
> > > Comment is out of date.
> > 
> > Are there aura tests to verify that I haven't broken something?
> 
> If you put a NOTREACHED() in the body, we can see if anyone actually reaches
it.

Done.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:148: return base::WrapUnique(new
PrintingContextChromeos(delegate));
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> base::MakeUnique

Done.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:178: LOG(WARNING) << "No printer
selected";
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> BTW, consider only logging the serious stuff.
>
https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md...

I've switched some to debug logging and removed this specific statement.  I left
a few though as they indicate an unexpected condition but don't warrant a crash.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:241: // TODO(skau): Convert to DCHECK when
https://crbug.com/613779 is resolved
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> Should this also mention line 182 above?

They're linked now.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:271: if (printer == nullptr) {
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> More nullptr comparisons

Done.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:271: if (printer == nullptr) {
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> More nullptr comparisons

Done.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:330: return CANCEL;
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> Consider putting a new line after, just like line 239 or line 346.

Done.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.cc:389: printer_.reset(nullptr);
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> Just reset()

Done.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
File printing/printing_context_chromeos.h (right):

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.h:8: #include <cups/cups.h>
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> not needed here?

Done.

https://codereview.chromium.org/2117713002/diff/80001/printing/printing_conte...
printing/printing_context_chromeos.h:43: Result StreamData(char* buffer, int
len);
On 2016/07/13 01:43:05, Lei Zhang (Slow Thursday) wrote:
> Can this take a vector?

Yes
commit-bot: I haz the power
The CQ bit was unchecked by [email protected]
4 years, 5 months ago (2016-07-14 23:59:42 UTC) #16
The CQ bit was unchecked by [email protected]
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_compile_dbg_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_compile_dbg_ng/builds/231292) linux_chromium_chromeos_rel_ng on ...
4 years, 5 months ago (2016-07-14 23:59:43 UTC) #17
Dry run: Try jobs failed on following builders:
  linux_chromium_chromeos_compile_dbg_ng on master.tryserver.chromium.linux
(JOB_FAILED,
http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
  linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED,
http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
skau
The CQ bit was checked by [email protected] to run a CQ dry run
4 years, 5 months ago (2016-07-15 00:58:16 UTC) #18
The CQ bit was checked by [email protected] to run a CQ dry run
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2117713002/200001
4 years, 5 months ago (2016-07-15 00:58:52 UTC) #19
Dry run: CQ is trying da patch. Follow status at
 
https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
skau
The CQ bit was checked by [email protected] to run a CQ dry run
4 years, 5 months ago (2016-07-15 00:59:11 UTC) #20
The CQ bit was checked by [email protected] to run a CQ dry run
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2117713002/200001
4 years, 5 months ago (2016-07-15 00:59:29 UTC) #21
Dry run: CQ is trying da patch. Follow status at
 
https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
commit-bot: I haz the power
The CQ bit was unchecked by [email protected]
4 years, 5 months ago (2016-07-15 02:11:11 UTC) #22
The CQ bit was unchecked by [email protected]
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 5 months ago (2016-07-15 02:11:13 UTC) #23
Dry run: This issue passed the CQ dry run.
Lei Zhang
https://codereview.chromium.org/2117713002/diff/200001/printing/metafile.h File printing/metafile.h (right): https://codereview.chromium.org/2117713002/diff/200001/printing/metafile.h#newcode167 printing/metafile.h:167: bool GetDataAsVector(std::vector<char>* buffer) const; This feels a bit weird. ...
4 years, 5 months ago (2016-07-20 01:26:57 UTC) #24
https://codereview.chromium.org/2117713002/diff/200001/printing/metafile.h
File printing/metafile.h (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/metafile.h#ne...
printing/metafile.h:167: bool GetDataAsVector(std::vector<char>* buffer) const;
This feels a bit weird. Why don't we just remove the OS_CHROME ifdefs? I think
that's cleaner, even it it adds an extra method that does not get used on other
platforms.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing.gyp
File printing/printing.gyp (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/printing.gyp#...
printing/printing.gyp:208: 'printed_document_chromeos.cc',
Should the changes here match printing/BUILD.gn? If this CL drags on a bit
longer, all the .gyp files might get deleted. :)

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:78: char* CopyStringToChar(const
base::StringPiece value, char** dst) {
Do you need |dst| here?

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:79: int value_len = value.size() + 1;
Type should be size_t, or just drop this variable altogether and use
value.size() or value.size() + 1 below as needed. Instead of having value_len -
1.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:80: *dst = new char[value_len];
Who deletes these strings?

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:81: value.copy(*dst, value_len);
Is this copying 1 extra byte than necessary?

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:142: if
(PrintBackend::GetNativeCupsEnabled()) {
No need for braces -> compact down to 3 lines.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
File printing/printing_context_chromeos.h (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.h:15: #include
"printing/backend/print_backend.h"
is this needed here?

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.h:41: Result StreamData(const
std::vector<char>& buffer);
Don't squeeze this into the middle of a list of overrides.
skau
I addressed the comments and unified the constants. PTAL. https://codereview.chromium.org/2117713002/diff/200001/printing/metafile.h File printing/metafile.h (right): https://codereview.chromium.org/2117713002/diff/200001/printing/metafile.h#newcode167 printing/metafile.h:167: ...
4 years, 5 months ago (2016-07-22 23:36:14 UTC) #25
I addressed the comments and unified the constants.  PTAL.

https://codereview.chromium.org/2117713002/diff/200001/printing/metafile.h
File printing/metafile.h (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/metafile.h#ne...
printing/metafile.h:167: bool GetDataAsVector(std::vector<char>* buffer) const;
On 2016/07/20 01:26:56, Lei Zhang wrote:
> This feels a bit weird. Why don't we just remove the OS_CHROME ifdefs? I think
> that's cleaner, even it it adds an extra method that does not get used on
other
> platforms.

It happens that there's a Windows implementation of MetafilePlayer.  But I'll go
implement it there.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing.gyp
File printing/printing.gyp (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/printing.gyp#...
printing/printing.gyp:208: 'printed_document_chromeos.cc',
On 2016/07/20 01:26:56, Lei Zhang wrote:
> Should the changes here match printing/BUILD.gn? If this CL drags on a bit
> longer, all the .gyp files might get deleted. :)

I'm counting the days...

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:78: char* CopyStringToChar(const
base::StringPiece value, char** dst) {
On 2016/07/20 01:26:56, Lei Zhang wrote:
> Do you need |dst| here?

Not really.  Removed.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:79: int value_len = value.size() + 1;
On 2016/07/20 01:26:56, Lei Zhang wrote:
> Type should be size_t, or just drop this variable altogether and use
> value.size() or value.size() + 1 below as needed. Instead of having value_len
-
> 1.

Done.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:80: *dst = new char[value_len];
On 2016/07/20 01:26:57, Lei Zhang wrote:
> Who deletes these strings?

It is currently leaking memory.  But I'll fix it so cups_option_t objects have
deleters.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:81: value.copy(*dst, value_len);
On 2016/07/20 01:26:56, Lei Zhang wrote:
> Is this copying 1 extra byte than necessary?

It is.  I think strlcpy is cleaner so I'm changing it.  Is there a standard way
to do this?  It seems like there should be...

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:142: if
(PrintBackend::GetNativeCupsEnabled()) {
On 2016/07/20 01:26:56, Lei Zhang wrote:
> No need for braces -> compact down to 3 lines.

Done.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
File printing/printing_context_chromeos.h (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.h:15: #include
"printing/backend/print_backend.h"
On 2016/07/20 01:26:57, Lei Zhang wrote:
> is this needed here?

Done.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.h:41: Result StreamData(const
std::vector<char>& buffer);
On 2016/07/20 01:26:57, Lei Zhang wrote:
> Don't squeeze this into the middle of a list of overrides.

Done.
Lei Zhang
https://codereview.chromium.org/2117713002/diff/200001/printing/printing_context_chromeos.cc File printing/printing_context_chromeos.cc (right): https://codereview.chromium.org/2117713002/diff/200001/printing/printing_context_chromeos.cc#newcode81 printing/printing_context_chromeos.cc:81: value.copy(*dst, value_len); On 2016/07/22 23:36:14, skau wrote: > On ...
4 years, 5 months ago (2016-07-25 21:06:04 UTC) #26
https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:81: value.copy(*dst, value_len);
On 2016/07/22 23:36:14, skau wrote:
> On 2016/07/20 01:26:56, Lei Zhang wrote:
> > Is this copying 1 extra byte than necessary?
> 
> It is.  I think strlcpy is cleaner so I'm changing it.  Is there a standard
way
> to do this?  It seems like there should be...

How about using base::StringPiece::copy() ?

char* dst = new char[value.size() + 1];
value.copy(dst, value.size());
dst[value.size()] = '\0';
return dst;

https://codereview.chromium.org/2117713002/diff/220001/chrome/browser/printin...
File chrome/browser/printing/pdf_to_emf_converter.cc (right):

https://codereview.chromium.org/2117713002/diff/220001/chrome/browser/printin...
chrome/browser/printing/pdf_to_emf_converter.cc:263: bool
LazyEmf::GetDataAsVector(std::vector<char>* buffer) const {
Thanks for implemeting this... but will this ever get called? i.e. Should this
just be NOTREACHED(); return false;?

https://codereview.chromium.org/2117713002/diff/220001/printing/backend/cups_...
File printing/backend/cups_ipp_util.h (right):

https://codereview.chromium.org/2117713002/diff/220001/printing/backend/cups_...
printing/backend/cups_ipp_util.h:17: extern const char kIppCollate[];  // RFC
3381
No need for comments here.

https://codereview.chromium.org/2117713002/diff/220001/printing/printed_docum...
File printing/printed_document_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/220001/printing/printed_docum...
printing/printed_document_chromeos.cc:13: #endif  // USE_CUPS
So some of the printing code does not set the best example. This should be //
defined(USE_CUPS). i.e. #if $FOO should be mirrored by // $FOO.

Though in this particular case, I'd say don't even bother because:
1) there's no nesting
2) the #if is very close, so it's already obvious what this #endif pairs with.

Line 26 below should have the comment because nesting.
Line 44 below should have the comment because it's a bit far away from the #if.

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.cc:34: using CupsOption =
std::unique_ptr<cups_option_t, OptionDeleter>;
Can you name this ScopedCupsOption, so it's more obvious that this is a smart
pointer?

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.cc:74: // is null terminated and will need to
be deleted.
The more common phrase here would be "the caller owns the returned string."

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.cc:75: char* ToCString(const
base::StringPiece value) {
TOCString() -> more like, DuplicateString() ?

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.cc:85: option->name = ToCString(name);
It's probably not obvious to readers that CupsOption is going delete the
name/value here. Even reading the cupsFreeOptions() documentation is not
completely obvious and I had to peek at the cupsFreeOptions() source code to see
what it does. So a comment here to say (Scoped)CupsOption will delete the
strings is helpful.

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
File printing/printing_context_chromeos.h (right):

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.h:53: // id for ongoing print job.  -1 if no
job is active.
printing_context_chromeos.cc checks for 0, what is 0?
skau
The CQ bit was checked by [email protected] to run a CQ dry run
4 years, 4 months ago (2016-07-27 00:16:03 UTC) #27
The CQ bit was checked by [email protected] to run a CQ dry run
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2117713002/260001
4 years, 4 months ago (2016-07-27 00:16:23 UTC) #28
Dry run: CQ is trying da patch. Follow status at
 
https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
skau
Comments addressed. PTAL. https://codereview.chromium.org/2117713002/diff/200001/printing/printing_context_chromeos.cc File printing/printing_context_chromeos.cc (right): https://codereview.chromium.org/2117713002/diff/200001/printing/printing_context_chromeos.cc#newcode81 printing/printing_context_chromeos.cc:81: value.copy(*dst, value_len); On 2016/07/25 21:06:03, Lei ...
4 years, 4 months ago (2016-07-27 00:16:47 UTC) #29
Comments addressed.  PTAL.

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/200001/printing/printing_cont...
printing/printing_context_chromeos.cc:81: value.copy(*dst, value_len);
On 2016/07/25 21:06:03, Lei Zhang wrote:
> On 2016/07/22 23:36:14, skau wrote:
> > On 2016/07/20 01:26:56, Lei Zhang wrote:
> > > Is this copying 1 extra byte than necessary?
> > 
> > It is.  I think strlcpy is cleaner so I'm changing it.  Is there a standard
> way
> > to do this?  It seems like there should be...
> 
> How about using base::StringPiece::copy() ?
> 
> char* dst = new char[value.size() + 1];
> value.copy(dst, value.size());
> dst[value.size()] = '\0';
> return dst;

Done.

https://codereview.chromium.org/2117713002/diff/220001/chrome/browser/printin...
File chrome/browser/printing/pdf_to_emf_converter.cc (right):

https://codereview.chromium.org/2117713002/diff/220001/chrome/browser/printin...
chrome/browser/printing/pdf_to_emf_converter.cc:263: bool
LazyEmf::GetDataAsVector(std::vector<char>* buffer) const {
On 2016/07/25 21:06:04, Lei Zhang wrote:
> Thanks for implemeting this... but will this ever get called? i.e. Should this
> just be NOTREACHED(); return false;?

It's not currently called.  NOTREACHED() probably works better since it's not
anticipated to be used.

https://codereview.chromium.org/2117713002/diff/220001/printing/backend/cups_...
File printing/backend/cups_ipp_util.h (right):

https://codereview.chromium.org/2117713002/diff/220001/printing/backend/cups_...
printing/backend/cups_ipp_util.h:17: extern const char kIppCollate[];  // RFC
3381
On 2016/07/25 21:06:04, Lei Zhang wrote:
> No need for comments here.

Done.

https://codereview.chromium.org/2117713002/diff/220001/printing/printed_docum...
File printing/printed_document_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/220001/printing/printed_docum...
printing/printed_document_chromeos.cc:13: #endif  // USE_CUPS
On 2016/07/25 21:06:04, Lei Zhang wrote:
> So some of the printing code does not set the best example. This should be //
> defined(USE_CUPS). i.e. #if $FOO should be mirrored by // $FOO.
> 
> Though in this particular case, I'd say don't even bother because:
> 1) there's no nesting
> 2) the #if is very close, so it's already obvious what this #endif pairs with.
> 
> Line 26 below should have the comment because nesting.
> Line 44 below should have the comment because it's a bit far away from the
#if.

Done.

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
File printing/printing_context_chromeos.cc (right):

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.cc:34: using CupsOption =
std::unique_ptr<cups_option_t, OptionDeleter>;
On 2016/07/25 21:06:04, Lei Zhang wrote:
> Can you name this ScopedCupsOption, so it's more obvious that this is a smart
> pointer?

Done.

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.cc:74: // is null terminated and will need to
be deleted.
On 2016/07/25 21:06:04, Lei Zhang wrote:
> The more common phrase here would be "the caller owns the returned string."

Done.

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.cc:75: char* ToCString(const
base::StringPiece value) {
On 2016/07/25 21:06:04, Lei Zhang wrote:
> TOCString() -> more like, DuplicateString() ?

Done.

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.cc:85: option->name = ToCString(name);
On 2016/07/25 21:06:04, Lei Zhang wrote:
> It's probably not obvious to readers that CupsOption is going delete the
> name/value here. Even reading the cupsFreeOptions() documentation is not
> completely obvious and I had to peek at the cupsFreeOptions() source code to
see
> what it does. So a comment here to say (Scoped)CupsOption will delete the
> strings is helpful.

Done.

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
File printing/printing_context_chromeos.h (right):

https://codereview.chromium.org/2117713002/diff/220001/printing/printing_cont...
printing/printing_context_chromeos.h:53: // id for ongoing print job.  -1 if no
job is active.
On 2016/07/25 21:06:04, Lei Zhang wrote:
> printing_context_chromeos.cc checks for 0, what is 0?

If the createDestJob fails, job_id is set to 0.  I'll just use 0 for everything
since they shouldn't need differentiation and I appear to have forgotten anyway.
commit-bot: I haz the power
The CQ bit was unchecked by [email protected]
4 years, 4 months ago (2016-07-27 01:06:50 UTC) #30
The CQ bit was unchecked by [email protected]
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 4 months ago (2016-07-27 01:06:51 UTC) #31
Dry run: This issue passed the CQ dry run.
Lei Zhang
lgtm
4 years, 4 months ago (2016-07-27 02:02:29 UTC) #32
lgtm
skau
The CQ bit was checked by [email protected]
4 years, 4 months ago (2016-07-27 17:57:20 UTC) #33
The CQ bit was checked by [email protected]
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2117713002/260001
4 years, 4 months ago (2016-07-27 17:57:45 UTC) #34
CQ is trying da patch. Follow status at
 
https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
commit-bot: I haz the power
Committed patchset #14 (id:260001)
4 years, 4 months ago (2016-07-27 18:05:07 UTC) #35
Message was sent while issue was closed.
Committed patchset #14 (id:260001)
commit-bot: I haz the power
Description was changed from ========== Print directly to CUPS using the IPP APIs Implements printing ...
4 years, 4 months ago (2016-07-27 18:07:15 UTC) #36
Message was sent while issue was closed.
Description was changed from

==========
Print directly to CUPS using the IPP APIs

Implements printing to CUPS with paper size, color, and duplexing
configurable.

Existing bug where the printer does not initialize the first time it is
selected.

BUG=607668

TEST=Enable --enable-native-cups.  Print a webpage to a desired CUPS
printer.
==========

to

==========
Print directly to CUPS using the IPP APIs

Implements printing to CUPS with paper size, color, and duplexing
configurable.

Existing bug where the printer does not initialize the first time it is
selected.

BUG=607668

TEST=Enable --enable-native-cups.  Print a webpage to a desired CUPS
printer.

Committed: https://crrev.com/b793195a8a91fa9a17eaf4af0fa21fed4da4d9cc
Cr-Commit-Position: refs/heads/master@{#408179}
==========
commit-bot: I haz the power
Patchset 14 (id:??) landed as https://crrev.com/b793195a8a91fa9a17eaf4af0fa21fed4da4d9cc Cr-Commit-Position: refs/heads/master@{#408179}
4 years, 4 months ago (2016-07-27 18:07:16 UTC) #37
Message was sent while issue was closed.
Patchset 14 (id:??) landed as
https://crrev.com/b793195a8a91fa9a17eaf4af0fa21fed4da4d9cc
Cr-Commit-Position: refs/heads/master@{#408179}
Expand Messages | Collapse Messages | Show Generated Messages | Hide Generated Messages
Issue 2117713002: Print directly to CUPS using the IPP APIs (Closed)
Created 4 years, 5 months ago by skau
Modified 4 years, 4 months ago
Reviewers: Lei Zhang, briannorris
Base URL: https://chromium.googlesource.com/chromium/src.git@ippRead
Comments: 63

Powered by Google App Engine
This is Rietveld 408576698
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.