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

Side by Side Diff: printing/printed_document_chromeos.cc

Issue 2117713002: Print directly to CUPS using the IPP APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ippRead
Patch Set: Skip compiling the chromeos context if we don't compile against cups Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "printing/printed_document.h"
6
7 #include "base/logging.h"
8 #include "printing/page_number.h"
9 #include "printing/printed_page.h"
10
11 #if defined(USE_CUPS)
12 #include "printing/printing_context_chromeos.h"
13 #endif // USE_CUPS
14
15 namespace printing {
16
17 void PrintedDocument::RenderPrintedPage(const PrintedPage& page,
18 PrintingContext* context) const {
19 #if defined(USE_CUPS)
20 #if defined(NDEBUG)
21 {
22 // Make sure the page is from our list.
23 base::AutoLock lock(lock_);
24 DCHECK(&page == mutable_.pages_.find(page.page_number() - 1)->second.get());
25 }
26 #endif // NDEBUG
27
28 DCHECK(context);
29
30 {
31 base::AutoLock lock(lock_);
32 if (page.page_number() - 1 == mutable_.first_page) {
33 std::vector<char> buffer;
34
35 if (page.metafile()->GetDataAsVector(&buffer)) {
36 static_cast<PrintingContextChromeos*>(context)->StreamData(buffer);
37 } else {
38 LOG(WARNING) << "Failed to read data from metafile";
39 }
40 }
41 }
42 #else
43 NOTREACHED();
44 #endif // USE_CUPS
45 }
46
47 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698